Development

#3227 (Cannot override a plugin's model class (the plugin's model class is always loaded, even when lib/MyClass exists))

You must first sign up to be able to contribute.

Ticket #3227 (new defect)

Opened 3 months ago

Cannot override a plugin's model class (the plugin's model class is always loaded, even when lib/MyClass exists)

Reported by: naholyr Assigned to: fabien
Priority: major Milestone:
Component: model Version: 1.0.12
Keywords: Cc:
Qualification: Unreviewed

Description

Original issue is a problem of overriding a plugin's model class. Thread (French) here : http://groups.google.fr/group/symfony-fr/browse_thread/thread/5a6f1d128726ca65?hl=fr&

The problem is that we shouldn't edit files in a plugin directory (to keep the plugin "update-proof"), so if we want to override the model the idea is to copy the "plugins/Plugin/lib/model/Class.php" (which is supposed to be empty and simply extend PluginClass?) to "lib/model/Class.php", and as the Symfony autoloader is smart it will load in priority the latter one.

But as Propel builds Peer classes, they always call "Propel::import($cls)" to import the class, and it results in this bug : the class is never overriden, unless we have called "new Class()" somewhere before (to force the Symfony's autoloading of "Class")...

The solution could be patching SfPeerBuilder? to make it "clean" the generated Peer classes. See joined patch.

Attachments

SfPeerBuilder.patch (0.8 kB) - added by naholyr on 03/28/08 00:56:59.
patch addon/propel/builder/SfPeerBuilder.php to remove Propel::import() calls

Change History

03/28/08 00:56:59 changed by naholyr

  • attachment SfPeerBuilder.patch added.

patch addon/propel/builder/SfPeerBuilder.php to remove Propel::import() calls