/** * Get an array containing an array of foreign entities to remove the local entity from, and an array of foreign * entities to add the local entity to and an array of entities which remain the same in the relationship * * @param string $key Local relationship key * @param Relationship $relationship Relationship in question * @param object|object[] $new_value New local value containing foreign entities * @return array */ private function getRelationshipDeltas($key, Relationship $relationship, $new_value) { $this->getDriver()->debugLog('Getting inverse relationship deltas: ' . $key); if (RelationshipType::isMultiIndex($relationship->getRelationshipType())) { return $this->getRelationshipDeltasMulti($key, $new_value); } else { return $this->getRelationshipDeltasSingle($key, $new_value); } }
/** * Get the key for a foreign relationship * * @param Relationship $relationship Relationship * @param string $id Source entity ID * @return string */ public function getRelationshipKey(Relationship $relationship, $id) { // otm:user-address:89726:home_address return (string) $relationship->getRelationshipType()->value() . $this->delimiter . $relationship->getSourceTable() . '-' . $relationship->getTargetTable() . $this->delimiter . $id . $this->delimiter . $relationship->getName(); }