Re: DB_DataObjects : orderBy + getLink doesn't work
| From: | Alan Knowles | Date: | Tue, 26 Jul 2005 01:54:45 +0000 |
| Subject: | Re: DB_DataObjects : orderBy + getLink doesn't work | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-20132@lists.php.net to get a copy of this message | ||
On Mon, 2005-07-25 at 15:21 +0200, David Alia wrote:
> Hi,
>
> I currently use this (lightened) code, inside a class definition :
>
> function getArrayOfB($order) {
>
> $A = $this->factory('A');
> $A->synagogueID = $id;
>
> $prop = $this->factory('B');
>
> $i = 0;
> if ($A->find()) {
> while ($A->fetch()) {
> $prop->orderBy($order);
> $prop =& $A->getLink('b_ID');
You have just deleted the $prop var here.. and replaced it with the link
results..
To explain this, turn debugging on, look at the SQL statements being
run, then say what you wanted to be run... - that way I can understand
the purpose of this..
Regards
Alan
> $arr[$i] = $prop;
> $i++;
> }
> return $a
> }
>
> that returns an array of B objects.
>
> Problem : the orderBy clause is not taken into account.
>
> What's wrong ?
>
> Thanks
>
> David