How to generate Doctrine models/classes that extend a custom record class

Posted by Shane O'Grady on Stack Overflow See other posts from Stack Overflow or by Shane O'Grady
Published on 2009-12-10T13:04:57Z Indexed on 2010/05/28 13:02 UTC
Read the original article Hit count: 304

Filed under:
|
|
|

When I use Doctrine to generate classes from Yaml/db each Base class (which includes the table definition) extends the Doctrine_Record class.

Since my app uses a master and (multiple) slave db servers I need to be able to make the Base classes extend my custom record class to force writes to go to the master db server (as described here). However if I change the base class manually I lose it again when I regenerate my classes from Yaml/db using Doctrine.

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
{

I am using Doctrine 1.2.1 in a new Zend Framework 1.9.6 application if it makes any difference.

© Stack Overflow or respective owner

Related posts about php

Related posts about orm