Page 1 of 1

Accessing related records in beforeSave($record)

PostPosted: Fri Aug 26, 2011 4:49 am
by barryrs
Good morning.. and happy friday to y'all!! :)

I'm having trouble accessing my related records from the $record object, here's what seems to happen..
beforeSave($record)
$trans = $record->getRelatedRecords('Allocations'); // fails: undefined method PEAR_Error::getOrderColumn() yyssw.. try..
$trans = $record->getRelatedRecords('Allocations', 'AllocID'); // fails: undefined method PEAR_Error::getSQL() .. ugh!!
$amount = $record->val('Amount'); // This works just fine though
print_r($record); // Yeay!! I can see the data I'm looking for!!

I guess what I'm asking is, am I doing something wrong in my effort to obtain the related records? Is there a better way?
(keeping in mind that I actually want to change something in the records...)

Thanks again,
-Baer

Re: Accessing related records in beforeSave($record)

PostPosted: Fri Aug 26, 2011 6:57 am
by shannah
Check the name of the relationship. Looks like it may not be finding it. Case sensitive.

Re: Accessing related records in beforeSave($record)

PostPosted: Sat Sep 03, 2011 6:06 am
by barryrs
Thank you... stupid question... hate when I do that...:(