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

Reply via email to