#1544: Doctrine::loadModels() change returned models in aggressive versus
conservative mode
--------------------------------------------+-------------------------------
Reporter: piccoloprincipe | Owner: jwage
Type: defect | Status: new
Priority: major | Milestone:
Component: Import/Export | Version: 1.0.2
Keywords: loadModels, export, aggressive | Has_test: 0
Mystatus: Pending Core Response | Has_patch: 0
--------------------------------------------+-------------------------------
Doctrine::loadModels($dir) when conservative mode is set is
Doctrine_Manager will return all models present in $dir.
However, when aggressive mode is set instead, this method will only return
models that were not loaded before the call.
That's because makes a array diff between get_declared_classes() called
before inclusion and after inclusion.
Please note that (in aggressive mode) this prevent the export of sql or
the creation of tables to work if in your script you use a class before
the exporting (this is very common as classes can be used in the
application bootstrap). For instance I was wondering why only 11 of my 13
classes/tables were exported: 2 of them were loaded for various reason in
my environement setup.
A workaround is to set conservative mode, but it will require the use of
autoloading:
<?
spl_autoload_register(array('Doctrine', 'autoload'));
Doctrine_Manager::getInstance()->setAttribute('model_loading',
'conservative');
--
Ticket URL: <http://trac.doctrine-project.org/ticket/1544>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-svn" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---