When using using Doctrine 1.2.1 and Zend Framework 1.9.x to generate classes from Yaml/db each Base class (which includes the table definition) extends the Doctrine_Record class.
I need to find a way of telling Doctrine to extend my own Base class, or find a different solution to a master/slave db setup using Doctrine.
Example generated model:
abstract class My_Base_User extends Doctrine_Record
{
However I need it to be automatically generated as:
abstract class My_Base_User extends My_Record
{
And the answer is (drumroll)
Typical, as soon as I ask the question I manage to find the answer. I’m recording it here in case anyone else has the same issue.
You can pass in the parameter ‘baseClassName’ into the generateModels* methods and Doctrine will use that as the Base record class.
Examples:
Doctrine_Core::generateModelsFromDb('models', array('master'), array('generateTableClasses' => true, 'baseClassName' => 'My_Record'));
or using Cli:
$options['generate_models_options'] = array(
'pearStyle' => true,
'baseClassPrefix' => 'My_',
'baseClassName' => 'My_Record',
'classPrefix' => '',
'classPrefixFiles' => false,
'generateTableClasses' => true,
);
$cli = new Doctrine_Cli($options);
Beim nächsten ist der erste Vorag über Sinn und Unsinn von ORM (Object Relational Mapping) mit PHP (Doctrine): http://tr.im/KmJY
Rdavid.net: Test Results on Memory Usage of Zend Framework and Doctrine with APC: On Rdavid.net there… http://bit.ly/5hBUOy
Working with doctrine 1.0.8. Waiting for Doctrine 2. http://www.slideshare.net/jwage/doctrine-2-enterprise-persistence-layer-for-php
No Shock Doctrine for Haiti
I think I’ll sta playing with Doctrine 2.0 http://tinyurl.com/doctrine20-php-orm
New Sound Doctrine strip Saturday. Until then I give you this spin-off: http://www.webcomicsnation.com/ramblingfriar/tonybaltho/series.php