public function verifyAccount($value, ExecutionContextInterface $context)
    {
        if ($value == 1) {
            $data = $context->getRoot()->getData();
            if (false === $data['password'] || (empty($data['password']) && '0' != $data['password'])) {
                $context->getViolations()->add(new ConstraintViolation(
                    Translator::getInstance()->trans('This value should not be blank.'),
                    'account_password',
                    array(),
                    $context->getRoot(),
                    'children[password].data',
                    'propertyPath'
                ));
            }
        }
    }
public function verifyAccount($value, ExecutionContextInterface $context)
    {
        if ($value == 1) {
            $data = $context->getRoot()->getData();
            if (false === $data['password'] || (empty($data['password']) && '0' != $data['password'])) {
                $context->getViolations()->add(new ConstraintViolation(
                    Translator::getInstance()->trans('This value should not be blank.'),
                    'account_password',
                    array(),
                    $context->getRoot(),
                    'children[password].data',
                    'propertyPath'
                ));
            }
        }
    }
public function verifyAccount ( $ value , ExecutionContextInterface $ context ) { if ( $ value == 1 ) { $ data = $ context -> getRoot ( ) -> getData ( ) ; if ( false === $ data [ 'password' ] || ( empty ( $ data [ 'password' ] ) && '0' != $ data [ 'password' ] ) ) { $ context -> getViolations ( ) -> add ( new ConstraintViolation ( Translator :: getInstance ( ) -> trans ( 'This value should not be blank.' ) , 'account_password' , array ( ) , $ context -> getRoot ( ) , 'children[password].data' , 'propertyPath' ) ) ; } } }
If the user select "Yes, I have a password", we check the password.
If the user select Yes I have a password we check the password .