Herman,
sorry for posting more than one thread, I tought my questions are
different, let's post everything just here. so I am posting my mapping
info and any other questions just below as two questions:
in Rem.php entity I have this ManyToOne mapping with Info.php entity,
each Rem may have only one related record in Info. product_id coloumn
is not key nor indexed as id coloumn is key here.
$metadata->mapManyToOne(array( 'fieldName' => 'Info',
'targetEntity' => 'Entities\\Info',
'inversedBy' => 'Info',
'joinColumns' => array( 0 => array(
'name' => 'product_id',
'referencedColumnName' => 'product_id',
'nullable' => true,
'columnDefinition' => NULL,
), )
));
====
In Info.php I have this OneToMany mapping with Rem.php entity, each
Info may have more than one related record in Rem, product_id coloumn
is not key nor indexed another coloumn id is key here.
$metadata->mapOneToMany(array( 'fieldName' => 'Rem',
'targetEntity' => 'Entities\\Rem',
'mappedBy' => 'Rem',
'joinColumns' => array( 0 => array(
'name' => 'product_id',
'referencedColumnName' => 'product_id',
'nullable' => true,
'columnDefinition' => NULL,
), )
));
When I run getArrayResult like "SELECT u, c FROM" I get an array like this:
Array
(
[0] => Array
(
[id] => 1
[clientId] => 1
[orderId] => 3
[productId] => 1
[Info] => Array
(
[id] => 1
[productId] => 1
[optVar1] => foo
)
)
)
this array seems okay and expected, but I use "SELECT u, c.optVar1
FROM" I get this array:
Array
(
[0] => Array
(
[0] => Array
(
[id] => 1
[clientId] => 1
[orderId] => 3
[productId] => 1
)
[optVar1] => foo
)
)
Is it normal to get this array? I tought I should get an array
structure like the first one but just with optVar1 in it?
This is normal or I did a mistake?
P.S. I appreciate plural/singular and caps letter correction too, if
there is any yet!
2) Also if I use getResult instead of getArrayResult, I get this error:
NOTICE:
Undefined index: id in
/home2/edited/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php
on line 2603
NOTICE:
Undefined index: productId in
/home2/edited/public_html/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php
on line 121
NOTICE:
Undefined index: productId in
/home2/edited/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php
on line 2692
NOTICE:
Undefined index: in
/home2/edited/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php
on line 2693
Fatal error: Call to a member function setValue() on a non-object in
/home2/edited/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php
on line 2693
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/groups/opt_out.