Skip to content

Instantly share code, notes, and snippets.

@jasongrimes
Created May 3, 2012 02:15
Show Gist options
  • Save jasongrimes/2582576 to your computer and use it in GitHub Desktop.
Save jasongrimes/2582576 to your computer and use it in GitHub Desktop.
Extension of Akrabat's ZF2 tutorial adding support for Doctrine.
<?php
namespace Album;
use PDO;
return array(
'di' => array(
'instance' => array(
'alias' => array(
'album' => 'Album\Controller\AlbumController',
),
'Album\Controller\AlbumController' => array(
'parameters' => array(
// 'albumTable' => 'Album\Model\AlbumTable',
'em' => 'doctrine_em',
),
),
'Album\Model\AlbumTable' => array(
'parameters' => array(
'adapter' => 'Zend\Db\Adapter\Adapter',
)
),
'Zend\Db\Adapter\Adapter' => array(
'parameters' => array(
'driver' => array(
'driver' => 'Pdo',
'dsn' => 'mysql:dbname=zf2tutorial;hostname=localhost',
'username' => '...',
'password' => '...',
'driver_options' => array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''
),
),
)
),
'Zend\View\Resolver\TemplatePathStack' => array(
'parameters' => array(
'paths' => array(
'album' => __DIR__ . '/../view',
),
),
),
'orm_driver_chain' => array(
'parameters' => array(
'drivers' => array(
'Album' => array(
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'namespace' => __NAMESPACE__ . '\Entity',
'paths' => array(
__DIR__ . '/../src/' . __NAMESPACE__ . '/Entity'
),
),
),
),
),
),
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment