Issues

ZF2-412: The second Callback is not called

Description

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


$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

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.

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

Fixed by weierophinney