Take a look on
http://framework.zend.com/manual/en/zend.db.html#zend.db.adapter.select.fetch-mode,
there are some fetch modes and Zend_Db::FETCH_OBJ is probably what you need.


zend-2 wrote:
> 
> I have starting to look at Zend Framework and to convert one of my project
> to this Framework. But I have work with a relation database in mysql where
> I
> query many special queries with many inner and left joins. That can not be
> done in ZF what I have read. So I will have to make a member function for
> my
> model that returns: $this->_db->query($query)->fetchAll();
> 
> $todo->GetTodos();
> 
> Returning an array of rows form the database containing query of many
> tables
> 
> In my controllers I run:
> 
> $this->view->todos = $todo->getTodos();
> 
> And in my views I have to use:
> 
> <?=$this->todo['id']?>
> 
> For accessing the variables.
> 
> But if I can use the abstract class for the Todo table I would in my views
> use:
> 
> <?=$this->todo->id?>
> 
> So my question is:
> 
> What is the preferred way to access data from databases in view?
> $this->todo->id or $this->todo['id]?
> 
> And are they some easy way to convert my getTodos() to -> notation or the
> other way around from -> notation to an array (todo['tablefields']).
> 
> /Kristoffer Wiklund
> 

-- 
View this message in context: 
http://www.nabble.com/DB-model-access-in-views-tf3976127s16154.html#a11289893
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to