New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DDC-916: many to one #5444
Comments
Comment created by @beberlei: I need the full mapping of both Hotel and HotelType regarding the $hotelType and the sql schema, additionally i need the full error message with stack trace that happens in the query. |
Comment created by mungiu: This is the model and sql When i decomment hotel_type mapping i receive this Message: Unknown column type requested. #0 D:\wamp\www\find-booking\library\Doctrine\DBAL\Types\Type.php(141): Doctrine\DBAL\DBALException::unknownColumnType(NULL) And what i say i can acces many to one for room as getRoomType->getTip); bit not getHotelType->getTip() $rsm = new Doctrine\ORM\Query\ResultSetMapping; $query = $this->em->createNativeQuery("SELECT -- Table structure for table
|
Comment created by @beberlei: This is not a bug, you have the mapping wrong. The error message clearly points you to your mistake. One of the ->addEntityField calls has a non-existant/wrong field. |
Comment created by mungiu: But, the field exist, how to mapping in another way? HOw is my mistake, if the model is corect and the field exist in database? How come if i put for example $rsm->addFieldResult('h', 'denumire_x', 'denumire_x'); and denumire_x doesn exist don=t dhow me any warning and if i put that field who exist give that error? |
Comment created by mungiu: Sorry you can close again , you right the mapping cause that, i understand now when to use field result and when to use meta result.. Tanks for take your time. Apologize. |
Issue was closed with resolution "Fixed" |
Jira issue originally created by user mungiu:
First i describe my tables. I have hotel, hotel_type, room, room_type. I use native query for retrive the result. So hotel have many to one with hotel_type, and room with room_type. So the problem i can do for example $room->getRoomType()->getTip(), but i can't do $hotel[0]->getHotelType()->getTip(). Sorry if this is't a bug but i can't explain why many to one for room works and for hotel not. If you need any other information i be glad to provide.
In model i have:
/****
* @var HotelType
*
* @manytoone(targetEntity="Application_Model_HotelType")
* @JoinColumns({
* @joincolumn(name="hotel_type", referencedColumnName="id")
* })
*/
private $hotelType;
The text was updated successfully, but these errors were encountered: