What type of data should I send to view?

Posted by Vizualni on Stack Overflow See other posts from Stack Overflow or by Vizualni
Published on 2011-02-19T14:30:05Z Indexed on 2011/02/19 15:25 UTC
Read the original article Hit count: 113

Filed under:
|

Hello, this question I've been asking myself since the day I started programming in MVC way. Should I send to view arrays filled with data or should I send it as on objects I retrieved from database? My model returns me data as objects. What would be the best way to create such a thing?

$new_data = $model->find_by_id(1);

echo $new_data->name; 

$new_data->name= "whatever";

$new_data->save();

For example. view.php

echo $object->name;

or

echo $array['name']

Language is php :).

© Stack Overflow or respective owner

Related posts about php

Related posts about mvc