Ver Mensaje Individual
  #14 (permalink)  
Antiguo 05/10/2012, 15:19
Avatar de timoteo666
timoteo666
 
Fecha de Ingreso: agosto-2011
Ubicación: /home/Gdl
Mensajes: 242
Antigüedad: 13 años, 1 mes
Puntos: 11
Respuesta: zf2 + conf local

Gracias GatorV, creo que ya voy comprendiendo mas, en mi Module.php en la funciona getServicesConfig agregue lo siguiente

Código PHP:
Ver original
  1. public function getServiceConfig() {
  2.         return array(
  3.             'factories' => array(
  4.                 'ZendSkeletonModule\Model\OperacionTable' => function($sm) {
  5.                     $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
  6.                     $table = new OperacionTable($dbAdapter);
  7.                     return $table;
  8.                 },
  9.                 'Db'=>function($sm){
  10.                     $config = $sm->get('config');
  11.                     return $config['db'];
  12.                 },
  13.             ),
  14.         );
  15.     }

Y en mi controller lo llamo de la siguiente manera

Código PHP:
Ver original
  1. $midb = $this->getEvent()->getApplication()->getServiceManager()->get('Db');

es correcto??

Cita:
Iniciado por GatorV Ver Mensaje
Lee el link que te dejo @masterpuppet, y revisa el Module.php, ahí puedes ver como declaran la configuración del ServiceManager.

Saludos.
__________________
( + ) lineas de código ( - ) televisión