Bolt\Storage\Collection\Relations::getOriginal PHP Метод

getOriginal() публичный Метод

This loops over the existing collection to see if the properties in the incoming are already available on a saved record. To do this it checks the four key properties if there's a match it returns the original, otherwise it returns the new and adds the new one to the collection.
public getOriginal ( Bolt\Storage\Entity\Relations $entity ) : mixed | null
$entity Bolt\Storage\Entity\Relations
Результат mixed | null
    public function getOriginal(Entity\Relations $entity)
    {
        foreach ($this as $k => $existing) {
            if ($existing->getFromId() == $entity->getFromId() && $existing->getFromContenttype() === $entity->getFromContenttype() && $existing->getToContenttype() === $entity->getToContenttype() && $existing->getToId() == $entity->getToId()) {
                return $existing;
            }
        }
        return $entity;
    }