예제 #1
0
 public function __construct(Relation $relation, User $user, $action)
 {
     $this->user = $user;
     $this->relation = $relation;
     $this->startnode = $relation->getStart();
     $this->setValue($relation->getValue());
     $this->rank = $relation->getRank();
     $this->action = $action;
     $this->qualifier = $relation->getQualifier();
     $this->action_time = new \DateTime();
 }
예제 #2
0
 public function addRelation(Relation $relation)
 {
     $targetId = null;
     //startnode is always of type node
     $sourceId = $this->addNode($relation->getStart());
     if ($relation->getProperty()->getDatatype() == 'node') {
         $targetId = $this->addNode($relation->getValue());
     } elseif ($relation->getProperty()->getDatatype() == 'geometry') {
         //not added
     } else {
         $targetId = $this->addValue($relation->getValue());
     }
     if (isset($targetId)) {
         $this->links[] = ['source' => $sourceId, 'target' => $targetId, 'pname' => $relation->getProperty()->getName()];
     }
 }
예제 #3
0
파일: DAO.php 프로젝트: samuvack/admin
 private function validateRelation(Relation $relation)
 {
     if (!isset($this->relations[$relation->getStart()->getId()])) {
         $this->relations[$relation->getStart()->getId()] = array();
     } else {
         if (isset($this->relations[$relation->getStart()->getId()][$relation->_getValue()])) {
             return false;
         }
     }
     $this->relations[$relation->getStart()->getId()][$relation->_getValue()] = true;
     $dbrel = $this->relRepo->findOneBy(array('startNode' => $relation->getStart(), 'value' => $relation->_getValue()));
     if ($dbrel !== null) {
         return false;
     }
     return true;
 }