Пример #1
0
 /**
  * @param $type
  *
  * @return BaseResource
  */
 public function create($type = null)
 {
     $className = null;
     if ($type) {
         $className = TypeMapper::get($type);
     }
     if (!$className) {
         $className = TypeMapper::getDefaultResourceClass();
     }
     /** @var BaseResource $resource */
     $resource = new $className($this->nextBNode(), new Graph());
     $resource->addType($type);
     $resource->setRm($this->_rm);
     //storing resource in temp resources array
     $this->tempResources[$resource->getUri()] = $resource;
     $this->evd->dispatch(Events::PostCreate, new ResourceLifeCycleEvent(array('resources' => array($resource))));
     return $resource;
 }
Пример #2
0
 /**
  * @return string
  */
 public function getDefaultResourceClass()
 {
     return TypeMapper::getDefaultResourceClass();
 }