sfMixer relies on stuff that's really only intended for PHP debugging and is not supported in better, faster PHP runtimes with bytecode caching. Or something like that... I gather. (:
You could do this: class betterForm extends sfForm { // Cool stuff } And in your own form classes, write this: class myForm extends betterForm { // An actual form } But that won't work for doctrine (or propel) autogenerated forms. They extend sfDoctrineForm which extends sfForm. Fabien's new dependency injection framework could solve this perhaps. Or wait for traits (or grafts?) to appear in PHP 5.4. Otherwise... well, you could jump ship to Ruby or Scala which have real mixin support now... (I'm not planning to do that myself, but it's one of the choices. (: ) -Tom On Mon, Apr 13, 2009 at 11:32 AM, naholyr <naho...@gmail.com> wrote: > > Hello, > > I'm currently looking for a clean way to add methods to sfForm, and I > see no other way than writing directly in the sfForm.class.php file : > ( (for information, I was trying to implement what's described in this > article : http://webmozarts.com/2009/04/12/improving-the-forms ) > > If there is another way, I would pleased to know it (but it would then > take better place in users ML), but it reminds me each time how > extending core classes is a real pain when it's not made this way. > > Would it be such an overhead to use sfMixer on all the core classes ? > At lease the main ones that cannot be put in factories.yml like > sfForm, sfActions, etc... > > If sfForm had a few sfMixer::callMixins() in its methods and the __call > () magic, I could add my "addField()" method in a plugin, the clean > way. Instead of this I have two choices : > - Patch sfForm.class.php : beuark ! > - Make a "myForm" class which extends sfForm (good) but patch all > classes extending sfForm to make them extend myForm instead : > beeeeeuuuuark ! > > Please, a few sfMixer::callMixins() :') > > > -- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to symfony-devs@googlegroups.com To unsubscribe from this group, send email to symfony-devs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en -~----------~----~----~----~------~----~------~--~---