Nextras\Orm\Relationships\OneHasMany::getEntitiesForPersistence PHP Метод

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

    public function getEntitiesForPersistence()
    {
        if ($this->collection !== null || $this->wasLoaded) {
            return iterator_to_array($this->getIterator());
        } else {
            $entities = $this->added + $this->toAdd;
            foreach ($this->toRemove as $hash => $remove) {
                if ($remove->isPersisted()) {
                    $entities[$hash] = $remove;
                } else {
                    unset($entities[$hash]);
                }
            }
            return $entities;
        }
    }