just re read your post , i think i know what you want. 
you want one to one map between your model and db table. i think you
extended wrong class, you need to extend Row or Rowset classes, not table
class. or you have to develop your own model class that embeding zend row
class.

regards.



debussy007 wrote:
> 
> I can get sql results but what I want is getting Zend_Db_Table objects
> back (Model objects).
> Because since the beginning of my project I used models extending Zend Db
> Table but now I regret it and maybe I should have used my own models and
> have standard sql code.
> 
> So if in the manual you see anywhere where it explains how to execute an
> sql string query and return Zend_Db_Table objects back, let me know.
> 
> class Selections extends Zend_Db_Table_Abstract {
>       protected $_name = 'selections';
>       protected $_referenceMap = array(
>               'Article' => array(
>                       'columns' => 'art_id', 
>                       'refTableClass' => 'Articles', 
>                       'refColumns' => 'id_art'
>               ),
>               'Member'  => array(
>                       'columns' => 'member_id', 
>                       'refTableClass' => 'Members', 
>                       'refColumns' => 'id_member'
>               )
>       );
> }
> 
> $sql = 
>       "select * from articles G, selections S " . 
>       "where G.id_art = S.art_id " .
>       "and S.member_id = " . $auth->getIdentity()->id_member . 
>       "and G.to_delete = 0";
> $db = Zend_Registry::get('dbAdapter');
> 
> // get Selections model objects
> 
> Maybe I am doing something wrong somewhere ? because what I try to do
> seems so basic and can't find a way  :(
> 
> 
> ctx2002 wrote:
>> 
>> looking at ZF manual, the manaul showed many ways to get sql result.
>> 
>> regards.
>> 
>> debussy007 wrote:
>>> 
>>> Hello,
>>> 
>>> In my web application I simply want to get the bookmarked articles of a
>>> user :
>>> 
>>> select * from articles G, selections S 
>>> where G.id_art = S.art_id 
>>> and S.member_id = 2 
>>> and G.to_delete = 0;
>>> 
>>> I want to get the result in my model object which extends Zend db table,
>>> "Article" 
>>> (And I don't need the returned selections data of the query)
>>> 
>>> What is the usual way to do such a thing ?
>>> 
>>> Thank you !
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Get-sql-results-in-my-Model-%28Zend_Db_Table%29-tp14370287s16154p14392288.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to