Reputation: 1262
This is how I've been accessing model methods from my controllers:
$contactsTable = new Application_Model_DbTable_ContactsBasics();
$contact = $basicsTable->getContact($contacts_id);
How can I do the same by doing it like this?
$contact = Application_Model_DbTable_ContactsBasics::getContact($contacts_id);
I find the second way a little faster and easier to read, what do I have to do make it work, I already tried it but It doesn't work.
Upvotes: 0
Views: 238
Reputation: 22152
To achieve your goal, you have to declare the getContact()
method as static
. Anyway you should declare a static method only when it has sense, not just because of a "more readable" code.
Upvotes: 3