php - ZF2 share models between modules -
hi i'm trying share models between modules, when call getservicelocator()->get('mail\model\mail') in controller module class cannot found.
i'm searching solution few days now, can't find 1 thats working me.
public function getserviceconfig() { return array( 'factories' => array( 'mail\model\mail' => function($sm) { $mail = new mail(); return $mail; }, 'mail\model\mailtable' => function($sm) { $tablegateway = $sm->get('mailtablegateway'); $table = new mailtable($tablegateway); return $table; }, 'mailtablegateway' => function($sm) { $dbadapter = $sm->get('zend\db\adapter\adapter'); $resultsetprototype = new resultset(); $resultsetprototype->setarrayobjectprototype(new mail()); return new tablegateway('mail', $dbadapter, null, $resultsetprototype); } ) ); }
when return string instead it's working fine know i'm calling right key, when try return class can't found.
in mail module class working fine.. if need more information please let me know.
thanks in advance!
Comments
Post a Comment