Bolt\Storage\Field\Type\RepeaterType::normalize PHP Метод

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

Normalize step ensures that we have correctly hydrated objects at the collection and entity level.
public normalize ( $entity )
$entity
    public function normalize($entity)
    {
        $key = $this->mapping['fieldname'];
        $accessor = 'get' . ucfirst($key);
        $outerCollection = $entity->{$accessor}();
        if (!$outerCollection instanceof RepeatingFieldCollection) {
            $collection = new RepeatingFieldCollection($this->em, $this->mapping);
            $collection->setName($key);
            if (is_array($outerCollection)) {
                foreach ($outerCollection as $group => $fields) {
                    if (is_array($fields)) {
                        $collection->addFromArray($fields, $group, $entity);
                    }
                }
            }
            $setter = 'set' . ucfirst($key);
            $entity->{$setter}($collection);
        }
    }