2008年7月28日星期一

Re: [fw-db] Using the Zend_Db_Table to return referenced row values

dele454 wrote:
>
> $sql = $this->select();
> ->joinLeftUsing('venuecategory', 'CategoryID');
>

This is simply a syntax error based on a typo. You have ended a line with a
semicolon and then expected to continue the expression on the next line with
`->' object notation.

This is a rudimentary mistake and you should be able to resolve it without
posting to a mailing list. Are you familiar with reviewing PHP error
messages in your Apache log file?

Correcting the syntax error, there is still a problem, because
Zend_Db_Table_Select requires you to specify a from() clause before you can
join to another table. I don't know why this was designed this way.

You also need to set integrity check to false to permit joins. So your
function should be as follows:

public function getAllVenues() {
$sql = $this->select()->setIntegrityCheck(false)
->from($this)
->joinLeftUsing('venuecategory', 'CategoryID');
$result = $this->fetchAll($sql)->toArray();
return $result;
}

Regards,
Bill Karwin
--
View this message in context: http://www.nabble.com/Using-the-Zend_Db_Table-to-return-referenced-row-values-tp18688983p18690592.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: