ServiceNotFoundException

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

ServiceNotFoundException

Emmanuel GAUTHIER
Hi everyone,
 and thanks for your help.

I have this error when i'm trying to use a classTable in my controller.

Error :  Zend\ServiceManager\ServiceManager::get was unable to fetch or
create an instance for getUserTable

I try to call this function in my controller :

/...
if(!$row = $this->getUserTable()->getUserFB($user_id) ){
/....


Before I add on Module.php :
 public function getServiceConfig()
 {
 return array(

'factories' => array(
 'UserTable' =>  function($sm) {
$tableGateway = $sm->get('UserTableGateway');
 $table = new UserTable($tableGateway);
return $table;
},
 'UserTableGateway' => function ($sm) {
$dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
 $resultSetPrototype = new ResultSet();
$resultSetPrototype->setArrayObjectPrototype(new Album());
 return new TableGateway('user', $dbAdapter, null, $resultSetPrototype);
},
 )
);


ALSO IN MODULE.CONFIG.PHP :
 'db' => array(
            'driver'         => 'Pdo',
            'dsn'            => 'mysql:dbname=futtix;host=localhost',
            'driver_options' => array(
            PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''
            ),
            ),
'service_manager' => array (
'factories' => array (
 'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory',
'Zend\Db\Adapter\Adapter'=> 'Zend\Db\Adapter\AdapterServiceFactory',
 )
 ),



Do you have an idea why i have this error ?

Thank you all.

--
Emmanuel GAUTHIER
Tél : 06 45 34 00 97