Details
Description
I was trying to adjust the Zend_Auth DB adapter result to include the user role for a simple ACL I'm doing (I've tables "users" and "roles", with the former containing a FK to the latter).
// $select instanceof Zend_Db_Select: $select ->from(array('u' => 'users'), array('username')) ->joinLeft(array('r' => 'roles'), 'u.role_id = r.role_id', array('role' => 'name')); // gives SELECT `u`.`username`, `r`.`name` AS `role` FROM `users` AS `u` LEFT JOIN `roles` AS `r` ON u.role_id = r.role_id $select ->joinLeft(array('r' => 'roles'), 'u.role_id = r.role_id', array('role' => 'name')) ->from(array('u' => 'users'), array('username')); // gives SELECT `r`.`name` AS `role`, `u`.`username` FROM `roles` AS `r` INNER JOIN `users` AS `u`
The DB auth adapter returns an empty $select so anything I do to it get's done first. This may be viewed as the adapter's fault but IMHO, you shouldn't force a specific order of calling the methods: I've said from('table') and expect to really be FROM table. ![]()
Yeah, the code tag didn't take, hope this doesn't mean my issue get's disqualified.