Hi Fabien,

OK, thanks for the explanation. I had to change one small thing to get
it to work (there's still sfController in the getCallable method...
now I know where it was copied from ;) )

Stefan

On Aug 9, 5:55 pm, Fabien POTENCIER <[EMAIL PROTECTED]
project.com> wrote:
> Stefan,
>
> The shortcut callMixins() has issues with the Zend Platform. So use the
> more verbose syntax:
>
>    public function __call($method, $arguments)
>    {
>      if (!$callable = sfMixer::getCallable('sfController:'.$method))
>      {
>        throw new sfException(sprintf('Call to undefined method
> Track::%s.', $method));
>      }
>
>      array_unshift($arguments, $this);
>
>      return call_user_func_array($callable, $arguments);
>    }
>
> Fabien
>
> Stefan Koopmanschap wrote:
> > Guys,
>
> > I've been trying to implement mixins for the first time, using the
> > documentation as the leading source for how to do this. I've got
> > several models that need some checks. The implementation I currently
> > have is:
>
> > models:
> > Track
> > Release
>
> > class in lib/:
> > ValidationHandler
> > contains methods:
> > addBlocker()
> > addWarning()
> > getWarnings()
> > getBlockers()
>
> > in Track and Release, I've added a new method:
>
> >     public function __call($method, $arguments) {
> >         return sfMixer::callMixins();
> >     }
>
> > and below the model definitions, I've added:
>
> > sfMixer::register('Track', array('ValidationHandler', 'getWarnings'));
> > sfMixer::register('Track', array('ValidationHandler', 'getBlockers'));
> > sfMixer::register('Track', array('ValidationHandler', 'addWarning'));
> > sfMixer::register('Track', array('ValidationHandler', 'addBlocker'));
>
> > in Track and:
>
> > sfMixer::register('Release', array('ValidationHandler',
> > 'getWarnings'));
> > sfMixer::register('Release', array('ValidationHandler',
> > 'getBlockers'));
> > sfMixer::register('Release', array('ValidationHandler',
> > 'addWarning'));
> > sfMixer::register('Release', array('ValidationHandler',
> > 'addBlocker'));
>
> > in Release
>
> > I have specific validation methods that are only called in some
> > situations, but when called, will be using addBlocker and addWarning
> > to fill up the warnings and blockers. Now when I trigger such a
> > situation, I get a lot of php warnings:
>
> > Notice: Undefined index: object in /usr/share/php/symfony/util/
> > sfMixer.class.php on line 165
>
> > Warning: call_user_func_array() [function.call-user-func-array]: First
> > argument is expected to be a valid callback,
> > 'ValidationHandler::addBlocker' was given in /usr/share/php/symfony/
> > util/sfMixer.class.php on line 179
>
> > Now I found ticket #1038:http://trac.symfony-project.com/trac/ticket/1038,
> > which refers to Zend Optimizer changing PHP behaviour. Is this the
> > problem? Will mixins not work when using Zend Platform? Or am I doing
> > something stupid here?
>
> > Stefan


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" 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.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to