Why cant i return the full $bean

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

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$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;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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
  • $fkeyBean is an object of the class holo_FeatureKey while $result['fkey'] is not an object, you are assigning an object to an array element.

    I think that if you look at your PHP error log you will see an error to that effect.

    FrancescaS