Re: DataObjects
| From: | mitchell perilstein | Date: | Tue, 20 May 2003 04:34:09 +0000 |
| Subject: | Re: DataObjects | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-5446@lists.php.net to get a copy of this message | ||
On Mon, 2003-05-19 at 17:35, Barry Steele wrote:
> Oh, and on another issue, if I have a linked object (eg Employee -
> Dept)
>
> how do I reference Dept details within the Employee object after a
> get_link() ?
>
> for example
>
> emp = new DataObject_Employee;
>
> emp->get(123);
> emp->get_links();
> print ($emp->dept->deptName); ??? - I tried thi sonce and failed and
> could figure it out
You were close... Try $emp->_dept->deptName. $emp->dept is the
key member in your object, $emp->_dept gets filled in by the getLink()
or getLinks() call.
Hint for debugging: Do a print_r($emp) before and after your
$emp->getLinks(). If things are working, you will not see a _dept
member before and you will see a full one after.
Another hint for debugging:
$emp->debugLevel(1); // debug on
// do stuff here ....
$emp->debugLevel(0); // debug off
hth,
--
Mitchell Perilstein
mitch at enetis dot net
www.enetis.net/~mitch