コード例 #1
0
ファイル: Scope.php プロジェクト: eliberty/api-bundle
 /**
  * @throws \Exception
  */
 protected function getApiVersion()
 {
     $version = 'v2';
     if ($this->parent instanceof Scope && $this->parent->getDunglasResource() instanceof DunglasResource) {
         $version = $this->parent->getDunglasResource()->getVersion();
     }
     return $version;
 }
コード例 #2
0
ファイル: Manager.php プロジェクト: eliberty/api-bundle
 /**
  * Create Data.
  *
  * Main method to kick this all off. Make a resource then pass it over, and use toArray()
  *
  * @param ResourceInterface $resource
  * @param string            $scopeIdentifier
  * @param Scope             $parentScopeInstance
  *
  * @return Scope
  */
 public function createData(ResourceInterface $resource, $scopeIdentifier = null, Scope $parentScopeInstance = null)
 {
     $scopeInstance = new ApiScope($this, $resource, $scopeIdentifier);
     // Update scope history
     if ($parentScopeInstance !== null) {
         // This will be the new children list of parents (parents parents, plus the parent)
         $scopeArray = $parentScopeInstance->getParentScopes();
         $scopeArray[] = $parentScopeInstance->getScopeIdentifier();
         $scopeInstance->setParentScopes($scopeArray);
         $scopeInstance->setParent($parentScopeInstance);
     }
     return $scopeInstance;
 }