/**
  * @see Editor_Models_ConceptValidator::validate($concept)
  */
 public function isValid(Editor_Models_Concept $concept, $extraData)
 {
     $this->_setField('broader');
     $isValid = true;
     $allBroaders = $concept->getRelationsByField('broader', null, array($concept, 'getAllRelations'));
     $allNarrowers = $concept->getRelationsByField('narrower', null, array($concept, 'getAllRelations'));
     $matches = array_uintersect($allBroaders, $allNarrowers, array('Api_Models_Concept', 'compare'));
     if (!empty($matches)) {
         $isValid = false;
         foreach ($matches as $broader) {
             $broader = new Editor_Models_Concept($broader);
             $this->_addConflictedConcept($broader);
         }
     }
     if (!$isValid) {
         $this->_setErrorMessage(_('One or more of the broader relations create a cycle'));
     }
     return $isValid;
 }
 /**
  * @see Editor_Models_ConceptValidator::validate($concept)
  */
 public function isValid(Editor_Models_Concept $concept, $extraData)
 {
     $this->_setField('broader');
     $isValid = true;
     $allNarrowers = $concept->getRelationsByField('narrower', null, array($concept, 'getAllRelations'));
     foreach ($allNarrowers as $narrower) {
         $narrower = new Editor_Models_Concept($narrower);
         if ($concept->hasRelationInDepth('narrower', $narrower, false)) {
             $isValid = false;
             $this->_addConflictedConcept($narrower);
         }
     }
     if (!$isValid) {
         $this->_setErrorMessage(_('One or more of narrower relations have also a relation via an intermediate concepts'));
     }
     return $isValid;
 }
 /**
  * @see Editor_Models_ConceptValidator::validate($concept)
  */
 public function isValid(Editor_Models_Concept $concept, $extraData)
 {
     $this->_setField('narrower');
     $isValid = true;
     $allNarrowers = $concept->getRelationsByField('narrower', null, array($concept, 'getAllRelations'));
     foreach ($allNarrowers as $narrower) {
         $narrower = new Editor_Models_Concept($narrower);
         if ($narrower->hasRelationInDepth('narrower', $concept)) {
             $isValid = false;
             $this->_addConflictedConcept($narrower);
         }
     }
     if (!$isValid) {
         $this->_setErrorMessage(_('One or more of the narrower relations create a cycle'));
     }
     return $isValid;
 }