public function __construct(NodeSchema $node_schema, $id = null, Neo4j\Node $client_node = null) { parent::__construct($node_schema, $id, $client_node); // Check that the node given by the ID matches the schema. if ($client_node and !$node_schema->envelopes($client_node)) { throw new Exceptions\SchemaException('Node does not match schema "' . $node_schema->getName() . '".'); } }
public function __construct(EdgeSchema $edge_schema, $id = null, Neo4j\Relationship $client_edge = null) { parent::__construct($edge_schema, $id, $client_edge); if ($client_edge and !$edge_schema->envelopes($client_edge)) { throw new Exceptions\SchemaException('Edge ' . $client_edge->getId() . ' does not match schema "' . $edge_schema->getName() . '".'); } if ($client_edge) { $this->setStartAndEndNodes(); } }