>
> It seems to me that this would really be *your ORM* ;)
> Personally, I don't see how your requirements conform with a KISS
> principle. However, possibly you could achieve your goals by extending
> overriding Zend_Db_Table's methods in your own *_Table classes.
>
No, it's very much KISS (to use), and yes, it was done through inheritance. It
looks something like this:
// ORM class for the table 'dogs'
class Table_dogs extends MyORM_Table {
var $table = 'dogs';
var $primary = 'DogID';
function __construct() {
parent::__construct();
// if user is not 'super', only allow certain breeds
global $user;
if(!$user->isSuperUser()) {
// JOIN breeds USING(DogID)
$this->join('breeds')->using('DogID');
// only allow the correct certain breeds:
$this->where("breeds.BreedID IN({$user->breeds()})");
}
}
}
I can't think of an easier way to add blanket rules which apply to an entire
project.
regards,
Peter
____________________________________________________
On Yahoo!7
Photos: Unlimited free storage keep all your photos in one place!
http://au.photos.yahoo.com