[TYPO3-mvc] Weird behaviour of persiting sub/child objects

Thomas "Thasmo" Deinhamer thasmo at gmail.com
Fri Jan 29 00:10:12 CET 2010


Good evening,

this code behaves very weird:

-----
# create a new cart item
$cartItem = new Tx_HypeStore_Domain_Model_CartItem;
$cartItem->setProduct($product);
$cartItem->setQuantity(10);
//$cartItem->setCustomer($this->customer);

# add the new cart item
$this->customer->addCartItem($cartItem);
-----

The result is, that the cartItem object gets persisted
to the database table, but the customer property
is not set. It's just 0.

If I comment in '$cartItem->setCustomer($this->customer);'
the customer property is set, also in the database correctly.

Is this an intended behaviour or am I
maybe missing some kind of relation definition somewhere?

Thanks a lot for your help,
Thomas


More information about the TYPO3-project-typo3v4mvc mailing list