[TYPO3-english] Why am I having trouble saving objects to the database in a typo3 v4.5.30 extension?
Calgacus map Brude
calgach at gmail.com
Tue Nov 26 23:07:30 CET 2013
Why won't my user and coupon objects get saved to the database when a new record is created?
I am using typo3 v 4.5.30 and making a little extension (my first) to manage some coupons. When I create a coupon I save the creator (a frontenduser) and it gets saved to the DB correctly. But when I do the same thing for a coupon user that user ( and the coupon ) do not get saved to the db. Consider this code frag which attempts to save the user and the coupon in a usedcoupon table. The usedcoupon table basically just has 2 columns one for the user and one for the coupon.
To get a usedcoupon object I called the objectmanagers create method. The user and coupon objects I already have and look right when I var_dump them. Even when I get them from the usedcoupon object they look ok but they don't get saved to the db even when the new record gets created. This code in in my CouponController in an action method.
$used = $this->objectManager>create('Tx_BpsCoupons_Domain_Model_UsedCoupon');
$userx = $used->getUser();
$coupx = $used->getCoupon();
/// var_dumps of userx and coupx show good objects
//after this I can examine the db and see the new record but the user and coupon fields are empty, and no errors are seen
More information about the TYPO3-english