/** * Creates a new location rooted at $location->parentId. * * @param \eZ\Publish\SPI\Persistence\Content\Location\CreateStruct $createStruct * * @return \eZ\Publish\SPI\Persistence\Content\Location */ public function create(CreateStruct $createStruct) { $parentNodeData = $this->locationGateway->getBasicNodeData($createStruct->parentId); $locationStruct = $this->locationGateway->create($createStruct, $parentNodeData); $this->locationGateway->createNodeAssignment($createStruct, $parentNodeData['node_id'], LocationGateway::NODE_ASSIGNMENT_OP_CODE_CREATE_NOP); return $locationStruct; }
/** * Creates a new location in given $parentNode * * @param \eZ\Publish\SPI\Persistence\Content\Location\CreateStruct $createStruct * @param array $parentNode * * @return \eZ\Publish\SPI\Persistence\Content\Location */ public function create(CreateStruct $createStruct, array $parentNode) { try { return $this->innerGateway->create($createStruct, $parentNode); } catch (DBALException $e) { throw new RuntimeException('Database error', 0, $e); } catch (PDOException $e) { throw new RuntimeException('Database error', 0, $e); } }