Issues

ZF2-412: The second Callback is not called

Issue Type: Bug Created: 2012-07-20T01:16:28.000+0000 Last Updated: 2012-07-26T21:03:20.000+0000 Status: Resolved Fix version(s): Reporter: Michael Ben-Nes (mbn_18) Assignee: Thomas Weidner (thomas) Tags: - Zend\Validator

  • callback
  • validator

Related issues: Attachments:

Description

The second Callback is not called. I switched between them and got same result (the new second was not called)

<pre class="highlight">
$this->add($factory->createInput(array(
    'name'       => 'related_activity_id',
    'required'   => true,
    'validators' => array(
        array(
            'name' => 'Digits',
            'options' => array(
                'messages' => array(
                    'notDigits' => "No Related Activity ID was selected for update",
                ),
            ),
        ),
        array(
            'name'              => 'Callback',
            'options'           => array(
                'callback'      => array($model, 'isRelatedActivityConnected'),
                'messages'      => array(
                    'callbackValue'  => "The Related Activity is already connected to the current Activity",
                ),
            ),
        ),
        array(
            'name'              => 'Callback',
            'options'           => array(
                'callback'      => array($model, 'activityExist'),
                'messages'   => array(
                        'callbackValue'  => "The submited Related Activity ID does not exist",
                ),
            ),
        ),
    ),
)));

Comments

Posted by Matthew Weier O'Phinney (matthew) on 2012-07-26T18:54:09.000+0000

Can you verify that you have both callback validators registered, and that they are different instances? I suspect that you're getting the same instance, but I want to verify. If that's the case, we can easily patch this.

Posted by Matthew Weier O'Phinney (matthew) on 2012-07-26T20:37:52.000+0000

I verified it, and discovered the same issue in FilterChain. A PR has been created to resolve the issue: https://github.com/zendframework/zf2/pull/2011

Posted by Michael Ben-Nes (mbn_18) on 2012-07-26T21:03:20.000+0000

Fixed by weierophinney

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts