I ask thee, which is easier to read and understand? ::
$sql = <<<EOT
SELECT e.eventName, v.VenueName, c.City
FROM EventVenue ev
LEFT JOIN Event e ON ev.eventid=e.eventid
LEFT JOIN Venue v ON ev.venueid=v.venueid
LEFT JOIN Area a ON e.areaid=a.areaid
LEFT JOIN City c ON a.cityid=c.cityid;
EOT;
---- or ----
$sql = $this->select()->setIntegrityCheck(false)
->from($this, array() )
->joinLeftUsing( array('e'=>'Event'), 'EventId', array('EventName') )
->joinLeftUsing( array('v'=>'Venue'), 'VenueId', array('VenueName') )
->joinLeft( array('a'=>'Area'), 'e.AreaId = a.AreaId', array() )
->joinLeft( array('c'=>'City'), 'a.CityId = c.CityId', array('City') );
Object models are a neat idea, but good god, the code is a mess. It's
starting to look like Perl....
monk.e.boy
--
View this message in context: http://www.nabble.com/re-2-%3A--fw-db--Using-the-Zend_Db_Table-to-return-referenced-row-values-tp18728740p18728740.html
Sent from the Zend DB mailing list archive at Nabble.com.
没有评论:
发表评论