public function isTargetValid(ExecutionContextInterface $context)
    {
        // Menu is not root and has no url or Article linked
        if ($this->getParent() != $this && !$this->getUrl() && !$this->getArticle()) {
            $context->addViolationAt('url', 'This value should not be blank.');
        }
    }
public function isTargetValid(ExecutionContextInterface $context)
    {
        // Menu is not root and has no url or Article linked
        if ($this->getParent() != $this && !$this->getUrl() && !$this->getArticle()) {
            $context->addViolationAt('url', 'This value should not be blank.');
        }
    }
public function isTargetValid ( ExecutionContextInterface $ context ) { // Menu is not root and has no url or Article linked if ( $ this -> getParent ( ) != $ this && ! $ this -> getUrl ( ) && ! $ this -> getArticle ( ) ) { $ context -> addViolationAt ( 'url' , 'This value should not be blank.' ) ; } }
Check if Menu has url or Article linked if not root

@Assert\Callback

@author Vincent CHALAMON <vincentchalamon@gmail.com>
@param ExecutionContextInterface $context
Check if Menu has url or Article linked if not root