Nextras\Orm\Relationships\HasMany::remove PHP Метод

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

public remove ( $entity )
    public function remove($entity)
    {
        if ($this->updatingReverseRelationship) {
            return null;
        }
        $entity = $this->createEntity($entity);
        $entityHash = spl_object_hash($entity);
        if (isset($this->toAdd[$entityHash])) {
            unset($this->toAdd[$entityHash]);
        } else {
            $this->toRemove[$entityHash] = $entity;
            unset($this->added[$entityHash]);
        }
        $this->updateRelationshipRemove($entity);
        $this->modify();
        $this->wasLoaded = $this->wasLoaded || $this->collection !== null;
        $this->collection = null;
        return $entity;
    }