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()]; } }
public function addRelation(Relation $relation) { if ($relation->getProperty()->getDataType() == 'node') { if (!$this->validateNodeRelation($relation)) { return; } } else { if ($relation->getProperty()->getDataType() == 'geometry') { if (!$this->validateGeometryRelation($relation)) { return; } } else { if (!$this->validateRelation($relation)) { return; } } } $this->em->persist($relation); }