Nextras\Orm\Mapper\BaseMapper::setRepository PHP Method

setRepository() public method

public setRepository ( Nextras\Orm\Repository\IRepository $repository )
$repository Nextras\Orm\Repository\IRepository
    public function setRepository(IRepository $repository)
    {
        if ($this->repository && $this->repository !== $repository) {
            $name = get_class($this);
            throw new InvalidStateException("Mapper '{$name}' is already attached to repository.");
        }
        $this->repository = $repository;
        $this->collectionCache = (object) null;
    }