array(
'connection' => array(
// connection configuration
),
'configuration' => array(
'orm_default' => array(
'generate_proxies' => false,
'metadata_cache' => 'apc',
'query_cache' => 'apc',
'result_cache' => 'apc',
),
),
)
);
You can see list of other types of supported caches in the doctrine module source.
Thursday, January 16, 2014
How to enable APC caching for Doctrine Zend 2 module
How to generate doctrine entities from database
Following command is executed from /home/projects/zend-skeleton/vendor/bin folder:
./doctrine-module orm:convert-mapping --from-database annotation --namespace="Application\Entity\\"
/home/projects/zendskeleton/module/Application/src
Note: In the latest version of doctrine module you can also run it from project root directory like this:
php public/index.php orm:convert-mapping --from-database annotation --namespace="Application\Entity\\"
/home/projects/zendskeleton/module/Application/src
Generated entities will be in folder /home/projects/zendskeleton/module/Application/src/Application/Entity/ and will have namespace Application\Entity.
If you have enum types in the database you have to add following lines to application configuration:
'doctrine_type_mappings' => array(
'enum' => 'string'
);
so it looks like this:
array(
'connection' => array(
'orm_default' => array(
'driverClass'=>'Doctrine\DBAL\Driver\PDOMySql\Driver',
'params' => array(
'host' => 'localhost',
'dbname' => 'xxxx',
'user' => 'xxxx',
'password' => 'xxxx'
),
'doctrine_type_mappings' => array(
'enum' => 'string'
)
),
)
)
);
Subscribe to:
Posts (Atom)