I want to return the full bean object after save but, if I try to get the whole bean nothing gets returned in my api
The code below saved a bean and I can get the bean ID but I also want to return the full bean
$fkeyBean = BeanFactory::newBean("holo_FeatureKey"); $fkeyBean->name = $args['name']; $fkeyBean->status = $args['status']; $fkeyBean->holokotetype = $args['type']; $fkeyBean->description = $args['description']; $fkeyBean->holo_featurekey_contactscontacts_ida = $contact_id; $fkeyBean->accounts_holo_featurekey_1accounts_ida = $account_id; $fkeyBean->accounts_holo_featurekey_2accounts_ida = $account_id; $fkeyBean->uuid_c = $args['uuid']; $fkeyBean->end_user_or_dealer_c = $args['enduser']; $fkeyBean->google_uuid_c = $args['google_uuid']; $fkeyBean->google_drive_url_c = $args['google']; $fkeyBean->ponumber = $args['ponumber']; $fkeyBean->save(); if ($fkeyBean->load_relationship('s_serialnumber_holo_featurekey_1')) { $fkeyBean->s_serialnumber_holo_featurekey_1->add($serial_id); } if (isset($fkeyBean->id) && !empty($fkeyBean->id)) { $result['success'] = true; $result['fkey_id'] = $fkeyBean->id; $result['fkey'] = $fkeyBean; return $result; }
Line 23
$result['fkey'] = $fkeyBean;
this breaks the code but I don;'t get any error in the sugar log. If i comment out this line then i get the ID so why cant i return the whole object