Bravo3\Orm\Services\RelationshipManager::getRelationshipDeltasMulti PHP Method

getRelationshipDeltasMulti() private method

Get the deltas for a to-many relationship
private getRelationshipDeltasMulti ( string $key, object | object[] $new_value ) : array
$key string Local relationship key
$new_value object | object[] New local value containing foreign entities
return array
    private function getRelationshipDeltasMulti($key, $new_value)
    {
        $old_ids = $this->getDriver()->getMultiValueIndex($key);
        $new_ids = [];
        if ($new_value) {
            foreach ($new_value as $item) {
                $new_ids[] = $this->getEntityId($item);
            }
        }
        return [array_diff($old_ids, $new_ids), array_diff($new_ids, $old_ids), array_intersect($old_ids, $new_ids)];
    }