To clearly separate the Controller and View layers, I do not longer want to pass full objects to my views. Instead I want to pass only arrays and objects that contain the data but do not have any methods. Otherwise a view script would be able to delete Doctrine records or traverse in the object tree to data that was not intended for the view.
Share
You’re doing something that is completely senseless. What’s the point of that? You won’t stop yourself/other programmers from illegal operations in the view layer. Maybe you won’t be able to do
$obj->delete();butDoctrine_Query::create()->delete()->from('ObjectTable')->execute();will be still available.Pass object to the view and just don’t execute such methods on them – that’s what you should do.