Bolt\Storage\Field\Collection\RepeatingFieldCollection::getOriginal PHP Method

getOriginal() public method

This loops over the existing collection to see if the properties in the incoming are already available on a saved record.
public getOriginal ( object $entity ) : mixed | null
$entity object
return mixed | null
    public function getOriginal($entity)
    {
        $entities = $this->flatten();
        foreach ($entities as $existing) {
            if ($existing->getName() == $entity->getName() && $existing->getGrouping() == $entity->getGrouping() && $existing->getFieldname() == $entity->getFieldname()) {
                return $existing;
            }
        }
        return $entity;
    }