Puli\Repository\Resource\GenericResource::attachTo PHP Method

attachTo() public method

public attachTo ( Puli\Repository\Api\ResourceRepository $repo, $path = null )
$repo Puli\Repository\Api\ResourceRepository
    public function attachTo(ResourceRepository $repo, $path = null)
    {
        $this->repo = $repo;
        if (null !== $path) {
            $this->path = $path;
            $this->repoPath = $path;
        }
    }

Usage Example

Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function clear()
 {
     $root = new GenericResource('/');
     $root->attachTo($this);
     // Subtract root
     $removed = count($this->resources) - 1;
     $this->resources = array('/' => $root);
     $this->clearVersions();
     $this->storeVersion($root);
     return $removed;
 }