Quantcast
Viewing latest article 6
Browse Latest Browse All 10

An Easier Way to Instantiate Models in Zend Framework Controllers

I get sick of having to type this: $someTable = new Some_Table(); $someTable->someMethod(); Since PHP can’t chain on instantiation this gets very annoying. I added this to my base controller (which all of my controllers extend): public function __get($name) { if (substr($name, -5) == 'Table') { $tableName = ucwords(substr($name, 0, -5)) . '_Table'; return new [...]

Viewing latest article 6
Browse Latest Browse All 10

Trending Articles