/** * @param TreeNodeInterface $node * @param $userGroup */ private function saveUserGroupDataToCollection(TreeNodeInterface $node, $userGroup) { $this->objectCollection->add('content_items', $node->getName(), $userGroup->id); // Add location to the location list if (isset($userGroup->contentInfo)) { $this->objectCollection->add('locations', $node->getName(), $userGroup->contentInfo->mainLocationId); } }
/** * @inheritdoc */ public function visit(TreeNodeInterface $node, &$data) { if (!is_array($data)) { return null; } // create structure $contentStruct = $this->getContentCreateStruct($data); $locationStruct = $this->getLocationCreateStruct($data, self::DEFAULT_LOCATION_ID); // publish content object $draft = $this->contentService->createContent($contentStruct, array($locationStruct)); $publishedContent = $this->contentService->publishVersion($draft->versionInfo); // Add location to the location list if (isset($publishedContent->contentInfo)) { $this->objectCollection->add('locations', $node->getName(), $publishedContent->contentInfo->mainLocationId); } // Add content to content list if (isset($publishedContent->contentInfo)) { $this->objectCollection->add('content_items', $node->getName(), $publishedContent->id); } return $publishedContent; }
/** * @inheritdoc */ public function addChild(TreeNodeInterface $child) { $this->items[$child->getName()] = $child; }