/** * 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 Scope($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); } return $scopeInstance; }