How can I use a Mysql View as a Table Model in ZF?
I'm now receiving this error, which is totally right:
A table must have a primary key, but none was found
since views don't have Pkeys.
The only way i can use views now is by doing this:
$select = $table->select() ->setIntegrityCheck(false)
->from('v_myview')
->where('c_username = ?',"$loggedinuser->username");
$results = $table->fetchAll($select);
I think there should be a way to avoid this long road.
and i'm first initiating a 'useless' table since afterwards i'm selecting the from from another 'table(view)',
so performance wise this isn't right either.
Thanks,
Patrick
没有评论:
发表评论