repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
zoonman/linkedin-api-php-client
src/Client.php
Client.getState
public function getState() { if (empty($this->state)) { $this->setState( rtrim( base64_encode(uniqid('', true)), '=' ) ); } return $this->state; }
php
public function getState() { if (empty($this->state)) { $this->setState( rtrim( base64_encode(uniqid('', true)), '=' ) ); } return $this->state; }
[ "public", "function", "getState", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "state", ")", ")", "{", "$", "this", "->", "setState", "(", "rtrim", "(", "base64_encode", "(", "uniqid", "(", "''", ",", "true", ")", ")", ",", "'='", "...
Get unique state or specified state @return string
[ "Get", "unique", "state", "or", "specified", "state" ]
2837dd3a2935fffef734b7f5129e8b7758f2726c
https://github.com/zoonman/linkedin-api-php-client/blob/2837dd3a2935fffef734b7f5129e8b7758f2726c/src/Client.php#L368-L379
train
zoonman/linkedin-api-php-client
src/Client.php
Client.getLoginUrl
public function getLoginUrl( array $scope = [Scope::READ_BASIC_PROFILE, Scope::READ_EMAIL_ADDRESS] ) { $params = [ 'response_type' => self::OAUTH2_RESPONSE_TYPE, 'client_id' => $this->getClientId(), 'redirect_uri' => $this->getRedirectUrl(), 'state' => $this->getState(), 'scope' => implode(' ', $scope), ]; $uri = $this->buildUrl('authorization', $params); return $uri; }
php
public function getLoginUrl( array $scope = [Scope::READ_BASIC_PROFILE, Scope::READ_EMAIL_ADDRESS] ) { $params = [ 'response_type' => self::OAUTH2_RESPONSE_TYPE, 'client_id' => $this->getClientId(), 'redirect_uri' => $this->getRedirectUrl(), 'state' => $this->getState(), 'scope' => implode(' ', $scope), ]; $uri = $this->buildUrl('authorization', $params); return $uri; }
[ "public", "function", "getLoginUrl", "(", "array", "$", "scope", "=", "[", "Scope", "::", "READ_BASIC_PROFILE", ",", "Scope", "::", "READ_EMAIL_ADDRESS", "]", ")", "{", "$", "params", "=", "[", "'response_type'", "=>", "self", "::", "OAUTH2_RESPONSE_TYPE", ","...
Retrieve URL which will be used to send User to LinkedIn for authentication @param array $scope Permissions that your application requires @return string
[ "Retrieve", "URL", "which", "will", "be", "used", "to", "send", "User", "to", "LinkedIn", "for", "authentication" ]
2837dd3a2935fffef734b7f5129e8b7758f2726c
https://github.com/zoonman/linkedin-api-php-client/blob/2837dd3a2935fffef734b7f5129e8b7758f2726c/src/Client.php#L402-L414
train
zoonman/linkedin-api-php-client
src/Client.php
Client.api
public function api($endpoint, array $params = [], $method = Method::GET) { $headers = $this->getApiHeaders(); $options = $this->prepareOptions($params, $method); Method::isMethodSupported($method); if ($this->isUsingTokenParam()) { $params['oauth2_access_token'] = $this->accessToken->getToken(); } else { $headers['Authorization'] = 'Bearer ' . $this->accessToken->getToken(); } $guzzle = new GuzzleClient([ 'base_uri' => $this->getApiRoot(), 'headers' => $headers, ]); if (!empty($params) && Method::GET === $method) { $endpoint .= '?' . build_query($params); } try { $response = $guzzle->request($method, $endpoint, $options); } catch (RequestException $requestException) { throw Exception::fromRequestException($requestException); } return self::responseToArray($response); }
php
public function api($endpoint, array $params = [], $method = Method::GET) { $headers = $this->getApiHeaders(); $options = $this->prepareOptions($params, $method); Method::isMethodSupported($method); if ($this->isUsingTokenParam()) { $params['oauth2_access_token'] = $this->accessToken->getToken(); } else { $headers['Authorization'] = 'Bearer ' . $this->accessToken->getToken(); } $guzzle = new GuzzleClient([ 'base_uri' => $this->getApiRoot(), 'headers' => $headers, ]); if (!empty($params) && Method::GET === $method) { $endpoint .= '?' . build_query($params); } try { $response = $guzzle->request($method, $endpoint, $options); } catch (RequestException $requestException) { throw Exception::fromRequestException($requestException); } return self::responseToArray($response); }
[ "public", "function", "api", "(", "$", "endpoint", ",", "array", "$", "params", "=", "[", "]", ",", "$", "method", "=", "Method", "::", "GET", ")", "{", "$", "headers", "=", "$", "this", "->", "getApiHeaders", "(", ")", ";", "$", "options", "=", ...
Perform API call to LinkedIn @param string $endpoint @param array $params @param string $method @return array @throws \LinkedIn\Exception
[ "Perform", "API", "call", "to", "LinkedIn" ]
2837dd3a2935fffef734b7f5129e8b7758f2726c
https://github.com/zoonman/linkedin-api-php-client/blob/2837dd3a2935fffef734b7f5129e8b7758f2726c/src/Client.php#L482-L505
train
Kevinrob/guzzle-cache-middleware
src/Strategy/PrivateCacheStrategy.php
PrivateCacheStrategy.getCacheKey
protected function getCacheKey(RequestInterface $request, KeyValueHttpHeader $varyHeaders = null) { if (!$varyHeaders) { return hash('sha256', $request->getMethod().$request->getUri()); } $cacheHeaders = []; foreach ($varyHeaders as $key => $value) { if ($request->hasHeader($key)) { $cacheHeaders[$key] = $request->getHeader($key); } } return hash('sha256', $request->getMethod().$request->getUri().json_encode($cacheHeaders)); }
php
protected function getCacheKey(RequestInterface $request, KeyValueHttpHeader $varyHeaders = null) { if (!$varyHeaders) { return hash('sha256', $request->getMethod().$request->getUri()); } $cacheHeaders = []; foreach ($varyHeaders as $key => $value) { if ($request->hasHeader($key)) { $cacheHeaders[$key] = $request->getHeader($key); } } return hash('sha256', $request->getMethod().$request->getUri().json_encode($cacheHeaders)); }
[ "protected", "function", "getCacheKey", "(", "RequestInterface", "$", "request", ",", "KeyValueHttpHeader", "$", "varyHeaders", "=", "null", ")", "{", "if", "(", "!", "$", "varyHeaders", ")", "{", "return", "hash", "(", "'sha256'", ",", "$", "request", "->",...
Generate a key for the response cache. @param RequestInterface $request @param null|KeyValueHttpHeader $varyHeaders The vary headers which should be honoured by the cache (optional) @return string
[ "Generate", "a", "key", "for", "the", "response", "cache", "." ]
e1430d9f7e10f6b0998be6195541d4449079b6e9
https://github.com/Kevinrob/guzzle-cache-middleware/blob/e1430d9f7e10f6b0998be6195541d4449079b6e9/src/Strategy/PrivateCacheStrategy.php#L123-L138
train
Kevinrob/guzzle-cache-middleware
src/Strategy/PrivateCacheStrategy.php
PrivateCacheStrategy.fetch
public function fetch(RequestInterface $request) { /** @var int|null $maxAge */ $maxAge = null; if ($request->hasHeader('Cache-Control')) { $reqCacheControl = new KeyValueHttpHeader($request->getHeader('Cache-Control')); if ($reqCacheControl->has('no-cache')) { // Can't return cache return null; } $maxAge = $reqCacheControl->get('max-age', null); } elseif ($request->hasHeader('Pragma')) { $pragma = new KeyValueHttpHeader($request->getHeader('Pragma')); if ($pragma->has('no-cache')) { // Can't return cache return null; } } $cache = $this->storage->fetch($this->getCacheKey($request)); if ($cache !== null) { $varyHeaders = $cache->getVaryHeaders(); // vary headers exist from a previous response, check if we have a cache that matches those headers if (!$varyHeaders->isEmpty()) { $cache = $this->storage->fetch($this->getCacheKey($request, $varyHeaders)); if (!$cache) { return null; } } if ((string)$cache->getOriginalRequest()->getUri() !== (string)$request->getUri()) { return null; } if ($maxAge !== null) { if ($cache->getAge() > $maxAge) { // Cache entry is too old for the request requirements! return null; } } if (!$cache->isVaryEquals($request)) { return null; } } return $cache; }
php
public function fetch(RequestInterface $request) { /** @var int|null $maxAge */ $maxAge = null; if ($request->hasHeader('Cache-Control')) { $reqCacheControl = new KeyValueHttpHeader($request->getHeader('Cache-Control')); if ($reqCacheControl->has('no-cache')) { // Can't return cache return null; } $maxAge = $reqCacheControl->get('max-age', null); } elseif ($request->hasHeader('Pragma')) { $pragma = new KeyValueHttpHeader($request->getHeader('Pragma')); if ($pragma->has('no-cache')) { // Can't return cache return null; } } $cache = $this->storage->fetch($this->getCacheKey($request)); if ($cache !== null) { $varyHeaders = $cache->getVaryHeaders(); // vary headers exist from a previous response, check if we have a cache that matches those headers if (!$varyHeaders->isEmpty()) { $cache = $this->storage->fetch($this->getCacheKey($request, $varyHeaders)); if (!$cache) { return null; } } if ((string)$cache->getOriginalRequest()->getUri() !== (string)$request->getUri()) { return null; } if ($maxAge !== null) { if ($cache->getAge() > $maxAge) { // Cache entry is too old for the request requirements! return null; } } if (!$cache->isVaryEquals($request)) { return null; } } return $cache; }
[ "public", "function", "fetch", "(", "RequestInterface", "$", "request", ")", "{", "/** @var int|null $maxAge */", "$", "maxAge", "=", "null", ";", "if", "(", "$", "request", "->", "hasHeader", "(", "'Cache-Control'", ")", ")", "{", "$", "reqCacheControl", "=",...
Return a CacheEntry or null if no cache. @param RequestInterface $request @return CacheEntry|null
[ "Return", "a", "CacheEntry", "or", "null", "if", "no", "cache", "." ]
e1430d9f7e10f6b0998be6195541d4449079b6e9
https://github.com/Kevinrob/guzzle-cache-middleware/blob/e1430d9f7e10f6b0998be6195541d4449079b6e9/src/Strategy/PrivateCacheStrategy.php#L147-L198
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/SitesController.php
SitesController.editAction
public function editAction(Site $site) { try { $sitePackage = $this->packageManager->getPackage($site->getSiteResourcesPackageKey()); } catch (\Exception $e) { $this->addFlashMessage('The site package with key "%s" was not found.', 'Site package not found', Message::SEVERITY_ERROR, [htmlspecialchars($site->getSiteResourcesPackageKey())]); } $this->view->assignMultiple([ 'site' => $site, 'sitePackage' => isset($sitePackage) ? $sitePackage : [], 'domains' => $this->domainRepository->findBySite($site), 'assetCollections' => $this->assetCollectionRepository->findAll() ]); }
php
public function editAction(Site $site) { try { $sitePackage = $this->packageManager->getPackage($site->getSiteResourcesPackageKey()); } catch (\Exception $e) { $this->addFlashMessage('The site package with key "%s" was not found.', 'Site package not found', Message::SEVERITY_ERROR, [htmlspecialchars($site->getSiteResourcesPackageKey())]); } $this->view->assignMultiple([ 'site' => $site, 'sitePackage' => isset($sitePackage) ? $sitePackage : [], 'domains' => $this->domainRepository->findBySite($site), 'assetCollections' => $this->assetCollectionRepository->findAll() ]); }
[ "public", "function", "editAction", "(", "Site", "$", "site", ")", "{", "try", "{", "$", "sitePackage", "=", "$", "this", "->", "packageManager", "->", "getPackage", "(", "$", "site", "->", "getSiteResourcesPackageKey", "(", ")", ")", ";", "}", "catch", ...
A edit view for a site and its settings. @param Site $site Site to view @Flow\IgnoreValidation("$site") @return void
[ "A", "edit", "view", "for", "a", "site", "and", "its", "settings", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/SitesController.php#L162-L176
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/SitesController.php
SitesController.updateSiteAction
public function updateSiteAction(Site $site, $newSiteNodeName) { if ($site->getNodeName() !== $newSiteNodeName) { $oldSiteNodePath = NodePaths::addNodePathSegment(SiteService::SITES_ROOT_PATH, $site->getNodeName()); $newSiteNodePath = NodePaths::addNodePathSegment(SiteService::SITES_ROOT_PATH, $newSiteNodeName); /** @var $workspace Workspace */ foreach ($this->workspaceRepository->findAll() as $workspace) { $siteNode = $this->nodeDataRepository->findOneByPath($oldSiteNodePath, $workspace); if ($siteNode !== null) { $siteNode->setPath($newSiteNodePath); } } $site->setNodeName($newSiteNodeName); $this->nodeDataRepository->persistEntities(); } $this->siteRepository->update($site); $this->addFlashMessage('The site "%s" has been updated.', 'Update', null, [htmlspecialchars($site->getName())], 1412371798); $this->unsetLastVisitedNodeAndRedirect('index'); }
php
public function updateSiteAction(Site $site, $newSiteNodeName) { if ($site->getNodeName() !== $newSiteNodeName) { $oldSiteNodePath = NodePaths::addNodePathSegment(SiteService::SITES_ROOT_PATH, $site->getNodeName()); $newSiteNodePath = NodePaths::addNodePathSegment(SiteService::SITES_ROOT_PATH, $newSiteNodeName); /** @var $workspace Workspace */ foreach ($this->workspaceRepository->findAll() as $workspace) { $siteNode = $this->nodeDataRepository->findOneByPath($oldSiteNodePath, $workspace); if ($siteNode !== null) { $siteNode->setPath($newSiteNodePath); } } $site->setNodeName($newSiteNodeName); $this->nodeDataRepository->persistEntities(); } $this->siteRepository->update($site); $this->addFlashMessage('The site "%s" has been updated.', 'Update', null, [htmlspecialchars($site->getName())], 1412371798); $this->unsetLastVisitedNodeAndRedirect('index'); }
[ "public", "function", "updateSiteAction", "(", "Site", "$", "site", ",", "$", "newSiteNodeName", ")", "{", "if", "(", "$", "site", "->", "getNodeName", "(", ")", "!==", "$", "newSiteNodeName", ")", "{", "$", "oldSiteNodePath", "=", "NodePaths", "::", "addN...
Update a site @param Site $site A site to update @param string $newSiteNodeName A new site node name @return void @Flow\Validate(argumentName="$site", type="UniqueEntity") @Flow\Validate(argumentName="$newSiteNodeName", type="NotEmpty") @Flow\Validate(argumentName="$newSiteNodeName", type="StringLength", options={ "minimum"=1, "maximum"=250 }) @Flow\Validate(argumentName="$newSiteNodeName", type="Neos.Neos:NodeName")
[ "Update", "a", "site" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/SitesController.php#L189-L207
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/SitesController.php
SitesController.newSiteAction
public function newSiteAction(Site $site = null) { $sitePackages = $this->packageManager->getFilteredPackages('available', null, 'neos-site'); $documentNodeTypes = $this->nodeTypeManager->getSubNodeTypes('Neos.Neos:Document', false); $this->view->assignMultiple([ 'sitePackages' => $sitePackages, 'documentNodeTypes' => $documentNodeTypes, 'site' => $site, 'generatorServiceIsAvailable' => $this->packageManager->isPackageAvailable('Neos.SiteKickstarter') ]); }
php
public function newSiteAction(Site $site = null) { $sitePackages = $this->packageManager->getFilteredPackages('available', null, 'neos-site'); $documentNodeTypes = $this->nodeTypeManager->getSubNodeTypes('Neos.Neos:Document', false); $this->view->assignMultiple([ 'sitePackages' => $sitePackages, 'documentNodeTypes' => $documentNodeTypes, 'site' => $site, 'generatorServiceIsAvailable' => $this->packageManager->isPackageAvailable('Neos.SiteKickstarter') ]); }
[ "public", "function", "newSiteAction", "(", "Site", "$", "site", "=", "null", ")", "{", "$", "sitePackages", "=", "$", "this", "->", "packageManager", "->", "getFilteredPackages", "(", "'available'", ",", "null", ",", "'neos-site'", ")", ";", "$", "documentN...
Create a new site form. @param Site $site Site to create @Flow\IgnoreValidation("$site") @return void
[ "Create", "a", "new", "site", "form", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/SitesController.php#L216-L226
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/SitesController.php
SitesController.createSitePackageAction
public function createSitePackageAction($packageKey, $siteName) { if ($this->packageManager->isPackageAvailable('Neos.SiteKickstarter') === false) { $this->addFlashMessage('The package "%s" is required to create new site packages.', 'Missing Package', Message::SEVERITY_ERROR, ['Neos.SiteKickstarter'], 1475736232); $this->redirect('index'); } if ($this->packageManager->isPackageAvailable($packageKey)) { $this->addFlashMessage('The package key "%s" already exists.', 'Invalid package key', Message::SEVERITY_ERROR, [htmlspecialchars($packageKey)], 1412372021); $this->redirect('index'); } $generatorService = $this->objectManager->get(GeneratorService::class); $generatorService->generateSitePackage($packageKey, $siteName); $this->flashMessageContainer->addMessage(new Message(sprintf('Site Packages "%s" was created.', htmlspecialchars($packageKey)))); $this->forward('importSite', null, null, ['packageKey' => $packageKey]); }
php
public function createSitePackageAction($packageKey, $siteName) { if ($this->packageManager->isPackageAvailable('Neos.SiteKickstarter') === false) { $this->addFlashMessage('The package "%s" is required to create new site packages.', 'Missing Package', Message::SEVERITY_ERROR, ['Neos.SiteKickstarter'], 1475736232); $this->redirect('index'); } if ($this->packageManager->isPackageAvailable($packageKey)) { $this->addFlashMessage('The package key "%s" already exists.', 'Invalid package key', Message::SEVERITY_ERROR, [htmlspecialchars($packageKey)], 1412372021); $this->redirect('index'); } $generatorService = $this->objectManager->get(GeneratorService::class); $generatorService->generateSitePackage($packageKey, $siteName); $this->flashMessageContainer->addMessage(new Message(sprintf('Site Packages "%s" was created.', htmlspecialchars($packageKey)))); $this->forward('importSite', null, null, ['packageKey' => $packageKey]); }
[ "public", "function", "createSitePackageAction", "(", "$", "packageKey", ",", "$", "siteName", ")", "{", "if", "(", "$", "this", "->", "packageManager", "->", "isPackageAvailable", "(", "'Neos.SiteKickstarter'", ")", "===", "false", ")", "{", "$", "this", "->"...
Create a new site-package and directly import it. @param string $packageKey Package Name to create @param string $siteName Site Name to create @Flow\Validate(argumentName="$packageKey", type="\Neos\Neos\Validation\Validator\PackageKeyValidator") @return void
[ "Create", "a", "new", "site", "-", "package", "and", "directly", "import", "it", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/SitesController.php#L236-L253
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/SitesController.php
SitesController.importSiteAction
public function importSiteAction($packageKey) { try { $this->siteImportService->importFromPackage($packageKey); $this->addFlashMessage('The site has been imported.', '', null, [], 1412372266); } catch (\Exception $exception) { $logMessage = $this->throwableStorage->logThrowable($exception); $this->logger->error($logMessage, LogEnvironment::fromMethodName(__METHOD__)); $this->addFlashMessage('Error: During the import of the "Sites.xml" from the package "%s" an exception occurred: %s', 'Import error', Message::SEVERITY_ERROR, [htmlspecialchars($packageKey), htmlspecialchars($exception->getMessage())], 1412372375); } $this->unsetLastVisitedNodeAndRedirect('index'); }
php
public function importSiteAction($packageKey) { try { $this->siteImportService->importFromPackage($packageKey); $this->addFlashMessage('The site has been imported.', '', null, [], 1412372266); } catch (\Exception $exception) { $logMessage = $this->throwableStorage->logThrowable($exception); $this->logger->error($logMessage, LogEnvironment::fromMethodName(__METHOD__)); $this->addFlashMessage('Error: During the import of the "Sites.xml" from the package "%s" an exception occurred: %s', 'Import error', Message::SEVERITY_ERROR, [htmlspecialchars($packageKey), htmlspecialchars($exception->getMessage())], 1412372375); } $this->unsetLastVisitedNodeAndRedirect('index'); }
[ "public", "function", "importSiteAction", "(", "$", "packageKey", ")", "{", "try", "{", "$", "this", "->", "siteImportService", "->", "importFromPackage", "(", "$", "packageKey", ")", ";", "$", "this", "->", "addFlashMessage", "(", "'The site has been imported.'",...
Import a site from site package. @param string $packageKey Package from where the import will come @Flow\Validate(argumentName="$packageKey", type="\Neos\Neos\Validation\Validator\PackageKeyValidator") @return void
[ "Import", "a", "site", "from", "site", "package", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/SitesController.php#L262-L273
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/SitesController.php
SitesController.createSiteNodeAction
public function createSiteNodeAction($packageKey, $siteName, $nodeType) { $nodeName = $this->nodeService->generateUniqueNodeName(SiteService::SITES_ROOT_PATH, $siteName); if ($this->siteRepository->findOneByNodeName($nodeName)) { $this->addFlashMessage('Error: A site with siteNodeName "%s" already exists', 'Site creation error', Message::SEVERITY_ERROR, [$nodeName], 1412372375); $this->redirect('createSiteNode'); } $siteNodeType = $this->nodeTypeManager->getNodeType($nodeType); if ($siteNodeType === null || $siteNodeType->getName() === 'Neos.Neos:FallbackNode') { $this->addFlashMessage('Error: The given node type "%s" was not found', 'Site creation error', Message::SEVERITY_ERROR, [$nodeType], 1412372375); $this->redirect('createSiteNode'); } if ($siteNodeType->isOfType('Neos.Neos:Document') === false) { $this->addFlashMessage('Error: The given node type "%s" is not based on the superType "%s"', 'Site creation error', Message::SEVERITY_ERROR, [$nodeType, 'Neos.Neos:Document'], 1412372375); $this->redirect('createSiteNode'); } $rootNode = $this->nodeContextFactory->create()->getRootNode(); // We fetch the workspace to be sure it's known to the persistence manager and persist all // so the workspace and site node are persisted before we import any nodes to it. $rootNode->getContext()->getWorkspace(); $this->persistenceManager->persistAll(); $sitesNode = $rootNode->getNode(SiteService::SITES_ROOT_PATH); if ($sitesNode === null) { $sitesNode = $rootNode->createNode(NodePaths::getNodeNameFromPath(SiteService::SITES_ROOT_PATH)); } $siteNode = $sitesNode->createNode($nodeName, $siteNodeType); $siteNode->setProperty('title', $siteName); $site = new Site($nodeName); $site->setSiteResourcesPackageKey($packageKey); $site->setState(Site::STATE_ONLINE); $site->setName($siteName); $this->siteRepository->add($site); $this->addFlashMessage('Successfully created site "%s" with siteNode "%s", type "%s" and packageKey "%s"', '', null, [$siteName, $nodeName, $nodeType, $packageKey], 1412372266); $this->unsetLastVisitedNodeAndRedirect('index'); }
php
public function createSiteNodeAction($packageKey, $siteName, $nodeType) { $nodeName = $this->nodeService->generateUniqueNodeName(SiteService::SITES_ROOT_PATH, $siteName); if ($this->siteRepository->findOneByNodeName($nodeName)) { $this->addFlashMessage('Error: A site with siteNodeName "%s" already exists', 'Site creation error', Message::SEVERITY_ERROR, [$nodeName], 1412372375); $this->redirect('createSiteNode'); } $siteNodeType = $this->nodeTypeManager->getNodeType($nodeType); if ($siteNodeType === null || $siteNodeType->getName() === 'Neos.Neos:FallbackNode') { $this->addFlashMessage('Error: The given node type "%s" was not found', 'Site creation error', Message::SEVERITY_ERROR, [$nodeType], 1412372375); $this->redirect('createSiteNode'); } if ($siteNodeType->isOfType('Neos.Neos:Document') === false) { $this->addFlashMessage('Error: The given node type "%s" is not based on the superType "%s"', 'Site creation error', Message::SEVERITY_ERROR, [$nodeType, 'Neos.Neos:Document'], 1412372375); $this->redirect('createSiteNode'); } $rootNode = $this->nodeContextFactory->create()->getRootNode(); // We fetch the workspace to be sure it's known to the persistence manager and persist all // so the workspace and site node are persisted before we import any nodes to it. $rootNode->getContext()->getWorkspace(); $this->persistenceManager->persistAll(); $sitesNode = $rootNode->getNode(SiteService::SITES_ROOT_PATH); if ($sitesNode === null) { $sitesNode = $rootNode->createNode(NodePaths::getNodeNameFromPath(SiteService::SITES_ROOT_PATH)); } $siteNode = $sitesNode->createNode($nodeName, $siteNodeType); $siteNode->setProperty('title', $siteName); $site = new Site($nodeName); $site->setSiteResourcesPackageKey($packageKey); $site->setState(Site::STATE_ONLINE); $site->setName($siteName); $this->siteRepository->add($site); $this->addFlashMessage('Successfully created site "%s" with siteNode "%s", type "%s" and packageKey "%s"', '', null, [$siteName, $nodeName, $nodeType, $packageKey], 1412372266); $this->unsetLastVisitedNodeAndRedirect('index'); }
[ "public", "function", "createSiteNodeAction", "(", "$", "packageKey", ",", "$", "siteName", ",", "$", "nodeType", ")", "{", "$", "nodeName", "=", "$", "this", "->", "nodeService", "->", "generateUniqueNodeName", "(", "SiteService", "::", "SITES_ROOT_PATH", ",", ...
Create a new empty site. @param string $packageKey Package Name to create @param string $siteName Site Name to create @param string $nodeType NodeType name for the root node to create @Flow\Validate(argumentName="$packageKey", type="\Neos\Neos\Validation\Validator\PackageKeyValidator") @return void
[ "Create", "a", "new", "empty", "site", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/SitesController.php#L284-L325
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/SitesController.php
SitesController.deleteSiteAction
public function deleteSiteAction(Site $site) { $this->siteService->pruneSite($site); $this->addFlashMessage('The site "%s" has been deleted.', 'Site deleted', Message::SEVERITY_OK, [htmlspecialchars($site->getName())], 1412372689); $this->unsetLastVisitedNodeAndRedirect('index'); }
php
public function deleteSiteAction(Site $site) { $this->siteService->pruneSite($site); $this->addFlashMessage('The site "%s" has been deleted.', 'Site deleted', Message::SEVERITY_OK, [htmlspecialchars($site->getName())], 1412372689); $this->unsetLastVisitedNodeAndRedirect('index'); }
[ "public", "function", "deleteSiteAction", "(", "Site", "$", "site", ")", "{", "$", "this", "->", "siteService", "->", "pruneSite", "(", "$", "site", ")", ";", "$", "this", "->", "addFlashMessage", "(", "'The site \"%s\" has been deleted.'", ",", "'Site deleted'"...
Delete a site. @param Site $site Site to delete @Flow\IgnoreValidation("$site") @return void
[ "Delete", "a", "site", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/SitesController.php#L334-L339
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/SitesController.php
SitesController.activateSiteAction
public function activateSiteAction(Site $site) { $site->setState($site::STATE_ONLINE); $this->siteRepository->update($site); $this->addFlashMessage('The site "%s" has been activated.', 'Site activated', Message::SEVERITY_OK, [htmlspecialchars($site->getName())], 1412372881); $this->unsetLastVisitedNodeAndRedirect('index'); }
php
public function activateSiteAction(Site $site) { $site->setState($site::STATE_ONLINE); $this->siteRepository->update($site); $this->addFlashMessage('The site "%s" has been activated.', 'Site activated', Message::SEVERITY_OK, [htmlspecialchars($site->getName())], 1412372881); $this->unsetLastVisitedNodeAndRedirect('index'); }
[ "public", "function", "activateSiteAction", "(", "Site", "$", "site", ")", "{", "$", "site", "->", "setState", "(", "$", "site", "::", "STATE_ONLINE", ")", ";", "$", "this", "->", "siteRepository", "->", "update", "(", "$", "site", ")", ";", "$", "this...
Activates a site @param Site $site Site to activate @return void
[ "Activates", "a", "site" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/SitesController.php#L347-L353
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/SitesController.php
SitesController.deactivateSiteAction
public function deactivateSiteAction(Site $site) { $site->setState($site::STATE_OFFLINE); $this->siteRepository->update($site); $this->addFlashMessage('The site "%s" has been deactivated.', 'Site deactivated', Message::SEVERITY_OK, [htmlspecialchars($site->getName())], 1412372975); $this->unsetLastVisitedNodeAndRedirect('index'); }
php
public function deactivateSiteAction(Site $site) { $site->setState($site::STATE_OFFLINE); $this->siteRepository->update($site); $this->addFlashMessage('The site "%s" has been deactivated.', 'Site deactivated', Message::SEVERITY_OK, [htmlspecialchars($site->getName())], 1412372975); $this->unsetLastVisitedNodeAndRedirect('index'); }
[ "public", "function", "deactivateSiteAction", "(", "Site", "$", "site", ")", "{", "$", "site", "->", "setState", "(", "$", "site", "::", "STATE_OFFLINE", ")", ";", "$", "this", "->", "siteRepository", "->", "update", "(", "$", "site", ")", ";", "$", "t...
Deactivates a site @param Site $site Site to deactivate @return void
[ "Deactivates", "a", "site" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/SitesController.php#L361-L367
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/SitesController.php
SitesController.updateDomainAction
public function updateDomainAction(Domain $domain) { $this->domainRepository->update($domain); $this->addFlashMessage('The domain "%s" has been updated.', 'Domain updated', Message::SEVERITY_OK, [htmlspecialchars($domain)], 1412373069); $this->unsetLastVisitedNodeAndRedirect('edit', null, null, ['site' => $domain->getSite()]); }
php
public function updateDomainAction(Domain $domain) { $this->domainRepository->update($domain); $this->addFlashMessage('The domain "%s" has been updated.', 'Domain updated', Message::SEVERITY_OK, [htmlspecialchars($domain)], 1412373069); $this->unsetLastVisitedNodeAndRedirect('edit', null, null, ['site' => $domain->getSite()]); }
[ "public", "function", "updateDomainAction", "(", "Domain", "$", "domain", ")", "{", "$", "this", "->", "domainRepository", "->", "update", "(", "$", "domain", ")", ";", "$", "this", "->", "addFlashMessage", "(", "'The domain \"%s\" has been updated.'", ",", "'Do...
Update a domain @param Domain $domain Domain to update @Flow\Validate(argumentName="$domain", type="UniqueEntity") @return void
[ "Update", "a", "domain" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/SitesController.php#L388-L393
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/SitesController.php
SitesController.newDomainAction
public function newDomainAction(Domain $domain = null, Site $site = null) { $this->view->assignMultiple([ 'domain' => $domain, 'site' => $site, 'schemes' => [null => '', 'http' => 'HTTP', 'https' => 'HTTPS'] ]); }
php
public function newDomainAction(Domain $domain = null, Site $site = null) { $this->view->assignMultiple([ 'domain' => $domain, 'site' => $site, 'schemes' => [null => '', 'http' => 'HTTP', 'https' => 'HTTPS'] ]); }
[ "public", "function", "newDomainAction", "(", "Domain", "$", "domain", "=", "null", ",", "Site", "$", "site", "=", "null", ")", "{", "$", "this", "->", "view", "->", "assignMultiple", "(", "[", "'domain'", "=>", "$", "domain", ",", "'site'", "=>", "$",...
The create a new domain action. @param Domain $domain @param Site $site @Flow\IgnoreValidation("$domain") @return void
[ "The", "create", "a", "new", "domain", "action", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/SitesController.php#L403-L410
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/SitesController.php
SitesController.createDomainAction
public function createDomainAction(Domain $domain) { $this->domainRepository->add($domain); $this->addFlashMessage('The domain "%s" has been created.', 'Domain created', Message::SEVERITY_OK, [htmlspecialchars($domain)], 1412373192); $this->unsetLastVisitedNodeAndRedirect('edit', null, null, ['site' => $domain->getSite()]); }
php
public function createDomainAction(Domain $domain) { $this->domainRepository->add($domain); $this->addFlashMessage('The domain "%s" has been created.', 'Domain created', Message::SEVERITY_OK, [htmlspecialchars($domain)], 1412373192); $this->unsetLastVisitedNodeAndRedirect('edit', null, null, ['site' => $domain->getSite()]); }
[ "public", "function", "createDomainAction", "(", "Domain", "$", "domain", ")", "{", "$", "this", "->", "domainRepository", "->", "add", "(", "$", "domain", ")", ";", "$", "this", "->", "addFlashMessage", "(", "'The domain \"%s\" has been created.'", ",", "'Domai...
Create a domain @param Domain $domain Domain to create @Flow\Validate(argumentName="$domain", type="UniqueEntity") @return void
[ "Create", "a", "domain" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/SitesController.php#L419-L424
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/SitesController.php
SitesController.deleteDomainAction
public function deleteDomainAction(Domain $domain) { $site = $domain->getSite(); if ($site->getPrimaryDomain() === $domain) { $site->setPrimaryDomain(null); $this->siteRepository->update($site); } $this->domainRepository->remove($domain); $this->addFlashMessage('The domain "%s" has been deleted.', 'Domain deleted', Message::SEVERITY_OK, [htmlspecialchars($domain)], 1412373310); $this->unsetLastVisitedNodeAndRedirect('edit', null, null, ['site' => $site]); }
php
public function deleteDomainAction(Domain $domain) { $site = $domain->getSite(); if ($site->getPrimaryDomain() === $domain) { $site->setPrimaryDomain(null); $this->siteRepository->update($site); } $this->domainRepository->remove($domain); $this->addFlashMessage('The domain "%s" has been deleted.', 'Domain deleted', Message::SEVERITY_OK, [htmlspecialchars($domain)], 1412373310); $this->unsetLastVisitedNodeAndRedirect('edit', null, null, ['site' => $site]); }
[ "public", "function", "deleteDomainAction", "(", "Domain", "$", "domain", ")", "{", "$", "site", "=", "$", "domain", "->", "getSite", "(", ")", ";", "if", "(", "$", "site", "->", "getPrimaryDomain", "(", ")", "===", "$", "domain", ")", "{", "$", "sit...
Deletes a domain attached to a site @param Domain $domain A domain to delete @Flow\IgnoreValidation("$domain") @return void
[ "Deletes", "a", "domain", "attached", "to", "a", "site" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/SitesController.php#L433-L443
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/SitesController.php
SitesController.activateDomainAction
public function activateDomainAction(Domain $domain) { $domain->setActive(true); $this->domainRepository->update($domain); $this->addFlashMessage('The domain "%s" has been activated.', 'Domain activated', Message::SEVERITY_OK, [htmlspecialchars($domain)], 1412373539); $this->unsetLastVisitedNodeAndRedirect('edit', null, null, ['site' => $domain->getSite()]); }
php
public function activateDomainAction(Domain $domain) { $domain->setActive(true); $this->domainRepository->update($domain); $this->addFlashMessage('The domain "%s" has been activated.', 'Domain activated', Message::SEVERITY_OK, [htmlspecialchars($domain)], 1412373539); $this->unsetLastVisitedNodeAndRedirect('edit', null, null, ['site' => $domain->getSite()]); }
[ "public", "function", "activateDomainAction", "(", "Domain", "$", "domain", ")", "{", "$", "domain", "->", "setActive", "(", "true", ")", ";", "$", "this", "->", "domainRepository", "->", "update", "(", "$", "domain", ")", ";", "$", "this", "->", "addFla...
Activates a domain @param Domain $domain Domain to activate @Flow\IgnoreValidation("$domain") @return void
[ "Activates", "a", "domain" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/SitesController.php#L452-L458
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/SitesController.php
SitesController.deactivateDomainAction
public function deactivateDomainAction(Domain $domain) { $domain->setActive(false); $this->domainRepository->update($domain); $this->addFlashMessage('The domain "%s" has been deactivated.', 'Domain deactivated', Message::SEVERITY_OK, [htmlspecialchars($domain)], 1412373425); $this->unsetLastVisitedNodeAndRedirect('edit', null, null, ['site' => $domain->getSite()]); }
php
public function deactivateDomainAction(Domain $domain) { $domain->setActive(false); $this->domainRepository->update($domain); $this->addFlashMessage('The domain "%s" has been deactivated.', 'Domain deactivated', Message::SEVERITY_OK, [htmlspecialchars($domain)], 1412373425); $this->unsetLastVisitedNodeAndRedirect('edit', null, null, ['site' => $domain->getSite()]); }
[ "public", "function", "deactivateDomainAction", "(", "Domain", "$", "domain", ")", "{", "$", "domain", "->", "setActive", "(", "false", ")", ";", "$", "this", "->", "domainRepository", "->", "update", "(", "$", "domain", ")", ";", "$", "this", "->", "add...
Deactivates a domain @param Domain $domain Domain to deactivate @Flow\IgnoreValidation("$domain") @return void
[ "Deactivates", "a", "domain" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/SitesController.php#L467-L473
train
neos/neos-development-collection
Neos.Neos/Classes/Fusion/Helper/ArrayHelper.php
ArrayHelper.filterInternal
protected function filterInternal($set, $filterProperty, $negate) { if (is_object($set) && $set instanceof Collection) { $set = $set->toArray(); } return array_filter($set, function ($element) use ($filterProperty, $negate) { $result = (boolean)ObjectAccess::getPropertyPath($element, $filterProperty); if ($negate) { $result = !$result; } return $result; }); }
php
protected function filterInternal($set, $filterProperty, $negate) { if (is_object($set) && $set instanceof Collection) { $set = $set->toArray(); } return array_filter($set, function ($element) use ($filterProperty, $negate) { $result = (boolean)ObjectAccess::getPropertyPath($element, $filterProperty); if ($negate) { $result = !$result; } return $result; }); }
[ "protected", "function", "filterInternal", "(", "$", "set", ",", "$", "filterProperty", ",", "$", "negate", ")", "{", "if", "(", "is_object", "(", "$", "set", ")", "&&", "$", "set", "instanceof", "Collection", ")", "{", "$", "set", "=", "$", "set", "...
Internal method for filtering @param array|Collection $set @param string $filterProperty @param boolean $negate @return array
[ "Internal", "method", "for", "filtering" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/Helper/ArrayHelper.php#L60-L74
train
neos/neos-development-collection
Neos.Media/Classes/TypeConverter/AssetInterfaceConverter.php
AssetInterfaceConverter.getTypeOfChildProperty
public function getTypeOfChildProperty($targetType, $propertyName, PropertyMappingConfigurationInterface $configuration) { switch ($propertyName) { case 'resource': return PersistentResource::class; case 'originalAsset': return Image::class; case 'title': return 'string'; } return parent::getTypeOfChildProperty($targetType, $propertyName, $configuration); }
php
public function getTypeOfChildProperty($targetType, $propertyName, PropertyMappingConfigurationInterface $configuration) { switch ($propertyName) { case 'resource': return PersistentResource::class; case 'originalAsset': return Image::class; case 'title': return 'string'; } return parent::getTypeOfChildProperty($targetType, $propertyName, $configuration); }
[ "public", "function", "getTypeOfChildProperty", "(", "$", "targetType", ",", "$", "propertyName", ",", "PropertyMappingConfigurationInterface", "$", "configuration", ")", "{", "switch", "(", "$", "propertyName", ")", "{", "case", "'resource'", ":", "return", "Persis...
Convert the property "resource" @param string $targetType @param string $propertyName @param PropertyMappingConfigurationInterface $configuration @return string
[ "Convert", "the", "property", "resource" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/TypeConverter/AssetInterfaceConverter.php#L144-L155
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/ImageVariant.php
ImageVariant.initializeObject
public function initializeObject($initializationCause) { parent::initializeObject($initializationCause); if ($initializationCause === ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED) { $this->renderResource(); } }
php
public function initializeObject($initializationCause) { parent::initializeObject($initializationCause); if ($initializationCause === ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED) { $this->renderResource(); } }
[ "public", "function", "initializeObject", "(", "$", "initializationCause", ")", "{", "parent", "::", "initializeObject", "(", "$", "initializationCause", ")", ";", "if", "(", "$", "initializationCause", "===", "ObjectManagerInterface", "::", "INITIALIZATIONCAUSE_CREATED...
Initialize this image variant This method will generate the resource of this asset when this object has just been newly created. We can't run renderResource() in the constructor since not all dependencies have been injected then. Generating resources lazily in the getResource() method is not feasible either, because getters will be triggered by the validation mechanism on flushing the persistence which will result in undefined behavior. We don't call refresh() here because we only want the resource to be rendered, not all other refresh actions from parent classes being executed. @param integer $initializationCause @return void @throws Exception @throws ImageFileException @throws InvalidConfigurationException
[ "Initialize", "this", "image", "variant" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/ImageVariant.php#L115-L121
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/ImageVariant.php
ImageVariant.addAdjustments
public function addAdjustments(array $adjustments): void { foreach ($adjustments as $adjustment) { $this->applyAdjustment($adjustment); } $this->refresh(); }
php
public function addAdjustments(array $adjustments): void { foreach ($adjustments as $adjustment) { $this->applyAdjustment($adjustment); } $this->refresh(); }
[ "public", "function", "addAdjustments", "(", "array", "$", "adjustments", ")", ":", "void", "{", "foreach", "(", "$", "adjustments", "as", "$", "adjustment", ")", "{", "$", "this", "->", "applyAdjustment", "(", "$", "adjustment", ")", ";", "}", "$", "thi...
Adds the given adjustments to the list of adjustments applied to this image variant. If an adjustment of one of the given types already exists, the existing one will be overridden by the new one. @param array<ImageAdjustmentInterface> $adjustments @return void @throws Exception @throws ImageFileException @throws InvalidConfigurationException @throws \Exception
[ "Adds", "the", "given", "adjustments", "to", "the", "list", "of", "adjustments", "applied", "to", "this", "image", "variant", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/ImageVariant.php#L361-L367
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/ImageVariant.php
ImageVariant.applyAdjustment
protected function applyAdjustment(ImageAdjustmentInterface $adjustment): void { $existingAdjustmentFound = false; $newAdjustmentClassName = TypeHandling::getTypeForValue($adjustment); foreach ($this->adjustments as $existingAdjustment) { if (TypeHandling::getTypeForValue($existingAdjustment) === $newAdjustmentClassName) { foreach (ObjectAccess::getGettableProperties($adjustment) as $propertyName => $propertyValue) { ObjectAccess::setProperty($existingAdjustment, $propertyName, $propertyValue); } $existingAdjustmentFound = true; } } if (!$existingAdjustmentFound) { $this->adjustments->add($adjustment); $adjustment->setImageVariant($this); $this->adjustments = $this->adjustments->matching(new Criteria(null, ['position' => 'ASC'])); } $this->lastModified = new \DateTime(); }
php
protected function applyAdjustment(ImageAdjustmentInterface $adjustment): void { $existingAdjustmentFound = false; $newAdjustmentClassName = TypeHandling::getTypeForValue($adjustment); foreach ($this->adjustments as $existingAdjustment) { if (TypeHandling::getTypeForValue($existingAdjustment) === $newAdjustmentClassName) { foreach (ObjectAccess::getGettableProperties($adjustment) as $propertyName => $propertyValue) { ObjectAccess::setProperty($existingAdjustment, $propertyName, $propertyValue); } $existingAdjustmentFound = true; } } if (!$existingAdjustmentFound) { $this->adjustments->add($adjustment); $adjustment->setImageVariant($this); $this->adjustments = $this->adjustments->matching(new Criteria(null, ['position' => 'ASC'])); } $this->lastModified = new \DateTime(); }
[ "protected", "function", "applyAdjustment", "(", "ImageAdjustmentInterface", "$", "adjustment", ")", ":", "void", "{", "$", "existingAdjustmentFound", "=", "false", ";", "$", "newAdjustmentClassName", "=", "TypeHandling", "::", "getTypeForValue", "(", "$", "adjustment...
Apply the given adjustment to the image variant. If an adjustment of the given type already exists, the existing one will be overridden by the new one. @param ImageAdjustmentInterface $adjustment @return void @throws \Exception
[ "Apply", "the", "given", "adjustment", "to", "the", "image", "variant", ".", "If", "an", "adjustment", "of", "the", "given", "type", "already", "exists", "the", "existing", "one", "will", "be", "overridden", "by", "the", "new", "one", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/ImageVariant.php#L377-L397
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/ImageVariant.php
ImageVariant.renderResource
protected function renderResource(): void { $processedImageInfo = $this->imageService->processImage($this->originalAsset->getResource(), $this->adjustments->toArray()); $this->resource = $processedImageInfo['resource']; $this->width = $processedImageInfo['width']; $this->height = $processedImageInfo['height']; $this->persistenceManager->whitelistObject($this->resource); }
php
protected function renderResource(): void { $processedImageInfo = $this->imageService->processImage($this->originalAsset->getResource(), $this->adjustments->toArray()); $this->resource = $processedImageInfo['resource']; $this->width = $processedImageInfo['width']; $this->height = $processedImageInfo['height']; $this->persistenceManager->whitelistObject($this->resource); }
[ "protected", "function", "renderResource", "(", ")", ":", "void", "{", "$", "processedImageInfo", "=", "$", "this", "->", "imageService", "->", "processImage", "(", "$", "this", "->", "originalAsset", "->", "getResource", "(", ")", ",", "$", "this", "->", ...
Tells the ImageService to render the resource of this ImageVariant according to the existing adjustments. @return void @throws InvalidConfigurationException @throws Exception @throws ImageFileException
[ "Tells", "the", "ImageService", "to", "render", "the", "resource", "of", "this", "ImageVariant", "according", "to", "the", "existing", "adjustments", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/ImageVariant.php#L415-L422
train
neos/neos-development-collection
Neos.Neos/Classes/ViewHelpers/Rendering/AbstractRenderingStateViewHelper.php
AbstractRenderingStateViewHelper.getContextNode
protected function getContextNode() { $baseNode = null; $view = $this->viewHelperVariableContainer->getView(); if ($view instanceof FusionAwareViewInterface) { $fusionObject = $view->getFusionObject(); $currentContext = $fusionObject->getRuntime()->getCurrentContext(); if (isset($currentContext['node'])) { $baseNode = $currentContext['node']; } } return $baseNode; }
php
protected function getContextNode() { $baseNode = null; $view = $this->viewHelperVariableContainer->getView(); if ($view instanceof FusionAwareViewInterface) { $fusionObject = $view->getFusionObject(); $currentContext = $fusionObject->getRuntime()->getCurrentContext(); if (isset($currentContext['node'])) { $baseNode = $currentContext['node']; } } return $baseNode; }
[ "protected", "function", "getContextNode", "(", ")", "{", "$", "baseNode", "=", "null", ";", "$", "view", "=", "$", "this", "->", "viewHelperVariableContainer", "->", "getView", "(", ")", ";", "if", "(", "$", "view", "instanceof", "FusionAwareViewInterface", ...
Get a node from the current Fusion context if available. @return NodeInterface|NULL @TODO Refactor to a Fusion Context trait (in Neos.Fusion) that can be used inside ViewHelpers to get variables from the Fusion context.
[ "Get", "a", "node", "from", "the", "current", "Fusion", "context", "if", "available", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/ViewHelpers/Rendering/AbstractRenderingStateViewHelper.php#L32-L45
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/Image.php
Image.addVariant
public function addVariant(ImageVariant $variant) { if ($variant->getOriginalAsset() !== $this) { throw new \InvalidArgumentException('Could not add the given ImageVariant to the list of this Image\'s variants because the variant refers to a different original asset.', 1381416726); } $this->variants->add($variant); }
php
public function addVariant(ImageVariant $variant) { if ($variant->getOriginalAsset() !== $this) { throw new \InvalidArgumentException('Could not add the given ImageVariant to the list of this Image\'s variants because the variant refers to a different original asset.', 1381416726); } $this->variants->add($variant); }
[ "public", "function", "addVariant", "(", "ImageVariant", "$", "variant", ")", "{", "if", "(", "$", "variant", "->", "getOriginalAsset", "(", ")", "!==", "$", "this", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Could not add the given Image...
Adds a variant of this image Note that you should try to re-use variants if you need to adjust them, rather than creating a new variant for every change. Non-used variants will remain in the database and block resource disk space until they are removed explicitly or the original image is deleted. @param ImageVariant $variant The new variant @return void @throws \InvalidArgumentException
[ "Adds", "a", "variant", "of", "this", "image" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/Image.php#L97-L103
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/Image.php
Image.calculateDimensionsFromResource
protected function calculateDimensionsFromResource(PersistentResource $resource) { try { $imageSize = $this->imageService->getImageSize($resource); } catch (ImageFileException $imageFileException) { throw new ImageFileException(sprintf('Tried to refresh the dimensions and meta data of Image asset "%s" but the file of resource "%s" does not exist or is not a valid image.', $this->getTitle(), $resource->getSha1()), 1381141468, $imageFileException); } $this->width = is_int($imageSize['width']) ? $imageSize['width'] : null; $this->height = is_int($imageSize['height']) ? $imageSize['height'] : null; }
php
protected function calculateDimensionsFromResource(PersistentResource $resource) { try { $imageSize = $this->imageService->getImageSize($resource); } catch (ImageFileException $imageFileException) { throw new ImageFileException(sprintf('Tried to refresh the dimensions and meta data of Image asset "%s" but the file of resource "%s" does not exist or is not a valid image.', $this->getTitle(), $resource->getSha1()), 1381141468, $imageFileException); } $this->width = is_int($imageSize['width']) ? $imageSize['width'] : null; $this->height = is_int($imageSize['height']) ? $imageSize['height'] : null; }
[ "protected", "function", "calculateDimensionsFromResource", "(", "PersistentResource", "$", "resource", ")", "{", "try", "{", "$", "imageSize", "=", "$", "this", "->", "imageService", "->", "getImageSize", "(", "$", "resource", ")", ";", "}", "catch", "(", "Im...
Calculates and sets the width and height of this Image asset based on the given PersistentResource. @param PersistentResource $resource @return void @throws ImageFileException
[ "Calculates", "and", "sets", "the", "width", "and", "height", "of", "this", "Image", "asset", "based", "on", "the", "given", "PersistentResource", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/Image.php#L124-L134
train
neos/neos-development-collection
Neos.Neos/Classes/Aspects/PluginUriAspect.php
PluginUriAspect.getControllerObjectName
public function getControllerObjectName($request, array $arguments) { $controllerName = $arguments['controllerName'] !== null ? $arguments['controllerName'] : $request->getControllerName(); $subPackageKey = $arguments['subPackageKey'] !== null ? $arguments['subPackageKey'] : $request->getControllerSubpackageKey(); $packageKey = $arguments['packageKey'] !== null ? $arguments['packageKey'] : $request->getControllerPackageKey(); $possibleObjectName = '@package\@subpackage\Controller\@controllerController'; $possibleObjectName = str_replace('@package', str_replace('.', '\\', $packageKey), $possibleObjectName); $possibleObjectName = str_replace('@subpackage', $subPackageKey, $possibleObjectName); $possibleObjectName = str_replace('@controller', $controllerName, $possibleObjectName); $possibleObjectName = str_replace('\\\\', '\\', $possibleObjectName); $controllerObjectName = $this->objectManager->getCaseSensitiveObjectName($possibleObjectName); return ($controllerObjectName !== false) ? $controllerObjectName : ''; }
php
public function getControllerObjectName($request, array $arguments) { $controllerName = $arguments['controllerName'] !== null ? $arguments['controllerName'] : $request->getControllerName(); $subPackageKey = $arguments['subPackageKey'] !== null ? $arguments['subPackageKey'] : $request->getControllerSubpackageKey(); $packageKey = $arguments['packageKey'] !== null ? $arguments['packageKey'] : $request->getControllerPackageKey(); $possibleObjectName = '@package\@subpackage\Controller\@controllerController'; $possibleObjectName = str_replace('@package', str_replace('.', '\\', $packageKey), $possibleObjectName); $possibleObjectName = str_replace('@subpackage', $subPackageKey, $possibleObjectName); $possibleObjectName = str_replace('@controller', $controllerName, $possibleObjectName); $possibleObjectName = str_replace('\\\\', '\\', $possibleObjectName); $controllerObjectName = $this->objectManager->getCaseSensitiveObjectName($possibleObjectName); return ($controllerObjectName !== false) ? $controllerObjectName : ''; }
[ "public", "function", "getControllerObjectName", "(", "$", "request", ",", "array", "$", "arguments", ")", "{", "$", "controllerName", "=", "$", "arguments", "[", "'controllerName'", "]", "!==", "null", "?", "$", "arguments", "[", "'controllerName'", "]", ":",...
Merge the default plugin arguments of the Plugin with the arguments in the request and generate a controllerObjectName @param object $request @param array $arguments @return string $controllerObjectName
[ "Merge", "the", "default", "plugin", "arguments", "of", "the", "Plugin", "with", "the", "arguments", "in", "the", "request", "and", "generate", "a", "controllerObjectName" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Aspects/PluginUriAspect.php#L82-L96
train
neos/neos-development-collection
Neos.Neos/Classes/Aspects/PluginUriAspect.php
PluginUriAspect.generateUriForNode
public function generateUriForNode(ActionRequest $request, JoinPointInterface $joinPoint, NodeInterface $node) { // store original node path to restore it after generating the uri $originalNodePath = $request->getMainRequest()->getArgument('node'); // generate the uri for the given node $request->getMainRequest()->setArgument('node', $node->getContextPath()); $result = $joinPoint->getAdviceChain()->proceed($joinPoint); // restore the original node path $request->getMainRequest()->setArgument('node', $originalNodePath); return $result; }
php
public function generateUriForNode(ActionRequest $request, JoinPointInterface $joinPoint, NodeInterface $node) { // store original node path to restore it after generating the uri $originalNodePath = $request->getMainRequest()->getArgument('node'); // generate the uri for the given node $request->getMainRequest()->setArgument('node', $node->getContextPath()); $result = $joinPoint->getAdviceChain()->proceed($joinPoint); // restore the original node path $request->getMainRequest()->setArgument('node', $originalNodePath); return $result; }
[ "public", "function", "generateUriForNode", "(", "ActionRequest", "$", "request", ",", "JoinPointInterface", "$", "joinPoint", ",", "NodeInterface", "$", "node", ")", "{", "// store original node path to restore it after generating the uri", "$", "originalNodePath", "=", "$...
This method generates the Uri through the joinPoint with temporary overriding the used node @param ActionRequest $request @param JoinPointInterface $joinPoint The current join point @param NodeInterface $node @return string $uri
[ "This", "method", "generates", "the", "Uri", "through", "the", "joinPoint", "with", "temporary", "overriding", "the", "used", "node" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Aspects/PluginUriAspect.php#L107-L120
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Migration/Transformations/ChangeNodeType.php
ChangeNodeType.isTransformable
public function isTransformable(NodeData $node) { return $this->nodeTypeManager->hasNodeType($this->newType) && !$this->nodeTypeManager->getNodeType($this->newType)->isAbstract(); }
php
public function isTransformable(NodeData $node) { return $this->nodeTypeManager->hasNodeType($this->newType) && !$this->nodeTypeManager->getNodeType($this->newType)->isAbstract(); }
[ "public", "function", "isTransformable", "(", "NodeData", "$", "node", ")", "{", "return", "$", "this", "->", "nodeTypeManager", "->", "hasNodeType", "(", "$", "this", "->", "newType", ")", "&&", "!", "$", "this", "->", "nodeTypeManager", "->", "getNodeType"...
If the given node has the property this transformation should work on, this returns true if the given NodeType is registered with the NodeTypeManager and is not abstract. @param NodeData $node @return boolean
[ "If", "the", "given", "node", "has", "the", "property", "this", "transformation", "should", "work", "on", "this", "returns", "true", "if", "the", "given", "NodeType", "is", "registered", "with", "the", "NodeTypeManager", "and", "is", "not", "abstract", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Migration/Transformations/ChangeNodeType.php#L52-L55
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Migration/Transformations/ChangeNodeType.php
ChangeNodeType.execute
public function execute(NodeData $node) { $nodeType = $this->nodeTypeManager->getNodeType($this->newType); $node->setNodeType($nodeType); }
php
public function execute(NodeData $node) { $nodeType = $this->nodeTypeManager->getNodeType($this->newType); $node->setNodeType($nodeType); }
[ "public", "function", "execute", "(", "NodeData", "$", "node", ")", "{", "$", "nodeType", "=", "$", "this", "->", "nodeTypeManager", "->", "getNodeType", "(", "$", "this", "->", "newType", ")", ";", "$", "node", "->", "setNodeType", "(", "$", "nodeType",...
Change the Node Type on the given node. @param NodeData $node @return void
[ "Change", "the", "Node", "Type", "on", "the", "given", "node", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Migration/Transformations/ChangeNodeType.php#L63-L67
train
neos/neos-development-collection
Neos.Neos/Classes/View/FusionView.php
FusionView.assign
public function assign($key, $value) { $this->fusionRuntime = null; return parent::assign($key, $value); }
php
public function assign($key, $value) { $this->fusionRuntime = null; return parent::assign($key, $value); }
[ "public", "function", "assign", "(", "$", "key", ",", "$", "value", ")", "{", "$", "this", "->", "fusionRuntime", "=", "null", ";", "return", "parent", "::", "assign", "(", "$", "key", ",", "$", "value", ")", ";", "}" ]
Clear the cached runtime instance on assignment of variables @param string $key @param mixed $value @return FusionView
[ "Clear", "the", "cached", "runtime", "instance", "on", "assignment", "of", "variables" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/View/FusionView.php#L240-L244
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Frontend/NodeController.php
NodeController.showAction
public function showAction(NodeInterface $node = null) { if ($node === null) { throw new NodeNotFoundException('The requested node does not exist or isn\'t accessible to the current user', 1430218623); } $inBackend = $node->getContext()->isInBackend(); if ($node->getNodeType()->isOfType('Neos.Neos:Shortcut') && !$inBackend) { $this->handleShortcutNode($node); } $this->view->assign('value', $node); if ($inBackend) { $this->overrideViewVariablesFromInternalArguments(); $this->response->setHeader('Cache-Control', 'no-cache'); if (!$this->view->canRenderWithNodeAndPath()) { $this->view->setFusionPath('rawContent'); } } if ($this->session->isStarted() && $inBackend) { $this->session->putData('lastVisitedNode', $node->getContextPath()); } }
php
public function showAction(NodeInterface $node = null) { if ($node === null) { throw new NodeNotFoundException('The requested node does not exist or isn\'t accessible to the current user', 1430218623); } $inBackend = $node->getContext()->isInBackend(); if ($node->getNodeType()->isOfType('Neos.Neos:Shortcut') && !$inBackend) { $this->handleShortcutNode($node); } $this->view->assign('value', $node); if ($inBackend) { $this->overrideViewVariablesFromInternalArguments(); $this->response->setHeader('Cache-Control', 'no-cache'); if (!$this->view->canRenderWithNodeAndPath()) { $this->view->setFusionPath('rawContent'); } } if ($this->session->isStarted() && $inBackend) { $this->session->putData('lastVisitedNode', $node->getContextPath()); } }
[ "public", "function", "showAction", "(", "NodeInterface", "$", "node", "=", "null", ")", "{", "if", "(", "$", "node", "===", "null", ")", "{", "throw", "new", "NodeNotFoundException", "(", "'The requested node does not exist or isn\\'t accessible to the current user'", ...
Shows the specified node and takes visibility and access restrictions into account. @param NodeInterface $node @return string View output for the specified node @Flow\SkipCsrfProtection We need to skip CSRF protection here because this action could be called with unsafe requests from widgets or plugins that are rendered on the node - For those the CSRF token is validated on the sub-request, so it is safe to be skipped here @Flow\IgnoreValidation("node") @throws NodeNotFoundException
[ "Shows", "the", "specified", "node", "and", "takes", "visibility", "and", "access", "restrictions", "into", "account", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Frontend/NodeController.php#L83-L108
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Frontend/NodeController.php
NodeController.overrideViewVariablesFromInternalArguments
protected function overrideViewVariablesFromInternalArguments() { if (($nodeContextPath = $this->request->getInternalArgument('__nodeContextPath')) !== null) { $node = $this->propertyMapper->convert($nodeContextPath, NodeInterface::class); if (!$node instanceof NodeInterface) { throw new NodeNotFoundException(sprintf('The node with context path "%s" could not be resolved', $nodeContextPath), 1437051934); } $this->view->assign('value', $node); } if (($affectedNodeContextPath = $this->request->getInternalArgument('__affectedNodeContextPath')) !== null) { $this->response->setHeader('X-Neos-AffectedNodePath', $affectedNodeContextPath); } if (($fusionPath = $this->request->getInternalArgument('__fusionPath')) !== null) { $this->view->setFusionPath($fusionPath); } }
php
protected function overrideViewVariablesFromInternalArguments() { if (($nodeContextPath = $this->request->getInternalArgument('__nodeContextPath')) !== null) { $node = $this->propertyMapper->convert($nodeContextPath, NodeInterface::class); if (!$node instanceof NodeInterface) { throw new NodeNotFoundException(sprintf('The node with context path "%s" could not be resolved', $nodeContextPath), 1437051934); } $this->view->assign('value', $node); } if (($affectedNodeContextPath = $this->request->getInternalArgument('__affectedNodeContextPath')) !== null) { $this->response->setHeader('X-Neos-AffectedNodePath', $affectedNodeContextPath); } if (($fusionPath = $this->request->getInternalArgument('__fusionPath')) !== null) { $this->view->setFusionPath($fusionPath); } }
[ "protected", "function", "overrideViewVariablesFromInternalArguments", "(", ")", "{", "if", "(", "(", "$", "nodeContextPath", "=", "$", "this", "->", "request", "->", "getInternalArgument", "(", "'__nodeContextPath'", ")", ")", "!==", "null", ")", "{", "$", "nod...
Checks if the optionally given node context path, affected node context path and Fusion path are set and overrides the rendering to use those. Will also add a "X-Neos-AffectedNodePath" header in case the actually affected node is different from the one routing resolved. This is used in out of band rendering for the backend. @return void @throws NodeNotFoundException
[ "Checks", "if", "the", "optionally", "given", "node", "context", "path", "affected", "node", "context", "path", "and", "Fusion", "path", "are", "set", "and", "overrides", "the", "rendering", "to", "use", "those", ".", "Will", "also", "add", "a", "X", "-", ...
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Frontend/NodeController.php#L119-L136
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Frontend/NodeController.php
NodeController.handleShortcutNode
protected function handleShortcutNode(NodeInterface $node) { $resolvedNode = $this->nodeShortcutResolver->resolveShortcutTarget($node); if ($resolvedNode === null) { throw new NodeNotFoundException(sprintf('The shortcut node target of node "%s" could not be resolved', $node->getPath()), 1430218730); } elseif (is_string($resolvedNode)) { $this->redirectToUri($resolvedNode); } elseif ($resolvedNode instanceof NodeInterface && $resolvedNode === $node) { throw new NodeNotFoundException('The requested node does not exist or isn\'t accessible to the current user', 1502793585); } elseif ($resolvedNode instanceof NodeInterface) { $this->redirect('show', null, null, ['node' => $resolvedNode]); } else { throw new UnresolvableShortcutException(sprintf('The shortcut node target of node "%s" resolves to an unsupported type "%s"', $node->getPath(), is_object($resolvedNode) ? get_class($resolvedNode) : gettype($resolvedNode)), 1430218738); } }
php
protected function handleShortcutNode(NodeInterface $node) { $resolvedNode = $this->nodeShortcutResolver->resolveShortcutTarget($node); if ($resolvedNode === null) { throw new NodeNotFoundException(sprintf('The shortcut node target of node "%s" could not be resolved', $node->getPath()), 1430218730); } elseif (is_string($resolvedNode)) { $this->redirectToUri($resolvedNode); } elseif ($resolvedNode instanceof NodeInterface && $resolvedNode === $node) { throw new NodeNotFoundException('The requested node does not exist or isn\'t accessible to the current user', 1502793585); } elseif ($resolvedNode instanceof NodeInterface) { $this->redirect('show', null, null, ['node' => $resolvedNode]); } else { throw new UnresolvableShortcutException(sprintf('The shortcut node target of node "%s" resolves to an unsupported type "%s"', $node->getPath(), is_object($resolvedNode) ? get_class($resolvedNode) : gettype($resolvedNode)), 1430218738); } }
[ "protected", "function", "handleShortcutNode", "(", "NodeInterface", "$", "node", ")", "{", "$", "resolvedNode", "=", "$", "this", "->", "nodeShortcutResolver", "->", "resolveShortcutTarget", "(", "$", "node", ")", ";", "if", "(", "$", "resolvedNode", "===", "...
Handles redirects to shortcut targets in live rendering. @param NodeInterface $node @return void @throws NodeNotFoundException|UnresolvableShortcutException
[ "Handles", "redirects", "to", "shortcut", "targets", "in", "live", "rendering", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Frontend/NodeController.php#L145-L159
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/Context.php
Context.getWorkspace
public function getWorkspace($createWorkspaceIfNecessary = true) { if ($this->workspace !== null) { return $this->workspace; } $this->workspace = $this->workspaceRepository->findByIdentifier($this->workspaceName); if ($this->workspace === null && $createWorkspaceIfNecessary) { $liveWorkspace = $this->workspaceRepository->findByIdentifier('live'); $this->workspace = new Workspace($this->workspaceName, $liveWorkspace); $this->workspaceRepository->add($this->workspace); $this->systemLogger->notice(sprintf('Notice: %s::getWorkspace() implicitly created the new workspace "%s". This behaviour is discouraged and will be removed in future versions. Make sure to create workspaces explicitly by adding a new workspace to the Workspace Repository.', __CLASS__, $this->workspaceName), LogEnvironment::fromMethodName(__METHOD__)); } if ($this->workspace !== null) { $this->validateWorkspace($this->workspace); } return $this->workspace; }
php
public function getWorkspace($createWorkspaceIfNecessary = true) { if ($this->workspace !== null) { return $this->workspace; } $this->workspace = $this->workspaceRepository->findByIdentifier($this->workspaceName); if ($this->workspace === null && $createWorkspaceIfNecessary) { $liveWorkspace = $this->workspaceRepository->findByIdentifier('live'); $this->workspace = new Workspace($this->workspaceName, $liveWorkspace); $this->workspaceRepository->add($this->workspace); $this->systemLogger->notice(sprintf('Notice: %s::getWorkspace() implicitly created the new workspace "%s". This behaviour is discouraged and will be removed in future versions. Make sure to create workspaces explicitly by adding a new workspace to the Workspace Repository.', __CLASS__, $this->workspaceName), LogEnvironment::fromMethodName(__METHOD__)); } if ($this->workspace !== null) { $this->validateWorkspace($this->workspace); } return $this->workspace; }
[ "public", "function", "getWorkspace", "(", "$", "createWorkspaceIfNecessary", "=", "true", ")", "{", "if", "(", "$", "this", "->", "workspace", "!==", "null", ")", "{", "return", "$", "this", "->", "workspace", ";", "}", "$", "this", "->", "workspace", "...
Returns the current workspace. @param boolean $createWorkspaceIfNecessary DEPRECATED: If enabled, creates a workspace with the configured name if it doesn't exist already. This option is DEPRECATED, create workspace explicitly instead. @return Workspace The workspace or NULL @api @throws IllegalObjectTypeException
[ "Returns", "the", "current", "workspace", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/Context.php#L150-L169
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/Context.php
Context.getNode
public function getNode($path) { if (!is_string($path) || $path[0] !== '/') { throw new \InvalidArgumentException('Only absolute paths are allowed for Context::getNode()', 1284975105); } $path = strtolower($path); $workspaceRootNode = $this->getWorkspace()->getRootNodeData(); $rootNode = $this->nodeFactory->createFromNodeData($workspaceRootNode, $this); if ($path !== '/') { $node = $this->firstLevelNodeCache->getByPath($path); if ($node === false) { $node = $rootNode->getNode(substr($path, 1)); $this->firstLevelNodeCache->setByPath($path, $node); } } else { $node = $rootNode; } return $node; }
php
public function getNode($path) { if (!is_string($path) || $path[0] !== '/') { throw new \InvalidArgumentException('Only absolute paths are allowed for Context::getNode()', 1284975105); } $path = strtolower($path); $workspaceRootNode = $this->getWorkspace()->getRootNodeData(); $rootNode = $this->nodeFactory->createFromNodeData($workspaceRootNode, $this); if ($path !== '/') { $node = $this->firstLevelNodeCache->getByPath($path); if ($node === false) { $node = $rootNode->getNode(substr($path, 1)); $this->firstLevelNodeCache->setByPath($path, $node); } } else { $node = $rootNode; } return $node; }
[ "public", "function", "getNode", "(", "$", "path", ")", "{", "if", "(", "!", "is_string", "(", "$", "path", ")", "||", "$", "path", "[", "0", "]", "!==", "'/'", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Only absolute paths are al...
Returns a node specified by the given absolute path. @param string $path Absolute path specifying the node @return NodeInterface The specified node or NULL if no such node exists @throws \InvalidArgumentException @api
[ "Returns", "a", "node", "specified", "by", "the", "given", "absolute", "path", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/Context.php#L238-L259
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/Context.php
Context.getNodeByIdentifier
public function getNodeByIdentifier($identifier) { $node = $this->firstLevelNodeCache->getByIdentifier($identifier); if ($node !== false) { return $node; } $nodeData = $this->nodeDataRepository->findOneByIdentifier($identifier, $this->getWorkspace(), $this->dimensions, $this->removedContentShown); if ($nodeData !== null) { $node = $this->nodeFactory->createFromNodeData($nodeData, $this); } else { $node = null; } $this->firstLevelNodeCache->setByIdentifier($identifier, $node); return $node; }
php
public function getNodeByIdentifier($identifier) { $node = $this->firstLevelNodeCache->getByIdentifier($identifier); if ($node !== false) { return $node; } $nodeData = $this->nodeDataRepository->findOneByIdentifier($identifier, $this->getWorkspace(), $this->dimensions, $this->removedContentShown); if ($nodeData !== null) { $node = $this->nodeFactory->createFromNodeData($nodeData, $this); } else { $node = null; } $this->firstLevelNodeCache->setByIdentifier($identifier, $node); return $node; }
[ "public", "function", "getNodeByIdentifier", "(", "$", "identifier", ")", "{", "$", "node", "=", "$", "this", "->", "firstLevelNodeCache", "->", "getByIdentifier", "(", "$", "identifier", ")", ";", "if", "(", "$", "node", "!==", "false", ")", "{", "return"...
Get a node by identifier and this context @param string $identifier The identifier of a node @return NodeInterface The node with the given identifier or NULL if no such node exists
[ "Get", "a", "node", "by", "identifier", "and", "this", "context" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/Context.php#L267-L281
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/Context.php
Context.getNodeVariantsByIdentifier
public function getNodeVariantsByIdentifier($identifier) { $nodeVariants = []; $nodeDataElements = $this->nodeDataRepository->findByIdentifierWithoutReduce($identifier, $this->getWorkspace()); /** @var NodeData $nodeData */ foreach ($nodeDataElements as $nodeData) { $contextProperties = $this->getProperties(); $contextProperties['dimensions'] = $nodeData->getDimensionValues(); unset($contextProperties['targetDimensions']); $adjustedContext = $this->contextFactory->create($contextProperties); $nodeVariant = $this->nodeFactory->createFromNodeData($nodeData, $adjustedContext); $nodeVariants[] = $nodeVariant; } return $nodeVariants; }
php
public function getNodeVariantsByIdentifier($identifier) { $nodeVariants = []; $nodeDataElements = $this->nodeDataRepository->findByIdentifierWithoutReduce($identifier, $this->getWorkspace()); /** @var NodeData $nodeData */ foreach ($nodeDataElements as $nodeData) { $contextProperties = $this->getProperties(); $contextProperties['dimensions'] = $nodeData->getDimensionValues(); unset($contextProperties['targetDimensions']); $adjustedContext = $this->contextFactory->create($contextProperties); $nodeVariant = $this->nodeFactory->createFromNodeData($nodeData, $adjustedContext); $nodeVariants[] = $nodeVariant; } return $nodeVariants; }
[ "public", "function", "getNodeVariantsByIdentifier", "(", "$", "identifier", ")", "{", "$", "nodeVariants", "=", "[", "]", ";", "$", "nodeDataElements", "=", "$", "this", "->", "nodeDataRepository", "->", "findByIdentifierWithoutReduce", "(", "$", "identifier", ",...
Get all node variants for the given identifier A variant of a node can have different dimension values and path (for non-aggregate nodes). The resulting node instances might belong to a different context. @param string $identifier The identifier of a node @return array<\Neos\ContentRepository\Domain\Model\NodeInterface>
[ "Get", "all", "node", "variants", "for", "the", "given", "identifier" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/Context.php#L292-L306
train
neos/neos-development-collection
Neos.Neos/Classes/Validation/Validator/HostnameValidator.php
HostnameValidator.isValid
protected function isValid($hostname) { $pattern = '/(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)*(?!-)[a-zA-Z]{2,63}(?<!-)$)/'; if ($this->options['ignoredHostnames']) { $ignoredHostnames = explode(',', $this->options['ignoredHostnames']); if (in_array($hostname, $ignoredHostnames)) { return; } } if (!preg_match($pattern, $hostname)) { $this->addError('The hostname "%1$s" was not valid.', 1415392993, [$hostname]); } }
php
protected function isValid($hostname) { $pattern = '/(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)*(?!-)[a-zA-Z]{2,63}(?<!-)$)/'; if ($this->options['ignoredHostnames']) { $ignoredHostnames = explode(',', $this->options['ignoredHostnames']); if (in_array($hostname, $ignoredHostnames)) { return; } } if (!preg_match($pattern, $hostname)) { $this->addError('The hostname "%1$s" was not valid.', 1415392993, [$hostname]); } }
[ "protected", "function", "isValid", "(", "$", "hostname", ")", "{", "$", "pattern", "=", "'/(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\\.)*(?!-)[a-zA-Z]{2,63}(?<!-)$)/'", ";", "if", "(", "$", "this", "->", "options", "[", "'ignoredHostnames'", "]", ")", "{", "$", ...
Validates if the hostname is valid. @param mixed $hostname The hostname that should be validated @return void
[ "Validates", "if", "the", "hostname", "is", "valid", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Validation/Validator/HostnameValidator.php#L34-L48
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/ContentObjectProxy.php
ContentObjectProxy.getObject
public function getObject() { if ($this->contentObject === null) { $this->contentObject = $this->persistenceManager->getObjectByIdentifier($this->targetId, $this->targetType); } return $this->contentObject; }
php
public function getObject() { if ($this->contentObject === null) { $this->contentObject = $this->persistenceManager->getObjectByIdentifier($this->targetId, $this->targetType); } return $this->contentObject; }
[ "public", "function", "getObject", "(", ")", "{", "if", "(", "$", "this", "->", "contentObject", "===", "null", ")", "{", "$", "this", "->", "contentObject", "=", "$", "this", "->", "persistenceManager", "->", "getObjectByIdentifier", "(", "$", "this", "->...
Returns the real object this proxy stands for @return object The "content object" as it was originally passed to the constructor
[ "Returns", "the", "real", "object", "this", "proxy", "stands", "for" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/ContentObjectProxy.php#L93-L99
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/ContentDimensionCombinator.php
ContentDimensionCombinator.getAllAllowedCombinations
public function getAllAllowedCombinations() { $configuration = $this->contentDimensionPresetSource->getAllPresets(); $dimensionCombinations = []; $dimensionNames = array_keys($configuration); $dimensionCount = count($dimensionNames); if ($dimensionCount === 0) { // This is correct, we have one allowed combination which is no dimension values (empty array). return [[]]; } // Reset all presets first just to be sure foreach ($configuration as $dimensionName => &$dimensionConfiguration) { reset($dimensionConfiguration['presets']); } unset($dimensionConfiguration); while (true) { $skipCurrentCombination = false; $currentPresetCombination = [ 'withPresetIdentifiers' => [], 'withDimensionValues' => [] ]; foreach ($dimensionNames as $dimensionName) { $presetIdentifierForDimension = key($configuration[$dimensionName]['presets']); $presetForDimension = current($configuration[$dimensionName]['presets']); if (!is_array($presetForDimension) || !isset($presetForDimension['values'])) { $skipCurrentCombination = true; } $currentPresetCombination['withPresetIdentifiers'][$dimensionName] = $presetIdentifierForDimension; $currentPresetCombination['withDimensionValues'][$dimensionName] = $presetForDimension['values']; } if ($skipCurrentCombination === false && $this->contentDimensionPresetSource->isPresetCombinationAllowedByConstraints($currentPresetCombination['withPresetIdentifiers'])) { $dimensionCombinations[] = $currentPresetCombination['withDimensionValues']; } $nextDimension = 0; $hasValue = next($configuration[$dimensionNames[$nextDimension]]['presets']); while ($hasValue === false) { reset($configuration[$dimensionNames[$nextDimension]]['presets']); $nextDimension++; if (!isset($dimensionNames[$nextDimension])) { // we have gone through all dimension combinations now. return $dimensionCombinations; } $hasValue = next($configuration[$dimensionNames[$nextDimension]]['presets']); } } }
php
public function getAllAllowedCombinations() { $configuration = $this->contentDimensionPresetSource->getAllPresets(); $dimensionCombinations = []; $dimensionNames = array_keys($configuration); $dimensionCount = count($dimensionNames); if ($dimensionCount === 0) { // This is correct, we have one allowed combination which is no dimension values (empty array). return [[]]; } // Reset all presets first just to be sure foreach ($configuration as $dimensionName => &$dimensionConfiguration) { reset($dimensionConfiguration['presets']); } unset($dimensionConfiguration); while (true) { $skipCurrentCombination = false; $currentPresetCombination = [ 'withPresetIdentifiers' => [], 'withDimensionValues' => [] ]; foreach ($dimensionNames as $dimensionName) { $presetIdentifierForDimension = key($configuration[$dimensionName]['presets']); $presetForDimension = current($configuration[$dimensionName]['presets']); if (!is_array($presetForDimension) || !isset($presetForDimension['values'])) { $skipCurrentCombination = true; } $currentPresetCombination['withPresetIdentifiers'][$dimensionName] = $presetIdentifierForDimension; $currentPresetCombination['withDimensionValues'][$dimensionName] = $presetForDimension['values']; } if ($skipCurrentCombination === false && $this->contentDimensionPresetSource->isPresetCombinationAllowedByConstraints($currentPresetCombination['withPresetIdentifiers'])) { $dimensionCombinations[] = $currentPresetCombination['withDimensionValues']; } $nextDimension = 0; $hasValue = next($configuration[$dimensionNames[$nextDimension]]['presets']); while ($hasValue === false) { reset($configuration[$dimensionNames[$nextDimension]]['presets']); $nextDimension++; if (!isset($dimensionNames[$nextDimension])) { // we have gone through all dimension combinations now. return $dimensionCombinations; } $hasValue = next($configuration[$dimensionNames[$nextDimension]]['presets']); } } }
[ "public", "function", "getAllAllowedCombinations", "(", ")", "{", "$", "configuration", "=", "$", "this", "->", "contentDimensionPresetSource", "->", "getAllPresets", "(", ")", ";", "$", "dimensionCombinations", "=", "[", "]", ";", "$", "dimensionNames", "=", "a...
Array of all possible dimension configurations allowed by configured presets. @return array
[ "Array", "of", "all", "possible", "dimension", "configurations", "allowed", "by", "configured", "presets", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/ContentDimensionCombinator.php#L34-L86
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Repository/DomainRepository.php
DomainRepository.findByHost
public function findByHost($hostname, $onlyActive = false) { $domains = $onlyActive === true ? $this->findByActive(true)->toArray() : $this->findAll()->toArray(); return $this->domainMatchingStrategy->getSortedMatches($hostname, $domains); }
php
public function findByHost($hostname, $onlyActive = false) { $domains = $onlyActive === true ? $this->findByActive(true)->toArray() : $this->findAll()->toArray(); return $this->domainMatchingStrategy->getSortedMatches($hostname, $domains); }
[ "public", "function", "findByHost", "(", "$", "hostname", ",", "$", "onlyActive", "=", "false", ")", "{", "$", "domains", "=", "$", "onlyActive", "===", "true", "?", "$", "this", "->", "findByActive", "(", "true", ")", "->", "toArray", "(", ")", ":", ...
Finds all active domains matching the given hostname. Their order is determined by how well they match, best match first. @param string $hostname Hostname the domain should match with (eg. "localhost" or "www.neos.io") @param boolean $onlyActive Only include active domains @return array An array of matching domains @api
[ "Finds", "all", "active", "domains", "matching", "the", "given", "hostname", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Repository/DomainRepository.php#L60-L64
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Repository/DomainRepository.php
DomainRepository.findOneByHost
public function findOneByHost($hostname, $onlyActive = false) { $allMatchingDomains = $this->findByHost($hostname, $onlyActive); return count($allMatchingDomains) > 0 ? $allMatchingDomains[0] : null; }
php
public function findOneByHost($hostname, $onlyActive = false) { $allMatchingDomains = $this->findByHost($hostname, $onlyActive); return count($allMatchingDomains) > 0 ? $allMatchingDomains[0] : null; }
[ "public", "function", "findOneByHost", "(", "$", "hostname", ",", "$", "onlyActive", "=", "false", ")", "{", "$", "allMatchingDomains", "=", "$", "this", "->", "findByHost", "(", "$", "hostname", ",", "$", "onlyActive", ")", ";", "return", "count", "(", ...
Find the best matching active domain for the given hostname. @param string $hostname Hostname the domain should match with (eg. "localhost" or "www.neos.io") @param boolean $onlyActive Only include active domains @return Domain @api
[ "Find", "the", "best", "matching", "active", "domain", "for", "the", "given", "hostname", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Repository/DomainRepository.php#L74-L78
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Security/Authorization/Privilege/Node/AbstractNodePrivilege.php
AbstractNodePrivilege.evaluateNodeContext
protected function evaluateNodeContext() { $eelContext = new Context($this->nodeContext); return $this->eelCompilingEvaluator->evaluate($this->getParsedMatcher(), $eelContext); }
php
protected function evaluateNodeContext() { $eelContext = new Context($this->nodeContext); return $this->eelCompilingEvaluator->evaluate($this->getParsedMatcher(), $eelContext); }
[ "protected", "function", "evaluateNodeContext", "(", ")", "{", "$", "eelContext", "=", "new", "Context", "(", "$", "this", "->", "nodeContext", ")", ";", "return", "$", "this", "->", "eelCompilingEvaluator", "->", "evaluate", "(", "$", "this", "->", "getPars...
Evaluates the matcher with this objects nodeContext and returns the result. @return mixed
[ "Evaluates", "the", "matcher", "with", "this", "objects", "nodeContext", "and", "returns", "the", "result", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Security/Authorization/Privilege/Node/AbstractNodePrivilege.php#L168-L172
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/Workspace.php
Workspace.initializeObject
public function initializeObject($initializationCause) { if ($initializationCause === ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED) { $this->rootNodeData = new NodeData('/', $this); $this->nodeDataRepository->add($this->rootNodeData); if ($this->owner instanceof UserInterface) { $this->setOwner($this->owner); } } }
php
public function initializeObject($initializationCause) { if ($initializationCause === ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED) { $this->rootNodeData = new NodeData('/', $this); $this->nodeDataRepository->add($this->rootNodeData); if ($this->owner instanceof UserInterface) { $this->setOwner($this->owner); } } }
[ "public", "function", "initializeObject", "(", "$", "initializationCause", ")", "{", "if", "(", "$", "initializationCause", "===", "ObjectManagerInterface", "::", "INITIALIZATIONCAUSE_CREATED", ")", "{", "$", "this", "->", "rootNodeData", "=", "new", "NodeData", "("...
Initializes this workspace. If this workspace is brand new, a root node is created automatically. @param integer $initializationCause @return void
[ "Initializes", "this", "workspace", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/Workspace.php#L159-L169
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/Workspace.php
Workspace.setBaseWorkspace
public function setBaseWorkspace(Workspace $baseWorkspace) { $oldBaseWorkspace = $this->baseWorkspace; if ($oldBaseWorkspace !== $baseWorkspace) { $this->baseWorkspace = $baseWorkspace; $this->emitBaseWorkspaceChanged($this, $oldBaseWorkspace, $baseWorkspace); } }
php
public function setBaseWorkspace(Workspace $baseWorkspace) { $oldBaseWorkspace = $this->baseWorkspace; if ($oldBaseWorkspace !== $baseWorkspace) { $this->baseWorkspace = $baseWorkspace; $this->emitBaseWorkspaceChanged($this, $oldBaseWorkspace, $baseWorkspace); } }
[ "public", "function", "setBaseWorkspace", "(", "Workspace", "$", "baseWorkspace", ")", "{", "$", "oldBaseWorkspace", "=", "$", "this", "->", "baseWorkspace", ";", "if", "(", "$", "oldBaseWorkspace", "!==", "$", "baseWorkspace", ")", "{", "$", "this", "->", "...
Sets the base workspace Note that this method is not part of the public API because further action is necessary for rebasing a workspace @param Workspace $baseWorkspace @return void
[ "Sets", "the", "base", "workspace" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/Workspace.php#L320-L327
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/Workspace.php
Workspace.getBaseWorkspaces
public function getBaseWorkspaces() { $baseWorkspaces = []; $baseWorkspace = $this->baseWorkspace; while ($baseWorkspace !== null) { $baseWorkspaces[$baseWorkspace->getName()] = $baseWorkspace; $baseWorkspace = $baseWorkspace->getBaseWorkspace(); } return $baseWorkspaces; }
php
public function getBaseWorkspaces() { $baseWorkspaces = []; $baseWorkspace = $this->baseWorkspace; while ($baseWorkspace !== null) { $baseWorkspaces[$baseWorkspace->getName()] = $baseWorkspace; $baseWorkspace = $baseWorkspace->getBaseWorkspace(); } return $baseWorkspaces; }
[ "public", "function", "getBaseWorkspaces", "(", ")", "{", "$", "baseWorkspaces", "=", "[", "]", ";", "$", "baseWorkspace", "=", "$", "this", "->", "baseWorkspace", ";", "while", "(", "$", "baseWorkspace", "!==", "null", ")", "{", "$", "baseWorkspaces", "["...
Returns all base workspaces, if any @return Workspace[]
[ "Returns", "all", "base", "workspaces", "if", "any" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/Workspace.php#L345-L356
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/Workspace.php
Workspace.publish
public function publish(Workspace $targetWorkspace) { $sourceNodes = $this->publishingService->getUnpublishedNodes($this); $this->publishNodes($sourceNodes, $targetWorkspace); }
php
public function publish(Workspace $targetWorkspace) { $sourceNodes = $this->publishingService->getUnpublishedNodes($this); $this->publishNodes($sourceNodes, $targetWorkspace); }
[ "public", "function", "publish", "(", "Workspace", "$", "targetWorkspace", ")", "{", "$", "sourceNodes", "=", "$", "this", "->", "publishingService", "->", "getUnpublishedNodes", "(", "$", "this", ")", ";", "$", "this", "->", "publishNodes", "(", "$", "sourc...
Publishes the content of this workspace to another workspace. The specified workspace must be a base workspace of this workspace. @param Workspace $targetWorkspace The workspace to publish to @return void @api
[ "Publishes", "the", "content", "of", "this", "workspace", "to", "another", "workspace", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/Workspace.php#L377-L381
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/Workspace.php
Workspace.publishNodes
public function publishNodes(array $nodes, Workspace $targetWorkspace) { foreach ($nodes as $node) { $this->publishNode($node, $targetWorkspace); } }
php
public function publishNodes(array $nodes, Workspace $targetWorkspace) { foreach ($nodes as $node) { $this->publishNode($node, $targetWorkspace); } }
[ "public", "function", "publishNodes", "(", "array", "$", "nodes", ",", "Workspace", "$", "targetWorkspace", ")", "{", "foreach", "(", "$", "nodes", "as", "$", "node", ")", "{", "$", "this", "->", "publishNode", "(", "$", "node", ",", "$", "targetWorkspac...
Publishes the given nodes to the target workspace. The specified workspace must be a base workspace of this workspace. @param array<\Neos\ContentRepository\Domain\Model\NodeInterface> $nodes @param Workspace $targetWorkspace The workspace to publish to @return void @api
[ "Publishes", "the", "given", "nodes", "to", "the", "target", "workspace", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/Workspace.php#L393-L398
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/Workspace.php
Workspace.publishNode
public function publishNode(NodeInterface $nodeToPublish, Workspace $targetWorkspace) { if ($this->publishNodeCanBeSkipped($nodeToPublish, $targetWorkspace)) { return; } $this->emitBeforeNodePublishing($nodeToPublish, $targetWorkspace); $correspondingNodeDataInTargetWorkspace = $this->findCorrespondingNodeDataInTargetWorkspace($nodeToPublish, $targetWorkspace); $matchingNodeVariantExistsInTargetWorkspace = ($correspondingNodeDataInTargetWorkspace !== null && $correspondingNodeDataInTargetWorkspace->getDimensionValues() === $nodeToPublish->getDimensions()); // Save the original node workspace because the workspace of $nodeToPublish can be changed by replaceNodeData(): $originalNodeWorkspace = $nodeToPublish->getWorkspace(); if ($matchingNodeVariantExistsInTargetWorkspace) { $this->replaceNodeData($nodeToPublish, $correspondingNodeDataInTargetWorkspace); $this->moveNodeVariantsInOtherWorkspaces($nodeToPublish->getIdentifier(), $nodeToPublish->getPath(), $originalNodeWorkspace, $targetWorkspace); } else { $this->moveNodeVariantToTargetWorkspace($nodeToPublish, $targetWorkspace); } $this->emitAfterNodePublishing($nodeToPublish, $targetWorkspace); }
php
public function publishNode(NodeInterface $nodeToPublish, Workspace $targetWorkspace) { if ($this->publishNodeCanBeSkipped($nodeToPublish, $targetWorkspace)) { return; } $this->emitBeforeNodePublishing($nodeToPublish, $targetWorkspace); $correspondingNodeDataInTargetWorkspace = $this->findCorrespondingNodeDataInTargetWorkspace($nodeToPublish, $targetWorkspace); $matchingNodeVariantExistsInTargetWorkspace = ($correspondingNodeDataInTargetWorkspace !== null && $correspondingNodeDataInTargetWorkspace->getDimensionValues() === $nodeToPublish->getDimensions()); // Save the original node workspace because the workspace of $nodeToPublish can be changed by replaceNodeData(): $originalNodeWorkspace = $nodeToPublish->getWorkspace(); if ($matchingNodeVariantExistsInTargetWorkspace) { $this->replaceNodeData($nodeToPublish, $correspondingNodeDataInTargetWorkspace); $this->moveNodeVariantsInOtherWorkspaces($nodeToPublish->getIdentifier(), $nodeToPublish->getPath(), $originalNodeWorkspace, $targetWorkspace); } else { $this->moveNodeVariantToTargetWorkspace($nodeToPublish, $targetWorkspace); } $this->emitAfterNodePublishing($nodeToPublish, $targetWorkspace); }
[ "public", "function", "publishNode", "(", "NodeInterface", "$", "nodeToPublish", ",", "Workspace", "$", "targetWorkspace", ")", "{", "if", "(", "$", "this", "->", "publishNodeCanBeSkipped", "(", "$", "nodeToPublish", ",", "$", "targetWorkspace", ")", ")", "{", ...
Publishes the given node to the target workspace. The specified workspace must be a base workspace of this workspace. @param NodeInterface $nodeToPublish The node to publish @param Workspace $targetWorkspace The workspace to publish to @return void @api
[ "Publishes", "the", "given", "node", "to", "the", "target", "workspace", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/Workspace.php#L410-L431
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/Workspace.php
Workspace.replaceNodeData
protected function replaceNodeData(NodeInterface $sourceNode, NodeData $targetNodeData) { $sourceNodeData = $sourceNode->getNodeData(); // The source node is a regular, not moved node and the target node is a moved shadow node if (!$sourceNode->getNodeData()->isRemoved() && $sourceNode->getNodeData()->getMovedTo() === null && $targetNodeData->isRemoved() && $targetNodeData->getMovedTo() !== null) { $sourceNodeData->move($sourceNodeData->getPath(), $targetNodeData->getWorkspace()); return; } if ($sourceNodeData->getParentPath() !== $targetNodeData->getParentPath()) { // When $targetNodeData is moved, the NodeData::move() operation may transform it to a shadow node. // moveTargetNodeDataToNewPosition() will return the correct (non-shadow) node in any case. $targetNodeData = $this->moveTargetNodeDataToNewPosition($targetNodeData, $sourceNode->getPath()); } $this->adjustShadowNodeDataForNodePublishing($sourceNodeData, $targetNodeData->getWorkspace(), $targetNodeData); // Technically this shouldn't be needed but due to doctrines behavior we need it. if ($sourceNodeData->isRemoved() && $targetNodeData->getWorkspace()->getBaseWorkspace() === null) { $this->nodeDataRepository->remove($targetNodeData); $this->nodeDataRepository->remove($sourceNodeData); return; } $targetNodeData->similarize($sourceNodeData); $targetNodeData->setLastPublicationDateTime($this->now); $sourceNode->setNodeData($targetNodeData); $this->nodeService->cleanUpProperties($sourceNode); // If the source node was "removed", make sure that the new target node data is "removed" as well. $targetNodeData->setRemoved($sourceNodeData->isRemoved()); $this->nodeDataRepository->remove($sourceNodeData); }
php
protected function replaceNodeData(NodeInterface $sourceNode, NodeData $targetNodeData) { $sourceNodeData = $sourceNode->getNodeData(); // The source node is a regular, not moved node and the target node is a moved shadow node if (!$sourceNode->getNodeData()->isRemoved() && $sourceNode->getNodeData()->getMovedTo() === null && $targetNodeData->isRemoved() && $targetNodeData->getMovedTo() !== null) { $sourceNodeData->move($sourceNodeData->getPath(), $targetNodeData->getWorkspace()); return; } if ($sourceNodeData->getParentPath() !== $targetNodeData->getParentPath()) { // When $targetNodeData is moved, the NodeData::move() operation may transform it to a shadow node. // moveTargetNodeDataToNewPosition() will return the correct (non-shadow) node in any case. $targetNodeData = $this->moveTargetNodeDataToNewPosition($targetNodeData, $sourceNode->getPath()); } $this->adjustShadowNodeDataForNodePublishing($sourceNodeData, $targetNodeData->getWorkspace(), $targetNodeData); // Technically this shouldn't be needed but due to doctrines behavior we need it. if ($sourceNodeData->isRemoved() && $targetNodeData->getWorkspace()->getBaseWorkspace() === null) { $this->nodeDataRepository->remove($targetNodeData); $this->nodeDataRepository->remove($sourceNodeData); return; } $targetNodeData->similarize($sourceNodeData); $targetNodeData->setLastPublicationDateTime($this->now); $sourceNode->setNodeData($targetNodeData); $this->nodeService->cleanUpProperties($sourceNode); // If the source node was "removed", make sure that the new target node data is "removed" as well. $targetNodeData->setRemoved($sourceNodeData->isRemoved()); $this->nodeDataRepository->remove($sourceNodeData); }
[ "protected", "function", "replaceNodeData", "(", "NodeInterface", "$", "sourceNode", ",", "NodeData", "$", "targetNodeData", ")", "{", "$", "sourceNodeData", "=", "$", "sourceNode", "->", "getNodeData", "(", ")", ";", "// The source node is a regular, not moved node and...
Replace the node data of a node instance with a given target node data The current node data of $node will be removed and be replaced by $targetNodeData. If $node was marked as removed, both node data instances are removed. @param NodeInterface $sourceNode The node instance with node data to be published @param NodeData $targetNodeData The existing node data in the target workspace @return void
[ "Replace", "the", "node", "data", "of", "a", "node", "instance", "with", "a", "given", "target", "node", "data" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/Workspace.php#L473-L508
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/Workspace.php
Workspace.moveNodeVariantsInOtherWorkspaces
protected function moveNodeVariantsInOtherWorkspaces($nodeIdentifier, $targetPath, Workspace $sourceWorkspace, Workspace $targetWorkspace) { $nodeDataVariants = $this->nodeDataRepository->findByNodeIdentifier($nodeIdentifier); /** @var NodeData $nodeDataVariant */ foreach ($nodeDataVariants as $nodeDataVariant) { if ( $nodeDataVariant->getWorkspace()->getBaseWorkspace() === null || $nodeDataVariant->getPath() === $targetPath || $nodeDataVariant->getWorkspace() === $sourceWorkspace || $nodeDataVariant->getWorkspace() === $targetWorkspace ) { continue; } $shadowNodeData = $this->nodeDataRepository->findOneByMovedTo($nodeDataVariant); if ($shadowNodeData === null) { $nodeDataVariant->setPath($targetPath); } } }
php
protected function moveNodeVariantsInOtherWorkspaces($nodeIdentifier, $targetPath, Workspace $sourceWorkspace, Workspace $targetWorkspace) { $nodeDataVariants = $this->nodeDataRepository->findByNodeIdentifier($nodeIdentifier); /** @var NodeData $nodeDataVariant */ foreach ($nodeDataVariants as $nodeDataVariant) { if ( $nodeDataVariant->getWorkspace()->getBaseWorkspace() === null || $nodeDataVariant->getPath() === $targetPath || $nodeDataVariant->getWorkspace() === $sourceWorkspace || $nodeDataVariant->getWorkspace() === $targetWorkspace ) { continue; } $shadowNodeData = $this->nodeDataRepository->findOneByMovedTo($nodeDataVariant); if ($shadowNodeData === null) { $nodeDataVariant->setPath($targetPath); } } }
[ "protected", "function", "moveNodeVariantsInOtherWorkspaces", "(", "$", "nodeIdentifier", ",", "$", "targetPath", ",", "Workspace", "$", "sourceWorkspace", ",", "Workspace", "$", "targetWorkspace", ")", "{", "$", "nodeDataVariants", "=", "$", "this", "->", "nodeData...
Moves variants of a given node which exists in other workspaces than source and target workspace. @param string $nodeIdentifier The node which is about to be moved @param string $targetPath The target node path the node is being moved to @param Workspace $sourceWorkspace The workspace the node is currently located @param Workspace $targetWorkspace The workspace the node is being published to
[ "Moves", "variants", "of", "a", "given", "node", "which", "exists", "in", "other", "workspaces", "than", "source", "and", "target", "workspace", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/Workspace.php#L518-L537
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/Workspace.php
Workspace.moveTargetNodeDataToNewPosition
protected function moveTargetNodeDataToNewPosition(NodeData $targetNodeData, $destinationPath) { if ($targetNodeData->getWorkspace()->getBaseWorkspace() === null) { $targetNodeData->setPath($destinationPath); return $targetNodeData; } return $targetNodeData->move($destinationPath, $targetNodeData->getWorkspace()); }
php
protected function moveTargetNodeDataToNewPosition(NodeData $targetNodeData, $destinationPath) { if ($targetNodeData->getWorkspace()->getBaseWorkspace() === null) { $targetNodeData->setPath($destinationPath); return $targetNodeData; } return $targetNodeData->move($destinationPath, $targetNodeData->getWorkspace()); }
[ "protected", "function", "moveTargetNodeDataToNewPosition", "(", "NodeData", "$", "targetNodeData", ",", "$", "destinationPath", ")", "{", "if", "(", "$", "targetNodeData", "->", "getWorkspace", "(", ")", "->", "getBaseWorkspace", "(", ")", "===", "null", ")", "...
Moves an existing node in a target workspace to the place it should be in after publish, in order to move all children to the new position as well. @param NodeData $targetNodeData The (publish-) target node data to be moved @param string $destinationPath The destination path of the move @return NodeData Either the same object like $targetNodeData, or, if $targetNodeData was transformed into a shadow node, the new target node (see move())
[ "Moves", "an", "existing", "node", "in", "a", "target", "workspace", "to", "the", "place", "it", "should", "be", "in", "after", "publish", "in", "order", "to", "move", "all", "children", "to", "the", "new", "position", "as", "well", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/Workspace.php#L547-L555
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/Workspace.php
Workspace.moveNodeVariantToTargetWorkspace
protected function moveNodeVariantToTargetWorkspace(NodeInterface $nodeToPublish, Workspace $targetWorkspace) { $nodeData = $nodeToPublish->getNodeData(); $this->adjustShadowNodeDataForNodePublishing($nodeData, $targetWorkspace, $nodeData); // Technically this shouldn't be needed but due to doctrines behavior we need it. if ($nodeData->isRemoved() && $targetWorkspace->getBaseWorkspace() === null) { $this->nodeDataRepository->remove($nodeData); return; } $nodeData->setMovedTo(null); $nodeData->setWorkspace($targetWorkspace); $nodeData->setLastPublicationDateTime($this->now); $nodeToPublish->setNodeDataIsMatchingContext(null); $this->nodeService->cleanUpProperties($nodeToPublish); }
php
protected function moveNodeVariantToTargetWorkspace(NodeInterface $nodeToPublish, Workspace $targetWorkspace) { $nodeData = $nodeToPublish->getNodeData(); $this->adjustShadowNodeDataForNodePublishing($nodeData, $targetWorkspace, $nodeData); // Technically this shouldn't be needed but due to doctrines behavior we need it. if ($nodeData->isRemoved() && $targetWorkspace->getBaseWorkspace() === null) { $this->nodeDataRepository->remove($nodeData); return; } $nodeData->setMovedTo(null); $nodeData->setWorkspace($targetWorkspace); $nodeData->setLastPublicationDateTime($this->now); $nodeToPublish->setNodeDataIsMatchingContext(null); $this->nodeService->cleanUpProperties($nodeToPublish); }
[ "protected", "function", "moveNodeVariantToTargetWorkspace", "(", "NodeInterface", "$", "nodeToPublish", ",", "Workspace", "$", "targetWorkspace", ")", "{", "$", "nodeData", "=", "$", "nodeToPublish", "->", "getNodeData", "(", ")", ";", "$", "this", "->", "adjustS...
Move the given node instance to the target workspace If no target node variant (having the same dimension values) exists in the target workspace, the node that is published will be re-used as a new node variant in the target workspace. @param NodeInterface $nodeToPublish The node to publish @param Workspace $targetWorkspace The workspace to publish to @return void
[ "Move", "the", "given", "node", "instance", "to", "the", "target", "workspace" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/Workspace.php#L567-L583
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/Workspace.php
Workspace.adjustShadowNodeDataForNodePublishing
protected function adjustShadowNodeDataForNodePublishing(NodeData $sourceNodeData, Workspace $targetWorkspace, NodeData $targetNodeData) { /** @var NodeData $sourceShadowNodeData */ $sourceShadowNodeData = $this->nodeDataRepository->findOneByMovedTo($sourceNodeData); if ($sourceShadowNodeData === null) { return; } // Technically this is not a shadow node if ($sourceShadowNodeData->isRemoved() === false) { return; } // There are no shadow nodes to be considered for a top-level base workspace: if ($targetWorkspace->getBaseWorkspace() === null) { $this->nodeDataRepository->remove($sourceShadowNodeData); return; } $nodeOnSamePathInTargetWorkspace = $this->nodeDataRepository->findOneByPath($sourceShadowNodeData->getPath(), $targetWorkspace, $sourceNodeData->getDimensionValues()); if ($nodeOnSamePathInTargetWorkspace !== null && $nodeOnSamePathInTargetWorkspace->getWorkspace() === $targetWorkspace) { $this->nodeDataRepository->remove($sourceShadowNodeData); return; } $targetWorkspaceBase = $targetWorkspace->getBaseWorkspace(); $nodeInTargetWorkspaceBase = $this->nodeDataRepository->findOneByIdentifier($sourceNodeData->getIdentifier(), $targetWorkspaceBase, $sourceNodeData->getDimensionValues()); if ($nodeInTargetWorkspaceBase !== null && $nodeInTargetWorkspaceBase->getPath() === $sourceNodeData->getPath()) { $this->nodeDataRepository->remove($sourceShadowNodeData); return; } // From now on $sourceShadowNodeData is published to the target workspace: $sourceShadowNodeData->setMovedTo($targetNodeData); $sourceShadowNodeData->setWorkspace($targetWorkspace); if ($nodeInTargetWorkspaceBase !== null && $nodeInTargetWorkspaceBase->getPath() !== $sourceShadowNodeData->getPath()) { $nodeOnSamePathInTargetWorkspace = $this->nodeDataRepository->findOneByPath($nodeInTargetWorkspaceBase->getPath(), $targetWorkspace, $sourceNodeData->getDimensionValues()); if ($nodeOnSamePathInTargetWorkspace === null || $nodeOnSamePathInTargetWorkspace->getWorkspace() !== $targetWorkspace) { $sourceShadowNodeData->setPath($nodeInTargetWorkspaceBase->getPath(), false); } else { // A node exists in that path, so no shadow node is needed/possible. $this->nodeDataRepository->remove($sourceShadowNodeData); } } // Check if a shadow node which has the same path, workspace and dimension values like the shadow node data we just created already exists (in the target workspace). // If it does, we re-use the existing node and make sure that all properties etc. are taken from the node which is being published. $existingShadowNodeDataInTargetWorkspace = $this->nodeDataRepository->findOneByPath($sourceShadowNodeData->getPath(), $targetWorkspace, $sourceShadowNodeData->getDimensionValues(), true); // findOneByPath() might return a node from a different workspace than the $targetWorkspace we specified, so we need to check that, too: if ($existingShadowNodeDataInTargetWorkspace !== null && $existingShadowNodeDataInTargetWorkspace->getWorkspace() === $targetWorkspace) { $existingShadowNodeDataInTargetWorkspace->similarize($sourceShadowNodeData); $existingShadowNodeDataInTargetWorkspace->setMovedTo($sourceShadowNodeData->getMovedTo()); $existingShadowNodeDataInTargetWorkspace->setRemoved($sourceShadowNodeData->isRemoved()); $this->nodeDataRepository->remove($sourceShadowNodeData); } }
php
protected function adjustShadowNodeDataForNodePublishing(NodeData $sourceNodeData, Workspace $targetWorkspace, NodeData $targetNodeData) { /** @var NodeData $sourceShadowNodeData */ $sourceShadowNodeData = $this->nodeDataRepository->findOneByMovedTo($sourceNodeData); if ($sourceShadowNodeData === null) { return; } // Technically this is not a shadow node if ($sourceShadowNodeData->isRemoved() === false) { return; } // There are no shadow nodes to be considered for a top-level base workspace: if ($targetWorkspace->getBaseWorkspace() === null) { $this->nodeDataRepository->remove($sourceShadowNodeData); return; } $nodeOnSamePathInTargetWorkspace = $this->nodeDataRepository->findOneByPath($sourceShadowNodeData->getPath(), $targetWorkspace, $sourceNodeData->getDimensionValues()); if ($nodeOnSamePathInTargetWorkspace !== null && $nodeOnSamePathInTargetWorkspace->getWorkspace() === $targetWorkspace) { $this->nodeDataRepository->remove($sourceShadowNodeData); return; } $targetWorkspaceBase = $targetWorkspace->getBaseWorkspace(); $nodeInTargetWorkspaceBase = $this->nodeDataRepository->findOneByIdentifier($sourceNodeData->getIdentifier(), $targetWorkspaceBase, $sourceNodeData->getDimensionValues()); if ($nodeInTargetWorkspaceBase !== null && $nodeInTargetWorkspaceBase->getPath() === $sourceNodeData->getPath()) { $this->nodeDataRepository->remove($sourceShadowNodeData); return; } // From now on $sourceShadowNodeData is published to the target workspace: $sourceShadowNodeData->setMovedTo($targetNodeData); $sourceShadowNodeData->setWorkspace($targetWorkspace); if ($nodeInTargetWorkspaceBase !== null && $nodeInTargetWorkspaceBase->getPath() !== $sourceShadowNodeData->getPath()) { $nodeOnSamePathInTargetWorkspace = $this->nodeDataRepository->findOneByPath($nodeInTargetWorkspaceBase->getPath(), $targetWorkspace, $sourceNodeData->getDimensionValues()); if ($nodeOnSamePathInTargetWorkspace === null || $nodeOnSamePathInTargetWorkspace->getWorkspace() !== $targetWorkspace) { $sourceShadowNodeData->setPath($nodeInTargetWorkspaceBase->getPath(), false); } else { // A node exists in that path, so no shadow node is needed/possible. $this->nodeDataRepository->remove($sourceShadowNodeData); } } // Check if a shadow node which has the same path, workspace and dimension values like the shadow node data we just created already exists (in the target workspace). // If it does, we re-use the existing node and make sure that all properties etc. are taken from the node which is being published. $existingShadowNodeDataInTargetWorkspace = $this->nodeDataRepository->findOneByPath($sourceShadowNodeData->getPath(), $targetWorkspace, $sourceShadowNodeData->getDimensionValues(), true); // findOneByPath() might return a node from a different workspace than the $targetWorkspace we specified, so we need to check that, too: if ($existingShadowNodeDataInTargetWorkspace !== null && $existingShadowNodeDataInTargetWorkspace->getWorkspace() === $targetWorkspace) { $existingShadowNodeDataInTargetWorkspace->similarize($sourceShadowNodeData); $existingShadowNodeDataInTargetWorkspace->setMovedTo($sourceShadowNodeData->getMovedTo()); $existingShadowNodeDataInTargetWorkspace->setRemoved($sourceShadowNodeData->isRemoved()); $this->nodeDataRepository->remove($sourceShadowNodeData); } }
[ "protected", "function", "adjustShadowNodeDataForNodePublishing", "(", "NodeData", "$", "sourceNodeData", ",", "Workspace", "$", "targetWorkspace", ",", "NodeData", "$", "targetNodeData", ")", "{", "/** @var NodeData $sourceShadowNodeData */", "$", "sourceShadowNodeData", "="...
Adjusts related shadow nodes for a "publish node" operation. This method will look for a shadow node of $sourceNodeData. That shadow node will either be adjusted or, if the target node in the given target workspace is marked as removed, remove it. @param NodeData $sourceNodeData Node Data of the node to publish @param Workspace $targetWorkspace Workspace the node is going to be published to @param NodeData $targetNodeData @return void
[ "Adjusts", "related", "shadow", "nodes", "for", "a", "publish", "node", "operation", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/Workspace.php#L596-L653
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/Workspace.php
Workspace.verifyPublishingTargetWorkspace
protected function verifyPublishingTargetWorkspace(Workspace $targetWorkspace) { $baseWorkspace = $this; while ($baseWorkspace === null || $targetWorkspace->getName() !== $baseWorkspace->getName()) { if ($baseWorkspace === null) { throw new WorkspaceException(sprintf('The specified workspace "%s" is not a base workspace of "%s".', $targetWorkspace->getName(), $this->getName()), 1289499117); } $baseWorkspace = $baseWorkspace->getBaseWorkspace(); } }
php
protected function verifyPublishingTargetWorkspace(Workspace $targetWorkspace) { $baseWorkspace = $this; while ($baseWorkspace === null || $targetWorkspace->getName() !== $baseWorkspace->getName()) { if ($baseWorkspace === null) { throw new WorkspaceException(sprintf('The specified workspace "%s" is not a base workspace of "%s".', $targetWorkspace->getName(), $this->getName()), 1289499117); } $baseWorkspace = $baseWorkspace->getBaseWorkspace(); } }
[ "protected", "function", "verifyPublishingTargetWorkspace", "(", "Workspace", "$", "targetWorkspace", ")", "{", "$", "baseWorkspace", "=", "$", "this", ";", "while", "(", "$", "baseWorkspace", "===", "null", "||", "$", "targetWorkspace", "->", "getName", "(", ")...
Checks if the specified workspace is a base workspace of this workspace and if not, throws an exception @param Workspace $targetWorkspace The publishing target workspace @return void @throws WorkspaceException if the specified workspace is not a base workspace of this workspace
[ "Checks", "if", "the", "specified", "workspace", "is", "a", "base", "workspace", "of", "this", "workspace", "and", "if", "not", "throws", "an", "exception" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/Workspace.php#L681-L690
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/Workspace.php
Workspace.findCorrespondingNodeDataInTargetWorkspace
protected function findCorrespondingNodeDataInTargetWorkspace(NodeInterface $node, Workspace $targetWorkspace) { $nodeData = $this->nodeDataRepository->findOneByIdentifier($node->getIdentifier(), $targetWorkspace, $node->getDimensions(), true); if ($nodeData === null || $nodeData->getWorkspace() !== $targetWorkspace) { return null; } return $nodeData; }
php
protected function findCorrespondingNodeDataInTargetWorkspace(NodeInterface $node, Workspace $targetWorkspace) { $nodeData = $this->nodeDataRepository->findOneByIdentifier($node->getIdentifier(), $targetWorkspace, $node->getDimensions(), true); if ($nodeData === null || $nodeData->getWorkspace() !== $targetWorkspace) { return null; } return $nodeData; }
[ "protected", "function", "findCorrespondingNodeDataInTargetWorkspace", "(", "NodeInterface", "$", "node", ",", "Workspace", "$", "targetWorkspace", ")", "{", "$", "nodeData", "=", "$", "this", "->", "nodeDataRepository", "->", "findOneByIdentifier", "(", "$", "node", ...
Returns the NodeData instance with the given identifier from the target workspace. If no NodeData instance is found in that target workspace, null is returned. @param NodeInterface $node The reference node to find a corresponding variant for @param Workspace $targetWorkspace The target workspace to look in @return NodeData Either a regular node, a shadow node or null
[ "Returns", "the", "NodeData", "instance", "with", "the", "given", "identifier", "from", "the", "target", "workspace", ".", "If", "no", "NodeData", "instance", "is", "found", "in", "that", "target", "workspace", "null", "is", "returned", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/Workspace.php#L700-L707
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/NodeTemplate.php
NodeTemplate.setIdentifier
public function setIdentifier($identifier) { if (preg_match(NodeIdentifierValidator::PATTERN_MATCH_NODE_IDENTIFIER, $identifier) !== 1) { throw new \InvalidArgumentException(sprintf('Invalid UUID "%s" given.', $identifier), 1385026112); } $this->identifier = $identifier; }
php
public function setIdentifier($identifier) { if (preg_match(NodeIdentifierValidator::PATTERN_MATCH_NODE_IDENTIFIER, $identifier) !== 1) { throw new \InvalidArgumentException(sprintf('Invalid UUID "%s" given.', $identifier), 1385026112); } $this->identifier = $identifier; }
[ "public", "function", "setIdentifier", "(", "$", "identifier", ")", "{", "if", "(", "preg_match", "(", "NodeIdentifierValidator", "::", "PATTERN_MATCH_NODE_IDENTIFIER", ",", "$", "identifier", ")", "!==", "1", ")", "{", "throw", "new", "\\", "InvalidArgumentExcept...
Allows to set a UUID to use for the node that will be created from this NodeTemplate. Use with care, usually identifier generation should be left to the ContentRepository. @param string $identifier @return void @throws \InvalidArgumentException
[ "Allows", "to", "set", "a", "UUID", "to", "use", "for", "the", "node", "that", "will", "be", "created", "from", "this", "NodeTemplate", ".", "Use", "with", "care", "usually", "identifier", "generation", "should", "be", "left", "to", "the", "ContentRepository...
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeTemplate.php#L47-L53
train
neos/neos-development-collection
Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php
ContentRepositoryIntegrationService.beforeNodeCreate
public function beforeNodeCreate() { if (!$this->eventEmittingService->isEnabled()) { return; } /* @var $nodeEvent NodeEvent */ $nodeEvent = $this->eventEmittingService->generate(self::NODE_ADDED, [], NodeEvent::class); $this->currentNodeAddEvents[] = $nodeEvent; $this->eventEmittingService->pushContext($nodeEvent); }
php
public function beforeNodeCreate() { if (!$this->eventEmittingService->isEnabled()) { return; } /* @var $nodeEvent NodeEvent */ $nodeEvent = $this->eventEmittingService->generate(self::NODE_ADDED, [], NodeEvent::class); $this->currentNodeAddEvents[] = $nodeEvent; $this->eventEmittingService->pushContext($nodeEvent); }
[ "public", "function", "beforeNodeCreate", "(", ")", "{", "if", "(", "!", "$", "this", "->", "eventEmittingService", "->", "isEnabled", "(", ")", ")", "{", "return", ";", "}", "/* @var $nodeEvent NodeEvent */", "$", "nodeEvent", "=", "$", "this", "->", "event...
Emit a "Node Added" event @return void
[ "Emit", "a", "Node", "Added", "event" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php#L96-L106
train
neos/neos-development-collection
Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php
ContentRepositoryIntegrationService.afterNodeCreate
public function afterNodeCreate(NodeInterface $node) { if (!$this->eventEmittingService->isEnabled()) { return; } /* @var $nodeEvent NodeEvent */ $nodeEvent = array_pop($this->currentNodeAddEvents); $nodeEvent->setNode($node); $this->eventEmittingService->popContext(); $this->eventEmittingService->add($nodeEvent); }
php
public function afterNodeCreate(NodeInterface $node) { if (!$this->eventEmittingService->isEnabled()) { return; } /* @var $nodeEvent NodeEvent */ $nodeEvent = array_pop($this->currentNodeAddEvents); $nodeEvent->setNode($node); $this->eventEmittingService->popContext(); $this->eventEmittingService->add($nodeEvent); }
[ "public", "function", "afterNodeCreate", "(", "NodeInterface", "$", "node", ")", "{", "if", "(", "!", "$", "this", "->", "eventEmittingService", "->", "isEnabled", "(", ")", ")", "{", "return", ";", "}", "/* @var $nodeEvent NodeEvent */", "$", "nodeEvent", "="...
Add the created node to the previously created "Added Node" event @param NodeInterface $node @return void
[ "Add", "the", "created", "node", "to", "the", "previously", "created", "Added", "Node", "event" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php#L114-L125
train
neos/neos-development-collection
Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php
ContentRepositoryIntegrationService.nodeUpdated
public function nodeUpdated(NodeInterface $node) { if (!$this->eventEmittingService->isEnabled()) { return; } if (!isset($this->changedNodes[$node->getContextPath()])) { $this->changedNodes[$node->getContextPath()] = ['node' => $node]; } }
php
public function nodeUpdated(NodeInterface $node) { if (!$this->eventEmittingService->isEnabled()) { return; } if (!isset($this->changedNodes[$node->getContextPath()])) { $this->changedNodes[$node->getContextPath()] = ['node' => $node]; } }
[ "public", "function", "nodeUpdated", "(", "NodeInterface", "$", "node", ")", "{", "if", "(", "!", "$", "this", "->", "eventEmittingService", "->", "isEnabled", "(", ")", ")", "{", "return", ";", "}", "if", "(", "!", "isset", "(", "$", "this", "->", "...
Emit a "Node Updated" event @param NodeInterface $node @return void
[ "Emit", "a", "Node", "Updated", "event" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php#L133-L142
train
neos/neos-development-collection
Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php
ContentRepositoryIntegrationService.beforeNodePropertyChange
public function beforeNodePropertyChange(NodeInterface $node, $propertyName, $oldValue, $value) { if (!$this->eventEmittingService->isEnabled()) { return; } if (count($this->currentNodeAddEvents) > 0) { // add is currently running, during that; we do not want any update events return; } if ($oldValue === $value) { return; } if (!isset($this->changedNodes[$node->getContextPath()])) { $this->changedNodes[$node->getContextPath()] = ['node' => $node]; } if (!isset($this->changedNodes[$node->getContextPath()]['oldLabel'])) { $this->changedNodes[$node->getContextPath()]['oldLabel'] = $node->getLabel(); } $this->changedNodes[$node->getContextPath()]['old'][$propertyName] = $oldValue; $this->changedNodes[$node->getContextPath()]['new'][$propertyName] = $value; }
php
public function beforeNodePropertyChange(NodeInterface $node, $propertyName, $oldValue, $value) { if (!$this->eventEmittingService->isEnabled()) { return; } if (count($this->currentNodeAddEvents) > 0) { // add is currently running, during that; we do not want any update events return; } if ($oldValue === $value) { return; } if (!isset($this->changedNodes[$node->getContextPath()])) { $this->changedNodes[$node->getContextPath()] = ['node' => $node]; } if (!isset($this->changedNodes[$node->getContextPath()]['oldLabel'])) { $this->changedNodes[$node->getContextPath()]['oldLabel'] = $node->getLabel(); } $this->changedNodes[$node->getContextPath()]['old'][$propertyName] = $oldValue; $this->changedNodes[$node->getContextPath()]['new'][$propertyName] = $value; }
[ "public", "function", "beforeNodePropertyChange", "(", "NodeInterface", "$", "node", ",", "$", "propertyName", ",", "$", "oldValue", ",", "$", "value", ")", "{", "if", "(", "!", "$", "this", "->", "eventEmittingService", "->", "isEnabled", "(", ")", ")", "...
Emit an event when node properties have been changed @param NodeInterface $node @param $propertyName @param $oldValue @param $value @return void
[ "Emit", "an", "event", "when", "node", "properties", "have", "been", "changed" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php#L153-L175
train
neos/neos-development-collection
Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php
ContentRepositoryIntegrationService.nodePropertyChanged
public function nodePropertyChanged(NodeInterface $node, $propertyName, $oldValue, $value) { if (!$this->eventEmittingService->isEnabled()) { return; } if ($oldValue === $value) { return; } $this->changedNodes[$node->getContextPath()]['newLabel'] = $node->getLabel(); $this->changedNodes[$node->getContextPath()]['node'] = $node; }
php
public function nodePropertyChanged(NodeInterface $node, $propertyName, $oldValue, $value) { if (!$this->eventEmittingService->isEnabled()) { return; } if ($oldValue === $value) { return; } $this->changedNodes[$node->getContextPath()]['newLabel'] = $node->getLabel(); $this->changedNodes[$node->getContextPath()]['node'] = $node; }
[ "public", "function", "nodePropertyChanged", "(", "NodeInterface", "$", "node", ",", "$", "propertyName", ",", "$", "oldValue", ",", "$", "value", ")", "{", "if", "(", "!", "$", "this", "->", "eventEmittingService", "->", "isEnabled", "(", ")", ")", "{", ...
Add the new label to a previously created node property changed event @param NodeInterface $node @param $propertyName @param $oldValue @param $value @return void
[ "Add", "the", "new", "label", "to", "a", "previously", "created", "node", "property", "changed", "event" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php#L186-L198
train
neos/neos-development-collection
Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php
ContentRepositoryIntegrationService.nodeRemoved
public function nodeRemoved(NodeInterface $node) { if (!$this->eventEmittingService->isEnabled()) { return; } /* @var $nodeEvent NodeEvent */ $nodeEvent = $this->eventEmittingService->emit(self::NODE_REMOVED, [], NodeEvent::class); $nodeEvent->setNode($node); }
php
public function nodeRemoved(NodeInterface $node) { if (!$this->eventEmittingService->isEnabled()) { return; } /* @var $nodeEvent NodeEvent */ $nodeEvent = $this->eventEmittingService->emit(self::NODE_REMOVED, [], NodeEvent::class); $nodeEvent->setNode($node); }
[ "public", "function", "nodeRemoved", "(", "NodeInterface", "$", "node", ")", "{", "if", "(", "!", "$", "this", "->", "eventEmittingService", "->", "isEnabled", "(", ")", ")", "{", "return", ";", "}", "/* @var $nodeEvent NodeEvent */", "$", "nodeEvent", "=", ...
Emits a "Node Removed" event @param NodeInterface $node @return void
[ "Emits", "a", "Node", "Removed", "event" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php#L206-L215
train
neos/neos-development-collection
Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php
ContentRepositoryIntegrationService.beforeNodeCopy
public function beforeNodeCopy(NodeInterface $sourceNode, NodeInterface $targetParentNode) { if (!$this->eventEmittingService->isEnabled()) { return; } if ($this->currentlyCopying) { throw new \Exception('TODO: already copying...'); } $this->currentlyCopying = true; /* @var $nodeEvent NodeEvent */ $nodeEvent = $this->eventEmittingService->emit(self::NODE_COPY, [ 'copiedInto' => $targetParentNode->getContextPath() ], NodeEvent::class); $nodeEvent->setNode($sourceNode); $this->eventEmittingService->pushContext(); }
php
public function beforeNodeCopy(NodeInterface $sourceNode, NodeInterface $targetParentNode) { if (!$this->eventEmittingService->isEnabled()) { return; } if ($this->currentlyCopying) { throw new \Exception('TODO: already copying...'); } $this->currentlyCopying = true; /* @var $nodeEvent NodeEvent */ $nodeEvent = $this->eventEmittingService->emit(self::NODE_COPY, [ 'copiedInto' => $targetParentNode->getContextPath() ], NodeEvent::class); $nodeEvent->setNode($sourceNode); $this->eventEmittingService->pushContext(); }
[ "public", "function", "beforeNodeCopy", "(", "NodeInterface", "$", "sourceNode", ",", "NodeInterface", "$", "targetParentNode", ")", "{", "if", "(", "!", "$", "this", "->", "eventEmittingService", "->", "isEnabled", "(", ")", ")", "{", "return", ";", "}", "i...
Emits a "Node Copy" event @param NodeInterface $sourceNode @param NodeInterface $targetParentNode @return void @throws \Exception
[ "Emits", "a", "Node", "Copy", "event" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php#L234-L252
train
neos/neos-development-collection
Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php
ContentRepositoryIntegrationService.beforeNodeMove
public function beforeNodeMove(NodeInterface $movedNode, NodeInterface $referenceNode, $moveOperation) { if (!$this->eventEmittingService->isEnabled()) { return; } $this->currentlyMoving += 1; /* @var $nodeEvent NodeEvent */ $nodeEvent = $this->eventEmittingService->emit(self::NODE_MOVE, [ 'referenceNode' => $referenceNode->getContextPath(), 'moveOperation' => $moveOperation ], NodeEvent::class); $nodeEvent->setNode($movedNode); $this->eventEmittingService->pushContext(); }
php
public function beforeNodeMove(NodeInterface $movedNode, NodeInterface $referenceNode, $moveOperation) { if (!$this->eventEmittingService->isEnabled()) { return; } $this->currentlyMoving += 1; /* @var $nodeEvent NodeEvent */ $nodeEvent = $this->eventEmittingService->emit(self::NODE_MOVE, [ 'referenceNode' => $referenceNode->getContextPath(), 'moveOperation' => $moveOperation ], NodeEvent::class); $nodeEvent->setNode($movedNode); $this->eventEmittingService->pushContext(); }
[ "public", "function", "beforeNodeMove", "(", "NodeInterface", "$", "movedNode", ",", "NodeInterface", "$", "referenceNode", ",", "$", "moveOperation", ")", "{", "if", "(", "!", "$", "this", "->", "eventEmittingService", "->", "isEnabled", "(", ")", ")", "{", ...
Emits a "Node Move" event @param NodeInterface $movedNode @param NodeInterface $referenceNode @param integer $moveOperation
[ "Emits", "a", "Node", "Move", "event" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php#L280-L295
train
neos/neos-development-collection
Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php
ContentRepositoryIntegrationService.beforeAdoptNode
public function beforeAdoptNode(NodeInterface $node, Context $context, $recursive) { if (!$this->eventEmittingService->isEnabled()) { return; } if ($this->currentlyAdopting === 0) { /* @var $nodeEvent NodeEvent */ $nodeEvent = $this->eventEmittingService->emit(self::NODE_ADOPT, [ 'targetWorkspace' => $context->getWorkspaceName(), 'targetDimensions' => $context->getTargetDimensions(), 'recursive' => $recursive ], NodeEvent::class); $nodeEvent->setNode($node); $this->eventEmittingService->pushContext(); } $this->currentlyAdopting++; }
php
public function beforeAdoptNode(NodeInterface $node, Context $context, $recursive) { if (!$this->eventEmittingService->isEnabled()) { return; } if ($this->currentlyAdopting === 0) { /* @var $nodeEvent NodeEvent */ $nodeEvent = $this->eventEmittingService->emit(self::NODE_ADOPT, [ 'targetWorkspace' => $context->getWorkspaceName(), 'targetDimensions' => $context->getTargetDimensions(), 'recursive' => $recursive ], NodeEvent::class); $nodeEvent->setNode($node); $this->eventEmittingService->pushContext(); } $this->currentlyAdopting++; }
[ "public", "function", "beforeAdoptNode", "(", "NodeInterface", "$", "node", ",", "Context", "$", "context", ",", "$", "recursive", ")", "{", "if", "(", "!", "$", "this", "->", "eventEmittingService", "->", "isEnabled", "(", ")", ")", "{", "return", ";", ...
Emits a "Node Adopt" event @param NodeInterface $node @param Context $context @param $recursive @return void
[ "Emits", "a", "Node", "Adopt", "event" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php#L326-L344
train
neos/neos-development-collection
Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php
ContentRepositoryIntegrationService.updateEventsAfterPublish
public function updateEventsAfterPublish() { if (!$this->eventEmittingService->isEnabled()) { return; } /** @var $entityManager EntityManager */ $entityManager = $this->entityManager; foreach ($this->scheduledNodeEventUpdates as $documentPublish) { /* @var $nodeEvent NodeEvent */ $nodeEvent = $this->eventEmittingService->emit(self::DOCUMENT_PUBLISHED, [], NodeEvent::class); $nodeEvent->setNode($documentPublish['documentNode']); $nodeEvent->setWorkspaceName($documentPublish['targetWorkspace']); $this->persistenceManager->whitelistObject($nodeEvent); $this->persistenceManager->persistAll(true); $parentEventIdentifier = $this->persistenceManager->getIdentifierByObject($nodeEvent); $qb = $entityManager->createQueryBuilder(); $qb->update(NodeEvent::class, 'e') ->set('e.parentEvent', ':parentEventIdentifier') ->setParameter('parentEventIdentifier', $parentEventIdentifier) ->where('e.parentEvent IS NULL') ->andWhere('e.workspaceName = :workspaceName') ->setParameter('workspaceName', $documentPublish['workspaceName']) ->andWhere('e.documentNodeIdentifier = :documentNodeIdentifier') ->setParameter('documentNodeIdentifier', $documentPublish['documentNode']->getIdentifier()) ->andWhere('e.eventType != :publishedEventType') ->setParameter('publishedEventType', self::DOCUMENT_PUBLISHED) ->getQuery()->execute(); } $this->scheduledNodeEventUpdates = []; }
php
public function updateEventsAfterPublish() { if (!$this->eventEmittingService->isEnabled()) { return; } /** @var $entityManager EntityManager */ $entityManager = $this->entityManager; foreach ($this->scheduledNodeEventUpdates as $documentPublish) { /* @var $nodeEvent NodeEvent */ $nodeEvent = $this->eventEmittingService->emit(self::DOCUMENT_PUBLISHED, [], NodeEvent::class); $nodeEvent->setNode($documentPublish['documentNode']); $nodeEvent->setWorkspaceName($documentPublish['targetWorkspace']); $this->persistenceManager->whitelistObject($nodeEvent); $this->persistenceManager->persistAll(true); $parentEventIdentifier = $this->persistenceManager->getIdentifierByObject($nodeEvent); $qb = $entityManager->createQueryBuilder(); $qb->update(NodeEvent::class, 'e') ->set('e.parentEvent', ':parentEventIdentifier') ->setParameter('parentEventIdentifier', $parentEventIdentifier) ->where('e.parentEvent IS NULL') ->andWhere('e.workspaceName = :workspaceName') ->setParameter('workspaceName', $documentPublish['workspaceName']) ->andWhere('e.documentNodeIdentifier = :documentNodeIdentifier') ->setParameter('documentNodeIdentifier', $documentPublish['documentNode']->getIdentifier()) ->andWhere('e.eventType != :publishedEventType') ->setParameter('publishedEventType', self::DOCUMENT_PUBLISHED) ->getQuery()->execute(); } $this->scheduledNodeEventUpdates = []; }
[ "public", "function", "updateEventsAfterPublish", "(", ")", "{", "if", "(", "!", "$", "this", "->", "eventEmittingService", "->", "isEnabled", "(", ")", ")", "{", "return", ";", "}", "/** @var $entityManager EntityManager */", "$", "entityManager", "=", "$", "th...
Binds events to a Node.Published event for each document node published @return void
[ "Binds", "events", "to", "a", "Node", ".", "Published", "event", "for", "each", "document", "node", "published" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/EventLog/Integrations/ContentRepositoryIntegrationService.php#L432-L466
train
neos/neos-development-collection
Neos.Neos/Classes/Routing/FrontendNodeRoutePartHandler.php
FrontendNodeRoutePartHandler.findValueToMatch
protected function findValueToMatch($requestPath) { if ($this->splitString !== '') { $splitStringPosition = strpos($requestPath, $this->splitString); if ($splitStringPosition !== false) { return substr($requestPath, 0, $splitStringPosition); } } return $requestPath; }
php
protected function findValueToMatch($requestPath) { if ($this->splitString !== '') { $splitStringPosition = strpos($requestPath, $this->splitString); if ($splitStringPosition !== false) { return substr($requestPath, 0, $splitStringPosition); } } return $requestPath; }
[ "protected", "function", "findValueToMatch", "(", "$", "requestPath", ")", "{", "if", "(", "$", "this", "->", "splitString", "!==", "''", ")", "{", "$", "splitStringPosition", "=", "strpos", "(", "$", "requestPath", ",", "$", "this", "->", "splitString", "...
Extracts the node path from the request path. @param string $requestPath The request path to be matched @return string value to match, or an empty string if $requestPath is empty or split string was not found
[ "Extracts", "the", "node", "path", "from", "the", "request", "path", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Routing/FrontendNodeRoutePartHandler.php#L93-L103
train
neos/neos-development-collection
Neos.Neos/Classes/Routing/FrontendNodeRoutePartHandler.php
FrontendNodeRoutePartHandler.buildContextFromRequestPath
protected function buildContextFromRequestPath(&$requestPath) { $workspaceName = 'live'; $dimensionsAndDimensionValues = $this->parseDimensionsAndNodePathFromRequestPath($requestPath); // This is a workaround as NodePaths::explodeContextPath() (correctly) // expects a context path to have something before the '@', but the requestPath // could potentially contain only the context information. if (strpos($requestPath, '@') === 0) { $requestPath = '/' . $requestPath; } if ($requestPath !== '' && NodePaths::isContextPath($requestPath)) { try { $nodePathAndContext = NodePaths::explodeContextPath($requestPath); $workspaceName = $nodePathAndContext['workspaceName']; } catch (\InvalidArgumentException $exception) { } } return $this->buildContextFromWorkspaceNameAndDimensions($workspaceName, $dimensionsAndDimensionValues); }
php
protected function buildContextFromRequestPath(&$requestPath) { $workspaceName = 'live'; $dimensionsAndDimensionValues = $this->parseDimensionsAndNodePathFromRequestPath($requestPath); // This is a workaround as NodePaths::explodeContextPath() (correctly) // expects a context path to have something before the '@', but the requestPath // could potentially contain only the context information. if (strpos($requestPath, '@') === 0) { $requestPath = '/' . $requestPath; } if ($requestPath !== '' && NodePaths::isContextPath($requestPath)) { try { $nodePathAndContext = NodePaths::explodeContextPath($requestPath); $workspaceName = $nodePathAndContext['workspaceName']; } catch (\InvalidArgumentException $exception) { } } return $this->buildContextFromWorkspaceNameAndDimensions($workspaceName, $dimensionsAndDimensionValues); }
[ "protected", "function", "buildContextFromRequestPath", "(", "&", "$", "requestPath", ")", "{", "$", "workspaceName", "=", "'live'", ";", "$", "dimensionsAndDimensionValues", "=", "$", "this", "->", "parseDimensionsAndNodePathFromRequestPath", "(", "$", "requestPath", ...
Creates a content context from the given request path, considering possibly mentioned content dimension values. @param string &$requestPath The request path. If at least one content dimension is configured, the first path segment will identify the content dimension values @return ContentContext The built content context
[ "Creates", "a", "content", "context", "from", "the", "given", "request", "path", "considering", "possibly", "mentioned", "content", "dimension", "values", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Routing/FrontendNodeRoutePartHandler.php#L254-L274
train
neos/neos-development-collection
Neos.Neos/Classes/Routing/FrontendNodeRoutePartHandler.php
FrontendNodeRoutePartHandler.resolveRoutePathForNode
protected function resolveRoutePathForNode(NodeInterface $node) { $workspaceName = $node->getContext()->getWorkspaceName(); $nodeContextPath = $node->getContextPath(); $nodeContextPathSuffix = ($workspaceName !== 'live') ? substr($nodeContextPath, strpos($nodeContextPath, '@')) : ''; $currentNodeIsSiteNode = ($node->getParentPath() === SiteService::SITES_ROOT_PATH); $dimensionsUriSegment = $this->getUriSegmentForDimensions($node->getContext()->getDimensions(), $currentNodeIsSiteNode); $requestPath = $this->getRequestPathByNode($node); return trim($dimensionsUriSegment . $requestPath, '/') . $nodeContextPathSuffix; }
php
protected function resolveRoutePathForNode(NodeInterface $node) { $workspaceName = $node->getContext()->getWorkspaceName(); $nodeContextPath = $node->getContextPath(); $nodeContextPathSuffix = ($workspaceName !== 'live') ? substr($nodeContextPath, strpos($nodeContextPath, '@')) : ''; $currentNodeIsSiteNode = ($node->getParentPath() === SiteService::SITES_ROOT_PATH); $dimensionsUriSegment = $this->getUriSegmentForDimensions($node->getContext()->getDimensions(), $currentNodeIsSiteNode); $requestPath = $this->getRequestPathByNode($node); return trim($dimensionsUriSegment . $requestPath, '/') . $nodeContextPathSuffix; }
[ "protected", "function", "resolveRoutePathForNode", "(", "NodeInterface", "$", "node", ")", "{", "$", "workspaceName", "=", "$", "node", "->", "getContext", "(", ")", "->", "getWorkspaceName", "(", ")", ";", "$", "nodeContextPath", "=", "$", "node", "->", "g...
Resolves the request path, also known as route path, identifying the given node. A path is built, based on the uri path segment properties of the parents of and the given node itself. If content dimensions are configured, the first path segment will the identifiers of the dimension values according to the current context. @param NodeInterface $node The node where the generated path should lead to @return string The relative route path, possibly prefixed with a segment for identifying the current content dimension values
[ "Resolves", "the", "request", "path", "also", "known", "as", "route", "path", "identifying", "the", "given", "node", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Routing/FrontendNodeRoutePartHandler.php#L358-L370
train
neos/neos-development-collection
Neos.Neos/Classes/Routing/FrontendNodeRoutePartHandler.php
FrontendNodeRoutePartHandler.getRelativeNodePathByUriPathSegmentProperties
protected function getRelativeNodePathByUriPathSegmentProperties(NodeInterface $siteNode, $relativeRequestPath) { $relativeNodePathSegments = []; $node = $siteNode; foreach (explode('/', $relativeRequestPath) as $pathSegment) { $foundNodeInThisSegment = false; foreach ($node->getChildNodes('Neos.Neos:Document') as $node) { /** @var NodeInterface $node */ if ($node->getProperty('uriPathSegment') === $pathSegment) { $relativeNodePathSegments[] = $node->getName(); $foundNodeInThisSegment = true; break; } } if (!$foundNodeInThisSegment) { return false; } } return implode('/', $relativeNodePathSegments); }
php
protected function getRelativeNodePathByUriPathSegmentProperties(NodeInterface $siteNode, $relativeRequestPath) { $relativeNodePathSegments = []; $node = $siteNode; foreach (explode('/', $relativeRequestPath) as $pathSegment) { $foundNodeInThisSegment = false; foreach ($node->getChildNodes('Neos.Neos:Document') as $node) { /** @var NodeInterface $node */ if ($node->getProperty('uriPathSegment') === $pathSegment) { $relativeNodePathSegments[] = $node->getName(); $foundNodeInThisSegment = true; break; } } if (!$foundNodeInThisSegment) { return false; } } return implode('/', $relativeNodePathSegments); }
[ "protected", "function", "getRelativeNodePathByUriPathSegmentProperties", "(", "NodeInterface", "$", "siteNode", ",", "$", "relativeRequestPath", ")", "{", "$", "relativeNodePathSegments", "=", "[", "]", ";", "$", "node", "=", "$", "siteNode", ";", "foreach", "(", ...
Builds a node path which matches the given request path. This method traverses the segments of the given request path and tries to find nodes on the current level which have a matching "uriPathSegment" property. If no node could be found which would match the given request path, false is returned. @param NodeInterface $siteNode The site node, used as a starting point while traversing the tree @param string $relativeRequestPath The request path, relative to the site's root path @throws \Neos\Neos\Routing\Exception\NoSuchNodeException @return string
[ "Builds", "a", "node", "path", "which", "matches", "the", "given", "request", "path", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Routing/FrontendNodeRoutePartHandler.php#L384-L405
train
neos/neos-development-collection
Neos.Neos/Classes/Routing/FrontendNodeRoutePartHandler.php
FrontendNodeRoutePartHandler.getRequestPathByNode
protected function getRequestPathByNode(NodeInterface $node) { if ($node->getParentPath() === SiteService::SITES_ROOT_PATH) { return ''; } // To allow building of paths to non-hidden nodes beneath hidden nodes, we assume // the input node is allowed to be seen and we must generate the full path here. // To disallow showing a node actually hidden itself has to be ensured in matching // a request path, not in building one. $contextProperties = $node->getContext()->getProperties(); $contextAllowingHiddenNodes = $this->contextFactory->create(array_merge($contextProperties, ['invisibleContentShown' => true])); $currentNode = $contextAllowingHiddenNodes->getNodeByIdentifier($node->getIdentifier()); $requestPathSegments = []; while ($currentNode instanceof NodeInterface && $currentNode->getParentPath() !== SiteService::SITES_ROOT_PATH) { if (!$currentNode->hasProperty('uriPathSegment')) { throw new Exception\MissingNodePropertyException(sprintf('Missing "uriPathSegment" property for node "%s". Nodes can be migrated with the "flow node:repair" command.', $node->getPath()), 1415020326); } $pathSegment = $currentNode->getProperty('uriPathSegment'); $requestPathSegments[] = $pathSegment; $currentNode = $currentNode->getParent(); } return implode('/', array_reverse($requestPathSegments)); }
php
protected function getRequestPathByNode(NodeInterface $node) { if ($node->getParentPath() === SiteService::SITES_ROOT_PATH) { return ''; } // To allow building of paths to non-hidden nodes beneath hidden nodes, we assume // the input node is allowed to be seen and we must generate the full path here. // To disallow showing a node actually hidden itself has to be ensured in matching // a request path, not in building one. $contextProperties = $node->getContext()->getProperties(); $contextAllowingHiddenNodes = $this->contextFactory->create(array_merge($contextProperties, ['invisibleContentShown' => true])); $currentNode = $contextAllowingHiddenNodes->getNodeByIdentifier($node->getIdentifier()); $requestPathSegments = []; while ($currentNode instanceof NodeInterface && $currentNode->getParentPath() !== SiteService::SITES_ROOT_PATH) { if (!$currentNode->hasProperty('uriPathSegment')) { throw new Exception\MissingNodePropertyException(sprintf('Missing "uriPathSegment" property for node "%s". Nodes can be migrated with the "flow node:repair" command.', $node->getPath()), 1415020326); } $pathSegment = $currentNode->getProperty('uriPathSegment'); $requestPathSegments[] = $pathSegment; $currentNode = $currentNode->getParent(); } return implode('/', array_reverse($requestPathSegments)); }
[ "protected", "function", "getRequestPathByNode", "(", "NodeInterface", "$", "node", ")", "{", "if", "(", "$", "node", "->", "getParentPath", "(", ")", "===", "SiteService", "::", "SITES_ROOT_PATH", ")", "{", "return", "''", ";", "}", "// To allow building of pat...
Renders a request path based on the "uriPathSegment" properties of the nodes leading to the given node. @param NodeInterface $node The node where the generated path should lead to @return string A relative request path @throws Exception\MissingNodePropertyException if the given node doesn't have a "uriPathSegment" property set
[ "Renders", "a", "request", "path", "based", "on", "the", "uriPathSegment", "properties", "of", "the", "nodes", "leading", "to", "the", "given", "node", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Routing/FrontendNodeRoutePartHandler.php#L414-L440
train
neos/neos-development-collection
Neos.Neos/Classes/Routing/FrontendNodeRoutePartHandler.php
FrontendNodeRoutePartHandler.parseDimensionsAndNodePathFromRequestPath
protected function parseDimensionsAndNodePathFromRequestPath(&$requestPath) { if ($this->supportEmptySegmentForDimensions) { $dimensionsAndDimensionValues = $this->parseDimensionsAndNodePathFromRequestPathAllowingEmptySegment($requestPath); } else { $dimensionsAndDimensionValues = $this->parseDimensionsAndNodePathFromRequestPathAllowingNonUniqueSegment($requestPath); } return $dimensionsAndDimensionValues; }
php
protected function parseDimensionsAndNodePathFromRequestPath(&$requestPath) { if ($this->supportEmptySegmentForDimensions) { $dimensionsAndDimensionValues = $this->parseDimensionsAndNodePathFromRequestPathAllowingEmptySegment($requestPath); } else { $dimensionsAndDimensionValues = $this->parseDimensionsAndNodePathFromRequestPathAllowingNonUniqueSegment($requestPath); } return $dimensionsAndDimensionValues; }
[ "protected", "function", "parseDimensionsAndNodePathFromRequestPath", "(", "&", "$", "requestPath", ")", "{", "if", "(", "$", "this", "->", "supportEmptySegmentForDimensions", ")", "{", "$", "dimensionsAndDimensionValues", "=", "$", "this", "->", "parseDimensionsAndNode...
Choose between default method for parsing dimensions or the one which allows uriSegment to be empty for default preset. @param string &$requestPath The request path currently being processed by this route part handler, e.g. "de_global/startseite/ueber-uns" @return array An array of dimension name => dimension values (array of string)
[ "Choose", "between", "default", "method", "for", "parsing", "dimensions", "or", "the", "one", "which", "allows", "uriSegment", "to", "be", "empty", "for", "default", "preset", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Routing/FrontendNodeRoutePartHandler.php#L448-L456
train
neos/neos-development-collection
Neos.Neos/Classes/Routing/FrontendNodeRoutePartHandler.php
FrontendNodeRoutePartHandler.parseDimensionsAndNodePathFromRequestPathAllowingEmptySegment
protected function parseDimensionsAndNodePathFromRequestPathAllowingEmptySegment(&$requestPath) { $dimensionPresets = $this->contentDimensionPresetSource->getAllPresets(); if (count($dimensionPresets) === 0) { return []; } $dimensionsAndDimensionValues = []; $chosenDimensionPresets = []; $matches = []; preg_match(self::DIMENSION_REQUEST_PATH_MATCHER, $requestPath, $matches); $firstUriPartIsValidDimension = true; foreach ($dimensionPresets as $dimensionName => $dimensionPreset) { $dimensionsAndDimensionValues[$dimensionName] = $dimensionPreset['presets'][$dimensionPreset['defaultPreset']]['values']; $chosenDimensionPresets[$dimensionName] = $dimensionPreset['defaultPreset']; } if (isset($matches['firstUriPart'])) { $firstUriPartExploded = explode('_', $matches['firstUriPart']); foreach ($firstUriPartExploded as $uriSegment) { $uriSegmentIsValid = false; foreach ($dimensionPresets as $dimensionName => $dimensionPreset) { $preset = $this->contentDimensionPresetSource->findPresetByUriSegment($dimensionName, $uriSegment); if ($preset !== null) { $uriSegmentIsValid = true; $dimensionsAndDimensionValues[$dimensionName] = $preset['values']; $chosenDimensionPresets[$dimensionName] = $preset['identifier']; break; } } if (!$uriSegmentIsValid) { $firstUriPartIsValidDimension = false; break; } } if ($firstUriPartIsValidDimension) { $requestPath = (isset($matches['remainingRequestPath']) ? $matches['remainingRequestPath'] : ''); } } if (!$this->contentDimensionPresetSource->isPresetCombinationAllowedByConstraints($chosenDimensionPresets)) { throw new InvalidDimensionPresetCombinationException(sprintf('The resolved content dimension preset combination (%s) is invalid or restricted by content dimension constraints. Check your content dimension settings if you think that this is an error.', implode(', ', array_keys($chosenDimensionPresets))), 1428657721); } return $dimensionsAndDimensionValues; }
php
protected function parseDimensionsAndNodePathFromRequestPathAllowingEmptySegment(&$requestPath) { $dimensionPresets = $this->contentDimensionPresetSource->getAllPresets(); if (count($dimensionPresets) === 0) { return []; } $dimensionsAndDimensionValues = []; $chosenDimensionPresets = []; $matches = []; preg_match(self::DIMENSION_REQUEST_PATH_MATCHER, $requestPath, $matches); $firstUriPartIsValidDimension = true; foreach ($dimensionPresets as $dimensionName => $dimensionPreset) { $dimensionsAndDimensionValues[$dimensionName] = $dimensionPreset['presets'][$dimensionPreset['defaultPreset']]['values']; $chosenDimensionPresets[$dimensionName] = $dimensionPreset['defaultPreset']; } if (isset($matches['firstUriPart'])) { $firstUriPartExploded = explode('_', $matches['firstUriPart']); foreach ($firstUriPartExploded as $uriSegment) { $uriSegmentIsValid = false; foreach ($dimensionPresets as $dimensionName => $dimensionPreset) { $preset = $this->contentDimensionPresetSource->findPresetByUriSegment($dimensionName, $uriSegment); if ($preset !== null) { $uriSegmentIsValid = true; $dimensionsAndDimensionValues[$dimensionName] = $preset['values']; $chosenDimensionPresets[$dimensionName] = $preset['identifier']; break; } } if (!$uriSegmentIsValid) { $firstUriPartIsValidDimension = false; break; } } if ($firstUriPartIsValidDimension) { $requestPath = (isset($matches['remainingRequestPath']) ? $matches['remainingRequestPath'] : ''); } } if (!$this->contentDimensionPresetSource->isPresetCombinationAllowedByConstraints($chosenDimensionPresets)) { throw new InvalidDimensionPresetCombinationException(sprintf('The resolved content dimension preset combination (%s) is invalid or restricted by content dimension constraints. Check your content dimension settings if you think that this is an error.', implode(', ', array_keys($chosenDimensionPresets))), 1428657721); } return $dimensionsAndDimensionValues; }
[ "protected", "function", "parseDimensionsAndNodePathFromRequestPathAllowingEmptySegment", "(", "&", "$", "requestPath", ")", "{", "$", "dimensionPresets", "=", "$", "this", "->", "contentDimensionPresetSource", "->", "getAllPresets", "(", ")", ";", "if", "(", "count", ...
Parses the given request path and checks if the first path segment is one or a set of content dimension preset identifiers. If that is the case, the return value is an array of dimension names and their preset URI segments. Allows uriSegment to be empty for default dimension preset. If the first path segment contained content dimension information, it is removed from &$requestPath. @param string &$requestPath The request path currently being processed by this route part handler, e.g. "de_global/startseite/ueber-uns" @return array An array of dimension name => dimension values (array of string) @throws InvalidDimensionPresetCombinationException
[ "Parses", "the", "given", "request", "path", "and", "checks", "if", "the", "first", "path", "segment", "is", "one", "or", "a", "set", "of", "content", "dimension", "preset", "identifiers", ".", "If", "that", "is", "the", "case", "the", "return", "value", ...
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Routing/FrontendNodeRoutePartHandler.php#L469-L510
train
neos/neos-development-collection
Neos.Neos/Classes/Routing/FrontendNodeRoutePartHandler.php
FrontendNodeRoutePartHandler.parseDimensionsAndNodePathFromRequestPathAllowingNonUniqueSegment
protected function parseDimensionsAndNodePathFromRequestPathAllowingNonUniqueSegment(&$requestPath) { $dimensionPresets = $this->contentDimensionPresetSource->getAllPresets(); if (count($dimensionPresets) === 0) { return []; } $dimensionsAndDimensionValues = []; $chosenDimensionPresets = []; $matches = []; preg_match(self::DIMENSION_REQUEST_PATH_MATCHER, $requestPath, $matches); if (!isset($matches['firstUriPart'])) { foreach ($dimensionPresets as $dimensionName => $dimensionPreset) { $dimensionsAndDimensionValues[$dimensionName] = $dimensionPreset['presets'][$dimensionPreset['defaultPreset']]['values']; $chosenDimensionPresets[$dimensionName] = $dimensionPreset['defaultPreset']; } } else { $firstUriPart = explode('_', $matches['firstUriPart']); if (count($firstUriPart) !== count($dimensionPresets)) { throw new InvalidRequestPathException(sprintf('The first path segment of the request URI (%s) does not contain the necessary content dimension preset identifiers for all configured dimensions. This might be an old URI which doesn\'t match the current dimension configuration anymore.', $requestPath), 1413389121); } foreach ($dimensionPresets as $dimensionName => $dimensionPreset) { $uriSegment = array_shift($firstUriPart); $preset = $this->contentDimensionPresetSource->findPresetByUriSegment($dimensionName, $uriSegment); if ($preset === null) { throw new NoSuchDimensionValueException(sprintf('Could not find a preset for content dimension "%s" through the given URI segment "%s".', $dimensionName, $uriSegment), 1413389321); } $dimensionsAndDimensionValues[$dimensionName] = $preset['values']; $chosenDimensionPresets[$dimensionName] = $preset['identifier']; } $requestPath = (isset($matches['remainingRequestPath']) ? $matches['remainingRequestPath'] : ''); } if (!$this->contentDimensionPresetSource->isPresetCombinationAllowedByConstraints($chosenDimensionPresets)) { throw new InvalidDimensionPresetCombinationException(sprintf('The resolved content dimension preset combination (%s) is invalid or restricted by content dimension constraints. Check your content dimension settings if you think that this is an error.', implode(', ', array_keys($chosenDimensionPresets))), 1462175794); } return $dimensionsAndDimensionValues; }
php
protected function parseDimensionsAndNodePathFromRequestPathAllowingNonUniqueSegment(&$requestPath) { $dimensionPresets = $this->contentDimensionPresetSource->getAllPresets(); if (count($dimensionPresets) === 0) { return []; } $dimensionsAndDimensionValues = []; $chosenDimensionPresets = []; $matches = []; preg_match(self::DIMENSION_REQUEST_PATH_MATCHER, $requestPath, $matches); if (!isset($matches['firstUriPart'])) { foreach ($dimensionPresets as $dimensionName => $dimensionPreset) { $dimensionsAndDimensionValues[$dimensionName] = $dimensionPreset['presets'][$dimensionPreset['defaultPreset']]['values']; $chosenDimensionPresets[$dimensionName] = $dimensionPreset['defaultPreset']; } } else { $firstUriPart = explode('_', $matches['firstUriPart']); if (count($firstUriPart) !== count($dimensionPresets)) { throw new InvalidRequestPathException(sprintf('The first path segment of the request URI (%s) does not contain the necessary content dimension preset identifiers for all configured dimensions. This might be an old URI which doesn\'t match the current dimension configuration anymore.', $requestPath), 1413389121); } foreach ($dimensionPresets as $dimensionName => $dimensionPreset) { $uriSegment = array_shift($firstUriPart); $preset = $this->contentDimensionPresetSource->findPresetByUriSegment($dimensionName, $uriSegment); if ($preset === null) { throw new NoSuchDimensionValueException(sprintf('Could not find a preset for content dimension "%s" through the given URI segment "%s".', $dimensionName, $uriSegment), 1413389321); } $dimensionsAndDimensionValues[$dimensionName] = $preset['values']; $chosenDimensionPresets[$dimensionName] = $preset['identifier']; } $requestPath = (isset($matches['remainingRequestPath']) ? $matches['remainingRequestPath'] : ''); } if (!$this->contentDimensionPresetSource->isPresetCombinationAllowedByConstraints($chosenDimensionPresets)) { throw new InvalidDimensionPresetCombinationException(sprintf('The resolved content dimension preset combination (%s) is invalid or restricted by content dimension constraints. Check your content dimension settings if you think that this is an error.', implode(', ', array_keys($chosenDimensionPresets))), 1462175794); } return $dimensionsAndDimensionValues; }
[ "protected", "function", "parseDimensionsAndNodePathFromRequestPathAllowingNonUniqueSegment", "(", "&", "$", "requestPath", ")", "{", "$", "dimensionPresets", "=", "$", "this", "->", "contentDimensionPresetSource", "->", "getAllPresets", "(", ")", ";", "if", "(", "count...
Parses the given request path and checks if the first path segment is one or a set of content dimension preset identifiers. If that is the case, the return value is an array of dimension names and their preset URI segments. Doesn't allow empty uriSegment, but allows uriSegment to be not unique across presets. If the first path segment contained content dimension information, it is removed from &$requestPath. @param string &$requestPath The request path currently being processed by this route part handler, e.g. "de_global/startseite/ueber-uns" @return array An array of dimension name => dimension values (array of string) @throws InvalidDimensionPresetCombinationException @throws InvalidRequestPathException @throws NoSuchDimensionValueException
[ "Parses", "the", "given", "request", "path", "and", "checks", "if", "the", "first", "path", "segment", "is", "one", "or", "a", "set", "of", "content", "dimension", "preset", "identifiers", ".", "If", "that", "is", "the", "case", "the", "return", "value", ...
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Routing/FrontendNodeRoutePartHandler.php#L525-L568
train
neos/neos-development-collection
Neos.Neos/Classes/Routing/FrontendNodeRoutePartHandler.php
FrontendNodeRoutePartHandler.getUriSegmentForDimensions
protected function getUriSegmentForDimensions(array $dimensionsValues, $currentNodeIsSiteNode) { $uriSegment = ''; $allDimensionPresetsAreDefault = true; foreach ($this->contentDimensionPresetSource->getAllPresets() as $dimensionName => $dimensionPresets) { $preset = null; if (isset($dimensionsValues[$dimensionName])) { $preset = $this->contentDimensionPresetSource->findPresetByDimensionValues($dimensionName, $dimensionsValues[$dimensionName]); } $defaultPreset = $this->contentDimensionPresetSource->getDefaultPreset($dimensionName); if ($preset === null) { $preset = $defaultPreset; } if ($preset !== $defaultPreset) { $allDimensionPresetsAreDefault = false; } if (!isset($preset['uriSegment'])) { throw new \Exception(sprintf('No "uriSegment" configured for content dimension preset "%s" for dimension "%s". Please check the content dimension configuration in Settings.yaml', $preset['identifier'], $dimensionName), 1395824520); } $uriSegment .= $preset['uriSegment'] . '_'; } if ($this->supportEmptySegmentForDimensions && $allDimensionPresetsAreDefault && $currentNodeIsSiteNode) { return '/'; } else { return ltrim(trim($uriSegment, '_') . '/', '/'); } }
php
protected function getUriSegmentForDimensions(array $dimensionsValues, $currentNodeIsSiteNode) { $uriSegment = ''; $allDimensionPresetsAreDefault = true; foreach ($this->contentDimensionPresetSource->getAllPresets() as $dimensionName => $dimensionPresets) { $preset = null; if (isset($dimensionsValues[$dimensionName])) { $preset = $this->contentDimensionPresetSource->findPresetByDimensionValues($dimensionName, $dimensionsValues[$dimensionName]); } $defaultPreset = $this->contentDimensionPresetSource->getDefaultPreset($dimensionName); if ($preset === null) { $preset = $defaultPreset; } if ($preset !== $defaultPreset) { $allDimensionPresetsAreDefault = false; } if (!isset($preset['uriSegment'])) { throw new \Exception(sprintf('No "uriSegment" configured for content dimension preset "%s" for dimension "%s". Please check the content dimension configuration in Settings.yaml', $preset['identifier'], $dimensionName), 1395824520); } $uriSegment .= $preset['uriSegment'] . '_'; } if ($this->supportEmptySegmentForDimensions && $allDimensionPresetsAreDefault && $currentNodeIsSiteNode) { return '/'; } else { return ltrim(trim($uriSegment, '_') . '/', '/'); } }
[ "protected", "function", "getUriSegmentForDimensions", "(", "array", "$", "dimensionsValues", ",", "$", "currentNodeIsSiteNode", ")", "{", "$", "uriSegment", "=", "''", ";", "$", "allDimensionPresetsAreDefault", "=", "true", ";", "foreach", "(", "$", "this", "->",...
Find a URI segment in the content dimension presets for the given "language" dimension values This will do a reverse lookup from actual dimension values to a preset and fall back to the default preset if none can be found. @param array $dimensionsValues An array of dimensions and their values, indexed by dimension name @param boolean $currentNodeIsSiteNode If the current node is actually the site node @return string @throws \Exception
[ "Find", "a", "URI", "segment", "in", "the", "content", "dimension", "presets", "for", "the", "given", "language", "dimension", "values" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Routing/FrontendNodeRoutePartHandler.php#L601-L629
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserInterfaceModeService.php
UserInterfaceModeService.findModeByName
public function findModeByName($modeName) { if (isset($this->editPreviewModes[$modeName])) { if ($this->editPreviewModes[$modeName] instanceof UserInterfaceMode) { $mode = $this->editPreviewModes[$modeName]; } elseif (is_array($this->editPreviewModes[$modeName])) { $mode = UserInterfaceMode::createByConfiguration($modeName, $this->editPreviewModes[$modeName]); $this->editPreviewModes[$modeName] = $mode; } else { throw new Exception('The requested interface render mode "' . $modeName . '" is not configured correctly. Please make sure it is fully configured.', 1427716331); } } else { throw new Exception('The requested interface render mode "' . $modeName . '" is not configured. Please make sure it exists as key in the Settings path "Neos.Neos.Interface.editPreviewModes".', 1427715962); } return $mode; }
php
public function findModeByName($modeName) { if (isset($this->editPreviewModes[$modeName])) { if ($this->editPreviewModes[$modeName] instanceof UserInterfaceMode) { $mode = $this->editPreviewModes[$modeName]; } elseif (is_array($this->editPreviewModes[$modeName])) { $mode = UserInterfaceMode::createByConfiguration($modeName, $this->editPreviewModes[$modeName]); $this->editPreviewModes[$modeName] = $mode; } else { throw new Exception('The requested interface render mode "' . $modeName . '" is not configured correctly. Please make sure it is fully configured.', 1427716331); } } else { throw new Exception('The requested interface render mode "' . $modeName . '" is not configured. Please make sure it exists as key in the Settings path "Neos.Neos.Interface.editPreviewModes".', 1427715962); } return $mode; }
[ "public", "function", "findModeByName", "(", "$", "modeName", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "editPreviewModes", "[", "$", "modeName", "]", ")", ")", "{", "if", "(", "$", "this", "->", "editPreviewModes", "[", "$", "modeName", "]...
Finds an rendering mode by name. @param string $modeName @return UserInterfaceMode @throws Exception
[ "Finds", "an", "rendering", "mode", "by", "name", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserInterfaceModeService.php#L92-L108
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Service/Utility/NodePublishingDependencySolver.php
NodePublishingDependencySolver.sort
public function sort(array $nodes) { $this->buildNodeDependencies($nodes); $sortedNodes = $this->resolveDependencies(); $dependencyCount = array_filter($this->dependenciesOutgoing, function ($a) { return $a !== []; }); if (count($dependencyCount) > 0) { throw new WorkspaceException('Cannot publish a list of nodes because of cycles', 1416484223); } return $sortedNodes; }
php
public function sort(array $nodes) { $this->buildNodeDependencies($nodes); $sortedNodes = $this->resolveDependencies(); $dependencyCount = array_filter($this->dependenciesOutgoing, function ($a) { return $a !== []; }); if (count($dependencyCount) > 0) { throw new WorkspaceException('Cannot publish a list of nodes because of cycles', 1416484223); } return $sortedNodes; }
[ "public", "function", "sort", "(", "array", "$", "nodes", ")", "{", "$", "this", "->", "buildNodeDependencies", "(", "$", "nodes", ")", ";", "$", "sortedNodes", "=", "$", "this", "->", "resolveDependencies", "(", ")", ";", "$", "dependencyCount", "=", "a...
Sort nodes by an order suitable for publishing This makes sure all parent and moved-to relations are resolved and changes that need to be published before other changes will be published first. Uses topological sorting of node dependencies (http://en.wikipedia.org/wiki/Topological_sorting) to build a publishable order of nodes. @param array $nodes Array of nodes to sort, if dependencies are missing in this list an exception will be thrown @return array Array of nodes sorted by dependencies for publishing @throws WorkspaceException
[ "Sort", "nodes", "by", "an", "order", "suitable", "for", "publishing" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Service/Utility/NodePublishingDependencySolver.php#L59-L72
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Service/Utility/NodePublishingDependencySolver.php
NodePublishingDependencySolver.buildNodeDependencies
protected function buildNodeDependencies(array $nodes) { $this->nodesByPath = []; $this->nodesByNodeData = []; $this->dependenciesOutgoing = []; $this->dependenciesIncoming = []; $this->nodesWithoutIncoming = []; /** @var Node $node */ foreach ($nodes as $node) { $this->nodesByPath[$node->getPath()][] = $node; $this->nodesByNodeData[spl_object_hash($node->getNodeData())] = $node; $this->nodesWithoutIncoming[spl_object_hash($node)] = $node; } /** @var Node $node */ foreach ($nodes as $node) { $nodeHash = spl_object_hash($node); // Add dependencies for (direct) parents, this will also cover moved and created nodes if (isset($this->nodesByPath[$node->getParentPath()])) { /** @var Node $parentNode */ foreach ($this->nodesByPath[$node->getParentPath()] as $parentNode) { $dependencyHash = spl_object_hash($parentNode); $this->dependenciesIncoming[$nodeHash][$dependencyHash] = $parentNode; $this->dependenciesOutgoing[$dependencyHash][$nodeHash] = $node; unset($this->nodesWithoutIncoming[$nodeHash]); } } // Add a dependency for a moved-to reference $movedToNodeData = $node->getNodeData()->getMovedTo(); if ($movedToNodeData !== null) { $movedToHash = spl_object_hash($movedToNodeData); if (!isset($this->nodesByNodeData[$movedToHash])) { throw new WorkspaceException('Cannot publish a list of nodes with missing dependency (' . $node->getPath() . ' needs ' . $movedToNodeData->getPath() . ' to be published)', 1416483470); } $dependencyHash = spl_object_hash($this->nodesByNodeData[$movedToHash]); $this->dependenciesIncoming[$nodeHash][$dependencyHash] = $this->nodesByNodeData[$movedToHash]; $this->dependenciesOutgoing[$dependencyHash][$nodeHash] = $node; unset($this->nodesWithoutIncoming[$nodeHash]); } } }
php
protected function buildNodeDependencies(array $nodes) { $this->nodesByPath = []; $this->nodesByNodeData = []; $this->dependenciesOutgoing = []; $this->dependenciesIncoming = []; $this->nodesWithoutIncoming = []; /** @var Node $node */ foreach ($nodes as $node) { $this->nodesByPath[$node->getPath()][] = $node; $this->nodesByNodeData[spl_object_hash($node->getNodeData())] = $node; $this->nodesWithoutIncoming[spl_object_hash($node)] = $node; } /** @var Node $node */ foreach ($nodes as $node) { $nodeHash = spl_object_hash($node); // Add dependencies for (direct) parents, this will also cover moved and created nodes if (isset($this->nodesByPath[$node->getParentPath()])) { /** @var Node $parentNode */ foreach ($this->nodesByPath[$node->getParentPath()] as $parentNode) { $dependencyHash = spl_object_hash($parentNode); $this->dependenciesIncoming[$nodeHash][$dependencyHash] = $parentNode; $this->dependenciesOutgoing[$dependencyHash][$nodeHash] = $node; unset($this->nodesWithoutIncoming[$nodeHash]); } } // Add a dependency for a moved-to reference $movedToNodeData = $node->getNodeData()->getMovedTo(); if ($movedToNodeData !== null) { $movedToHash = spl_object_hash($movedToNodeData); if (!isset($this->nodesByNodeData[$movedToHash])) { throw new WorkspaceException('Cannot publish a list of nodes with missing dependency (' . $node->getPath() . ' needs ' . $movedToNodeData->getPath() . ' to be published)', 1416483470); } $dependencyHash = spl_object_hash($this->nodesByNodeData[$movedToHash]); $this->dependenciesIncoming[$nodeHash][$dependencyHash] = $this->nodesByNodeData[$movedToHash]; $this->dependenciesOutgoing[$dependencyHash][$nodeHash] = $node; unset($this->nodesWithoutIncoming[$nodeHash]); } } }
[ "protected", "function", "buildNodeDependencies", "(", "array", "$", "nodes", ")", "{", "$", "this", "->", "nodesByPath", "=", "[", "]", ";", "$", "this", "->", "nodesByNodeData", "=", "[", "]", ";", "$", "this", "->", "dependenciesOutgoing", "=", "[", "...
Prepare dependencies for the given list of nodes @param array $nodes Unsorted list of nodes @throws WorkspaceException
[ "Prepare", "dependencies", "for", "the", "given", "list", "of", "nodes" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Service/Utility/NodePublishingDependencySolver.php#L80-L123
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Service/Utility/NodePublishingDependencySolver.php
NodePublishingDependencySolver.resolveDependencies
protected function resolveDependencies() { $sortedNodes = []; while (count($this->nodesWithoutIncoming) > 0) { $node = array_pop($this->nodesWithoutIncoming); $sortedNodes[] = $node; $nodeHash = spl_object_hash($node); if (isset($this->dependenciesOutgoing[$nodeHash])) { foreach ($this->dependenciesOutgoing[$nodeHash] as $dependencyHash => $dependencyNode) { unset($this->dependenciesOutgoing[$nodeHash][$dependencyHash]); unset($this->dependenciesIncoming[$dependencyHash][$nodeHash]); if (count($this->dependenciesIncoming[$dependencyHash]) === 0) { $this->nodesWithoutIncoming[$dependencyHash] = $dependencyNode; } } } } return $sortedNodes; }
php
protected function resolveDependencies() { $sortedNodes = []; while (count($this->nodesWithoutIncoming) > 0) { $node = array_pop($this->nodesWithoutIncoming); $sortedNodes[] = $node; $nodeHash = spl_object_hash($node); if (isset($this->dependenciesOutgoing[$nodeHash])) { foreach ($this->dependenciesOutgoing[$nodeHash] as $dependencyHash => $dependencyNode) { unset($this->dependenciesOutgoing[$nodeHash][$dependencyHash]); unset($this->dependenciesIncoming[$dependencyHash][$nodeHash]); if (count($this->dependenciesIncoming[$dependencyHash]) === 0) { $this->nodesWithoutIncoming[$dependencyHash] = $dependencyNode; } } } } return $sortedNodes; }
[ "protected", "function", "resolveDependencies", "(", ")", "{", "$", "sortedNodes", "=", "[", "]", ";", "while", "(", "count", "(", "$", "this", "->", "nodesWithoutIncoming", ")", ">", "0", ")", "{", "$", "node", "=", "array_pop", "(", "$", "this", "->"...
Resolve node dependencies 1. Pick a node from the set of nodes without incoming dependencies 2. For all dependencies of that node: 2a. Remove the dependency 2b. If the dependency has no other incoming dependencies itself, add it to the set of nodes without incoming dependencies @return array Sorted list of nodes (not all dependencies might be solved)
[ "Resolve", "node", "dependencies" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Service/Utility/NodePublishingDependencySolver.php#L135-L154
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Repository/AssetRepository.php
AssetRepository.findBySearchTermOrTags
public function findBySearchTermOrTags($searchTerm, array $tags = [], AssetCollection $assetCollection = null) { $query = $this->createQuery(); $constraints = [ $query->like('title', '%' . $searchTerm . '%'), $query->like('resource.filename', '%' . $searchTerm . '%'), $query->like('caption', '%' . $searchTerm . '%') ]; foreach ($tags as $tag) { $constraints[] = $query->contains('tags', $tag); } $query->matching($query->logicalOr($constraints)); $this->addImageVariantFilterClause($query); $this->addAssetCollectionToQueryConstraints($query, $assetCollection); return $query->execute(); }
php
public function findBySearchTermOrTags($searchTerm, array $tags = [], AssetCollection $assetCollection = null) { $query = $this->createQuery(); $constraints = [ $query->like('title', '%' . $searchTerm . '%'), $query->like('resource.filename', '%' . $searchTerm . '%'), $query->like('caption', '%' . $searchTerm . '%') ]; foreach ($tags as $tag) { $constraints[] = $query->contains('tags', $tag); } $query->matching($query->logicalOr($constraints)); $this->addImageVariantFilterClause($query); $this->addAssetCollectionToQueryConstraints($query, $assetCollection); return $query->execute(); }
[ "public", "function", "findBySearchTermOrTags", "(", "$", "searchTerm", ",", "array", "$", "tags", "=", "[", "]", ",", "AssetCollection", "$", "assetCollection", "=", "null", ")", "{", "$", "query", "=", "$", "this", "->", "createQuery", "(", ")", ";", "...
Find assets by title or given tags @param string $searchTerm @param array $tags @param AssetCollection $assetCollection @return QueryResultInterface @throws InvalidQueryException
[ "Find", "assets", "by", "title", "or", "given", "tags" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Repository/AssetRepository.php#L65-L81
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Repository/AssetRepository.php
AssetRepository.findByTag
public function findByTag(Tag $tag, AssetCollection $assetCollection = null) { $query = $this->createQuery(); $query->matching($query->contains('tags', $tag)); $this->addImageVariantFilterClause($query); $this->addAssetCollectionToQueryConstraints($query, $assetCollection); return $query->execute(); }
php
public function findByTag(Tag $tag, AssetCollection $assetCollection = null) { $query = $this->createQuery(); $query->matching($query->contains('tags', $tag)); $this->addImageVariantFilterClause($query); $this->addAssetCollectionToQueryConstraints($query, $assetCollection); return $query->execute(); }
[ "public", "function", "findByTag", "(", "Tag", "$", "tag", ",", "AssetCollection", "$", "assetCollection", "=", "null", ")", "{", "$", "query", "=", "$", "this", "->", "createQuery", "(", ")", ";", "$", "query", "->", "matching", "(", "$", "query", "->...
Find Assets with the given Tag assigned @param Tag $tag @param AssetCollection $assetCollection @return QueryResultInterface @throws InvalidQueryException
[ "Find", "Assets", "with", "the", "given", "Tag", "assigned" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Repository/AssetRepository.php#L91-L98
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Repository/AssetRepository.php
AssetRepository.countByTag
public function countByTag(Tag $tag, AssetCollection $assetCollection = null) { $rsm = new ResultSetMapping(); $rsm->addScalarResult('c', 'c'); if ($assetCollection === null) { $queryString = "SELECT count(a.persistence_object_identifier) c FROM neos_media_domain_model_asset a LEFT JOIN neos_media_domain_model_asset_tags_join tagmm ON a.persistence_object_identifier = tagmm.media_asset WHERE tagmm.media_tag = ? AND a.dtype != 'neos_media_imagevariant'"; } else { $queryString = "SELECT count(a.persistence_object_identifier) c FROM neos_media_domain_model_asset a LEFT JOIN neos_media_domain_model_asset_tags_join tagmm ON a.persistence_object_identifier = tagmm.media_asset LEFT JOIN neos_media_domain_model_assetcollection_assets_join collectionmm ON a.persistence_object_identifier = collectionmm.media_asset WHERE tagmm.media_tag = ? AND collectionmm.media_assetcollection = ? AND a.dtype != 'neos_media_imagevariant'"; } $query = $this->entityManager->createNativeQuery($queryString, $rsm); $query->setParameter(1, $tag); if ($assetCollection !== null) { $query->setParameter(2, $assetCollection); } try { return $query->getSingleScalarResult(); } catch (NonUniqueResultException $e) { return 0; } }
php
public function countByTag(Tag $tag, AssetCollection $assetCollection = null) { $rsm = new ResultSetMapping(); $rsm->addScalarResult('c', 'c'); if ($assetCollection === null) { $queryString = "SELECT count(a.persistence_object_identifier) c FROM neos_media_domain_model_asset a LEFT JOIN neos_media_domain_model_asset_tags_join tagmm ON a.persistence_object_identifier = tagmm.media_asset WHERE tagmm.media_tag = ? AND a.dtype != 'neos_media_imagevariant'"; } else { $queryString = "SELECT count(a.persistence_object_identifier) c FROM neos_media_domain_model_asset a LEFT JOIN neos_media_domain_model_asset_tags_join tagmm ON a.persistence_object_identifier = tagmm.media_asset LEFT JOIN neos_media_domain_model_assetcollection_assets_join collectionmm ON a.persistence_object_identifier = collectionmm.media_asset WHERE tagmm.media_tag = ? AND collectionmm.media_assetcollection = ? AND a.dtype != 'neos_media_imagevariant'"; } $query = $this->entityManager->createNativeQuery($queryString, $rsm); $query->setParameter(1, $tag); if ($assetCollection !== null) { $query->setParameter(2, $assetCollection); } try { return $query->getSingleScalarResult(); } catch (NonUniqueResultException $e) { return 0; } }
[ "public", "function", "countByTag", "(", "Tag", "$", "tag", ",", "AssetCollection", "$", "assetCollection", "=", "null", ")", "{", "$", "rsm", "=", "new", "ResultSetMapping", "(", ")", ";", "$", "rsm", "->", "addScalarResult", "(", "'c'", ",", "'c'", ")"...
Counts Assets with the given Tag assigned @param Tag $tag @param AssetCollection $assetCollection @return integer
[ "Counts", "Assets", "with", "the", "given", "Tag", "assigned" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Repository/AssetRepository.php#L107-L128
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Repository/AssetRepository.php
AssetRepository.findUntagged
public function findUntagged(AssetCollection $assetCollection = null) { $query = $this->createQuery(); $query->matching($query->isEmpty('tags')); $this->addImageVariantFilterClause($query); $this->addAssetCollectionToQueryConstraints($query, $assetCollection); return $query->execute(); }
php
public function findUntagged(AssetCollection $assetCollection = null) { $query = $this->createQuery(); $query->matching($query->isEmpty('tags')); $this->addImageVariantFilterClause($query); $this->addAssetCollectionToQueryConstraints($query, $assetCollection); return $query->execute(); }
[ "public", "function", "findUntagged", "(", "AssetCollection", "$", "assetCollection", "=", "null", ")", "{", "$", "query", "=", "$", "this", "->", "createQuery", "(", ")", ";", "$", "query", "->", "matching", "(", "$", "query", "->", "isEmpty", "(", "'ta...
Find Assets without any tag @param AssetCollection $assetCollection @return QueryResultInterface @throws InvalidQueryException
[ "Find", "Assets", "without", "any", "tag" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Repository/AssetRepository.php#L164-L171
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Repository/AssetRepository.php
AssetRepository.countUntagged
public function countUntagged(AssetCollection $assetCollection = null) { $rsm = new ResultSetMapping(); $rsm->addScalarResult('c', 'c'); if ($assetCollection === null) { $queryString = "SELECT count(a.persistence_object_identifier) c FROM neos_media_domain_model_asset a LEFT JOIN neos_media_domain_model_asset_tags_join tagmm ON a.persistence_object_identifier = tagmm.media_asset WHERE tagmm.media_asset IS NULL AND a.dtype != 'neos_media_imagevariant'"; } else { $queryString = "SELECT count(a.persistence_object_identifier) c FROM neos_media_domain_model_asset a LEFT JOIN neos_media_domain_model_asset_tags_join tagmm ON a.persistence_object_identifier = tagmm.media_asset LEFT JOIN neos_media_domain_model_assetcollection_assets_join collectionmm ON a.persistence_object_identifier = collectionmm.media_asset WHERE tagmm.media_asset IS NULL AND collectionmm.media_assetcollection = ? AND a.dtype != 'neos_media_imagevariant'"; } $query = $this->entityManager->createNativeQuery($queryString, $rsm); if ($assetCollection !== null) { $query->setParameter(1, $assetCollection); } return $query->getSingleScalarResult(); }
php
public function countUntagged(AssetCollection $assetCollection = null) { $rsm = new ResultSetMapping(); $rsm->addScalarResult('c', 'c'); if ($assetCollection === null) { $queryString = "SELECT count(a.persistence_object_identifier) c FROM neos_media_domain_model_asset a LEFT JOIN neos_media_domain_model_asset_tags_join tagmm ON a.persistence_object_identifier = tagmm.media_asset WHERE tagmm.media_asset IS NULL AND a.dtype != 'neos_media_imagevariant'"; } else { $queryString = "SELECT count(a.persistence_object_identifier) c FROM neos_media_domain_model_asset a LEFT JOIN neos_media_domain_model_asset_tags_join tagmm ON a.persistence_object_identifier = tagmm.media_asset LEFT JOIN neos_media_domain_model_assetcollection_assets_join collectionmm ON a.persistence_object_identifier = collectionmm.media_asset WHERE tagmm.media_asset IS NULL AND collectionmm.media_assetcollection = ? AND a.dtype != 'neos_media_imagevariant'"; } $query = $this->entityManager->createNativeQuery($queryString, $rsm); if ($assetCollection !== null) { $query->setParameter(1, $assetCollection); } return $query->getSingleScalarResult(); }
[ "public", "function", "countUntagged", "(", "AssetCollection", "$", "assetCollection", "=", "null", ")", "{", "$", "rsm", "=", "new", "ResultSetMapping", "(", ")", ";", "$", "rsm", "->", "addScalarResult", "(", "'c'", ",", "'c'", ")", ";", "if", "(", "$"...
Counts Assets without any tag @param AssetCollection $assetCollection @return integer @throws NonUniqueResultException
[ "Counts", "Assets", "without", "any", "tag" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Repository/AssetRepository.php#L180-L196
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Repository/AssetRepository.php
AssetRepository.countByAssetCollection
public function countByAssetCollection(AssetCollection $assetCollection) { $rsm = new ResultSetMapping(); $rsm->addScalarResult('c', 'c'); $queryString = "SELECT count(a.persistence_object_identifier) c FROM neos_media_domain_model_asset a LEFT JOIN neos_media_domain_model_assetcollection_assets_join collectionmm ON a.persistence_object_identifier = collectionmm.media_asset WHERE collectionmm.media_assetcollection = ? AND a.dtype != 'neos_media_imagevariant'"; $query = $this->entityManager->createNativeQuery($queryString, $rsm); $query->setParameter(1, $assetCollection); try { return $query->getSingleScalarResult(); } catch (NonUniqueResultException $e) { return 0; } }
php
public function countByAssetCollection(AssetCollection $assetCollection) { $rsm = new ResultSetMapping(); $rsm->addScalarResult('c', 'c'); $queryString = "SELECT count(a.persistence_object_identifier) c FROM neos_media_domain_model_asset a LEFT JOIN neos_media_domain_model_assetcollection_assets_join collectionmm ON a.persistence_object_identifier = collectionmm.media_asset WHERE collectionmm.media_assetcollection = ? AND a.dtype != 'neos_media_imagevariant'"; $query = $this->entityManager->createNativeQuery($queryString, $rsm); $query->setParameter(1, $assetCollection); try { return $query->getSingleScalarResult(); } catch (NonUniqueResultException $e) { return 0; } }
[ "public", "function", "countByAssetCollection", "(", "AssetCollection", "$", "assetCollection", ")", "{", "$", "rsm", "=", "new", "ResultSetMapping", "(", ")", ";", "$", "rsm", "->", "addScalarResult", "(", "'c'", ",", "'c'", ")", ";", "$", "queryString", "=...
Count assets by asset collection @param AssetCollection $assetCollection @return integer
[ "Count", "assets", "by", "asset", "collection" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Repository/AssetRepository.php#L217-L231
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Repository/AssetRepository.php
AssetRepository.remove
public function remove($object) { $this->assetService->validateRemoval($object); parent::remove($object); $this->assetService->emitAssetRemoved($object); }
php
public function remove($object) { $this->assetService->validateRemoval($object); parent::remove($object); $this->assetService->emitAssetRemoved($object); }
[ "public", "function", "remove", "(", "$", "object", ")", "{", "$", "this", "->", "assetService", "->", "validateRemoval", "(", "$", "object", ")", ";", "parent", "::", "remove", "(", "$", "object", ")", ";", "$", "this", "->", "assetService", "->", "em...
Remove an asset while first validating if the object can be removed or if removal is blocked because the asset is still in use. @param AssetInterface $object @return void @throws IllegalObjectTypeException @throws AssetServiceException
[ "Remove", "an", "asset", "while", "first", "validating", "if", "the", "object", "can", "be", "removed", "or", "if", "removal", "is", "blocked", "because", "the", "asset", "is", "still", "in", "use", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Repository/AssetRepository.php#L319-L324
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/SiteImportService.php
SiteImportService.importFromPackage
public function importFromPackage($packageKey) { if (!$this->packageManager->isPackageAvailable($packageKey)) { throw new NeosException(sprintf('Error: Package "%s" is not active.', $packageKey), 1384192950); } $contentPathAndFilename = sprintf('resource://%s/Private/Content/Sites.xml', $packageKey); if (!file_exists($contentPathAndFilename)) { throw new NeosException(sprintf('Error: No content found in package "%s".', $packageKey), 1384192955); } try { return $this->importFromFile($contentPathAndFilename); } catch (\Exception $exception) { throw new NeosException(sprintf('Error: During import an exception occurred: "%s".', $exception->getMessage()), 1300360480, $exception); } }
php
public function importFromPackage($packageKey) { if (!$this->packageManager->isPackageAvailable($packageKey)) { throw new NeosException(sprintf('Error: Package "%s" is not active.', $packageKey), 1384192950); } $contentPathAndFilename = sprintf('resource://%s/Private/Content/Sites.xml', $packageKey); if (!file_exists($contentPathAndFilename)) { throw new NeosException(sprintf('Error: No content found in package "%s".', $packageKey), 1384192955); } try { return $this->importFromFile($contentPathAndFilename); } catch (\Exception $exception) { throw new NeosException(sprintf('Error: During import an exception occurred: "%s".', $exception->getMessage()), 1300360480, $exception); } }
[ "public", "function", "importFromPackage", "(", "$", "packageKey", ")", "{", "if", "(", "!", "$", "this", "->", "packageManager", "->", "isPackageAvailable", "(", "$", "packageKey", ")", ")", "{", "throw", "new", "NeosException", "(", "sprintf", "(", "'Error...
Checks for the presence of Sites.xml in the given package and imports it if found. @param string $packageKey @return Site the imported site @throws NeosException
[ "Checks", "for", "the", "presence", "of", "Sites", ".", "xml", "in", "the", "given", "package", "and", "imports", "it", "if", "found", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/SiteImportService.php#L142-L156
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php
NodeDataRepository.add
public function add($object) { if ($this->removedNodes->contains($object)) { $this->removedNodes->detach($object); } if (!$this->addedNodes->contains($object)) { $this->addedNodes->attach($object); } parent::add($object); }
php
public function add($object) { if ($this->removedNodes->contains($object)) { $this->removedNodes->detach($object); } if (!$this->addedNodes->contains($object)) { $this->addedNodes->attach($object); } parent::add($object); }
[ "public", "function", "add", "(", "$", "object", ")", "{", "if", "(", "$", "this", "->", "removedNodes", "->", "contains", "(", "$", "object", ")", ")", "{", "$", "this", "->", "removedNodes", "->", "detach", "(", "$", "object", ")", ";", "}", "if"...
Adds a NodeData object to this repository. This repository keeps track of added and removed nodes (additionally to the other Unit of Work) in order to find in-memory nodes. @param object $object The object to add @return void @api
[ "Adds", "a", "NodeData", "object", "to", "this", "repository", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php#L136-L145
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php
NodeDataRepository.findOneByPath
public function findOneByPath($path, Workspace $workspace, array $dimensions = null, $removedNodes = false) { if ($path === '/') { return $workspace->getRootNodeData(); } $workspaces = $this->collectWorkspaceAndAllBaseWorkspaces($workspace); $nodes = $this->findRawNodesByPath($path, $workspace, $dimensions); $dimensions = $dimensions === null ? [] : $dimensions; $foundNodes = $this->reduceNodeVariantsByWorkspacesAndDimensions($nodes, $workspaces, $dimensions); $foundNodes = $this->filterNodeDataByBestMatchInContext($foundNodes, $workspace, $dimensions, $removedNodes); if ($removedNodes === true) { $foundNodes = $this->onlyRemovedNodes($foundNodes); } elseif ($removedNodes === false) { $foundNodes = $this->withoutRemovedNodes($foundNodes); } if ($foundNodes !== []) { return reset($foundNodes); } return null; }
php
public function findOneByPath($path, Workspace $workspace, array $dimensions = null, $removedNodes = false) { if ($path === '/') { return $workspace->getRootNodeData(); } $workspaces = $this->collectWorkspaceAndAllBaseWorkspaces($workspace); $nodes = $this->findRawNodesByPath($path, $workspace, $dimensions); $dimensions = $dimensions === null ? [] : $dimensions; $foundNodes = $this->reduceNodeVariantsByWorkspacesAndDimensions($nodes, $workspaces, $dimensions); $foundNodes = $this->filterNodeDataByBestMatchInContext($foundNodes, $workspace, $dimensions, $removedNodes); if ($removedNodes === true) { $foundNodes = $this->onlyRemovedNodes($foundNodes); } elseif ($removedNodes === false) { $foundNodes = $this->withoutRemovedNodes($foundNodes); } if ($foundNodes !== []) { return reset($foundNodes); } return null; }
[ "public", "function", "findOneByPath", "(", "$", "path", ",", "Workspace", "$", "workspace", ",", "array", "$", "dimensions", "=", "null", ",", "$", "removedNodes", "=", "false", ")", "{", "if", "(", "$", "path", "===", "'/'", ")", "{", "return", "$", ...
Find a single node by exact path. @param string $path Absolute path of the node @param Workspace $workspace The containing workspace @param array $dimensions An array of dimensions with array of ordered values to use for fallback matching @param boolean|NULL $removedNodes Include removed nodes, NULL (all), false (no removed nodes) or true (only removed nodes) @throws \InvalidArgumentException @return NodeData The matching node if found, otherwise NULL
[ "Find", "a", "single", "node", "by", "exact", "path", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php#L187-L210
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php
NodeDataRepository.findShadowNodeByPath
public function findShadowNodeByPath($path, Workspace $workspace, array $dimensions = null) { $workspaces = $this->collectWorkspaceAndAllBaseWorkspaces($workspace); $nodes = $this->findRawNodesByPath($path, $workspace, $dimensions, true); $dimensions = $dimensions === null ? [] : $dimensions; $foundNodes = $this->reduceNodeVariantsByWorkspacesAndDimensions($nodes, $workspaces, $dimensions); $foundNodes = $this->onlyRemovedNodes($foundNodes); if ($foundNodes !== []) { return reset($foundNodes); } return null; }
php
public function findShadowNodeByPath($path, Workspace $workspace, array $dimensions = null) { $workspaces = $this->collectWorkspaceAndAllBaseWorkspaces($workspace); $nodes = $this->findRawNodesByPath($path, $workspace, $dimensions, true); $dimensions = $dimensions === null ? [] : $dimensions; $foundNodes = $this->reduceNodeVariantsByWorkspacesAndDimensions($nodes, $workspaces, $dimensions); $foundNodes = $this->onlyRemovedNodes($foundNodes); if ($foundNodes !== []) { return reset($foundNodes); } return null; }
[ "public", "function", "findShadowNodeByPath", "(", "$", "path", ",", "Workspace", "$", "workspace", ",", "array", "$", "dimensions", "=", "null", ")", "{", "$", "workspaces", "=", "$", "this", "->", "collectWorkspaceAndAllBaseWorkspaces", "(", "$", "workspace", ...
Find a shadow node by exact path @param string $path @param Workspace $workspace @param array|null $dimensions @return NodeData|null
[ "Find", "a", "shadow", "node", "by", "exact", "path" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php#L220-L233
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php
NodeDataRepository.findRawNodesByPath
protected function findRawNodesByPath($path, Workspace $workspace, array $dimensions = null, $onlyShadowNodes = false) { $path = strtolower($path); if ($path === '' || ($path !== '/' && ($path[0] !== '/' || substr($path, -1, 1) === '/'))) { throw new \InvalidArgumentException('"' . $path . '" is not a valid path: must start but not end with a slash.', 1284985489); } if ($path === '/') { return [$workspace->getRootNodeData()]; } $addedNodes = []; $workspaces = []; while ($workspace !== null) { /** @var $node NodeData */ foreach ($this->addedNodes as $node) { if (($node->getPath() === $path && $node->matchesWorkspaceAndDimensions($workspace, $dimensions)) && ($onlyShadowNodes === false || $node->isInternal())) { $addedNodes[] = $node; // removed nodes don't matter here because due to the identity map the right object will be returned from the query and will have "removed" set. } } $workspaces[] = $workspace; $workspace = $workspace->getBaseWorkspace(); } $queryBuilder = $this->createQueryBuilder($workspaces); if ($dimensions !== null) { $this->addDimensionJoinConstraintsToQueryBuilder($queryBuilder, $dimensions); } $this->addPathConstraintToQueryBuilder($queryBuilder, $path); if ($onlyShadowNodes) { $queryBuilder->andWhere('n.movedTo IS NOT NULL AND n.removed = TRUE'); } $query = $queryBuilder->getQuery(); $nodes = $query->getResult(); return array_merge($nodes, $addedNodes); }
php
protected function findRawNodesByPath($path, Workspace $workspace, array $dimensions = null, $onlyShadowNodes = false) { $path = strtolower($path); if ($path === '' || ($path !== '/' && ($path[0] !== '/' || substr($path, -1, 1) === '/'))) { throw new \InvalidArgumentException('"' . $path . '" is not a valid path: must start but not end with a slash.', 1284985489); } if ($path === '/') { return [$workspace->getRootNodeData()]; } $addedNodes = []; $workspaces = []; while ($workspace !== null) { /** @var $node NodeData */ foreach ($this->addedNodes as $node) { if (($node->getPath() === $path && $node->matchesWorkspaceAndDimensions($workspace, $dimensions)) && ($onlyShadowNodes === false || $node->isInternal())) { $addedNodes[] = $node; // removed nodes don't matter here because due to the identity map the right object will be returned from the query and will have "removed" set. } } $workspaces[] = $workspace; $workspace = $workspace->getBaseWorkspace(); } $queryBuilder = $this->createQueryBuilder($workspaces); if ($dimensions !== null) { $this->addDimensionJoinConstraintsToQueryBuilder($queryBuilder, $dimensions); } $this->addPathConstraintToQueryBuilder($queryBuilder, $path); if ($onlyShadowNodes) { $queryBuilder->andWhere('n.movedTo IS NOT NULL AND n.removed = TRUE'); } $query = $queryBuilder->getQuery(); $nodes = $query->getResult(); return array_merge($nodes, $addedNodes); }
[ "protected", "function", "findRawNodesByPath", "(", "$", "path", ",", "Workspace", "$", "workspace", ",", "array", "$", "dimensions", "=", "null", ",", "$", "onlyShadowNodes", "=", "false", ")", "{", "$", "path", "=", "strtolower", "(", "$", "path", ")", ...
This finds nodes by path and delivers a raw, unfiltered result. To get a "usable" set of nodes, filtering by workspaces, dimensions and removed nodes must be done on the result. @param string $path @param Workspace $workspace @param array|null $dimensions @param boolean $onlyShadowNodes @return array @throws \InvalidArgumentException
[ "This", "finds", "nodes", "by", "path", "and", "delivers", "a", "raw", "unfiltered", "result", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php#L248-L285
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php
NodeDataRepository.findOneByPathInContext
public function findOneByPathInContext($path, Context $context) { $node = $this->findOneByPath($path, $context->getWorkspace(), $context->getDimensions(), ($context->isRemovedContentShown() ? null : false)); if ($node !== null) { $node = $this->nodeFactory->createFromNodeData($node, $context); } return $node; }
php
public function findOneByPathInContext($path, Context $context) { $node = $this->findOneByPath($path, $context->getWorkspace(), $context->getDimensions(), ($context->isRemovedContentShown() ? null : false)); if ($node !== null) { $node = $this->nodeFactory->createFromNodeData($node, $context); } return $node; }
[ "public", "function", "findOneByPathInContext", "(", "$", "path", ",", "Context", "$", "context", ")", "{", "$", "node", "=", "$", "this", "->", "findOneByPath", "(", "$", "path", ",", "$", "context", "->", "getWorkspace", "(", ")", ",", "$", "context", ...
Finds a node by its path and context. If the node does not exist in the specified context's workspace, this function will try to find one with the given path in one of the base workspaces (if any). Examples for valid paths: / the root node /foo node "foo" on the first level /foo/bar node "bar" on the second level /foo/ first node on second level, below "foo" @param string $path Absolute path of the node @param Context $context The containing context @return NodeInterface|NULL The matching node if found, otherwise NULL @throws \InvalidArgumentException
[ "Finds", "a", "node", "by", "its", "path", "and", "context", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php#L305-L313
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php
NodeDataRepository.findOneByIdentifier
public function findOneByIdentifier($identifier, Workspace $workspace, array $dimensions = null, $removedNodes = false) { $workspaces = []; while ($workspace !== null) { /** @var $node NodeData */ foreach ($this->addedNodes as $node) { if ($node->getIdentifier() === $identifier && $node->matchesWorkspaceAndDimensions($workspace, $dimensions)) { return $node; } } /** @var $node NodeData */ foreach ($this->removedNodes as $node) { if ($node->getIdentifier() === $identifier && $node->matchesWorkspaceAndDimensions($workspace, $dimensions)) { return null; } } $workspaces[] = $workspace; $workspace = $workspace->getBaseWorkspace(); } $queryBuilder = $this->createQueryBuilder($workspaces); if ($removedNodes === false) { $queryBuilder->andWhere('n.movedTo IS NULL OR n.removed = FALSE'); } else { $queryBuilder->andWhere('n.movedTo IS NULL'); } if ($dimensions !== null) { $this->addDimensionJoinConstraintsToQueryBuilder($queryBuilder, $dimensions); } else { $dimensions = []; } $this->addIdentifierConstraintToQueryBuilder($queryBuilder, $identifier); $query = $queryBuilder->getQuery(); $nodes = $query->getResult(); $foundNodes = $this->reduceNodeVariantsByWorkspacesAndDimensions($nodes, $workspaces, $dimensions); if ($removedNodes === false) { $foundNodes = $this->withoutRemovedNodes($foundNodes); } if ($foundNodes !== []) { return reset($foundNodes); } return null; }
php
public function findOneByIdentifier($identifier, Workspace $workspace, array $dimensions = null, $removedNodes = false) { $workspaces = []; while ($workspace !== null) { /** @var $node NodeData */ foreach ($this->addedNodes as $node) { if ($node->getIdentifier() === $identifier && $node->matchesWorkspaceAndDimensions($workspace, $dimensions)) { return $node; } } /** @var $node NodeData */ foreach ($this->removedNodes as $node) { if ($node->getIdentifier() === $identifier && $node->matchesWorkspaceAndDimensions($workspace, $dimensions)) { return null; } } $workspaces[] = $workspace; $workspace = $workspace->getBaseWorkspace(); } $queryBuilder = $this->createQueryBuilder($workspaces); if ($removedNodes === false) { $queryBuilder->andWhere('n.movedTo IS NULL OR n.removed = FALSE'); } else { $queryBuilder->andWhere('n.movedTo IS NULL'); } if ($dimensions !== null) { $this->addDimensionJoinConstraintsToQueryBuilder($queryBuilder, $dimensions); } else { $dimensions = []; } $this->addIdentifierConstraintToQueryBuilder($queryBuilder, $identifier); $query = $queryBuilder->getQuery(); $nodes = $query->getResult(); $foundNodes = $this->reduceNodeVariantsByWorkspacesAndDimensions($nodes, $workspaces, $dimensions); if ($removedNodes === false) { $foundNodes = $this->withoutRemovedNodes($foundNodes); } if ($foundNodes !== []) { return reset($foundNodes); } return null; }
[ "public", "function", "findOneByIdentifier", "(", "$", "identifier", ",", "Workspace", "$", "workspace", ",", "array", "$", "dimensions", "=", "null", ",", "$", "removedNodes", "=", "false", ")", "{", "$", "workspaces", "=", "[", "]", ";", "while", "(", ...
Finds a node by its identifier and workspace. If the node does not exist in the specified workspace, this function will try to find one with the given identifier in one of the base workspaces (if any). @param string $identifier Identifier of the node @param Workspace $workspace The containing workspace @param array $dimensions An array of dimensions with array of ordered values to use for fallback matching @param bool $removedNodes If shadow nodes should be considered while finding the specified node @return NodeData The matching node if found, otherwise NULL
[ "Finds", "a", "node", "by", "its", "identifier", "and", "workspace", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php#L327-L375
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php
NodeDataRepository.setNewIndex
public function setNewIndex(NodeData $node, $position, NodeInterface $referenceNode = null) { $parentPath = $node->getParentPath(); switch ($position) { case self::POSITION_BEFORE: if ($referenceNode === null) { throw new \InvalidArgumentException('The reference node must be specified for POSITION_BEFORE.', 1317198857); } $referenceIndex = $referenceNode->getIndex(); $nextLowerIndex = $this->findNextLowerIndex($parentPath, $referenceIndex); if ($nextLowerIndex === null) { // FIXME: $nextLowerIndex returns 0 and not NULL in case no lower index is found. So this case seems to be // never executed. We need to check that again! $newIndex = (integer)round($referenceIndex / 2); } elseif ($nextLowerIndex < ($referenceIndex - 1)) { // there is free space left between $referenceNode and preceding sibling. $newIndex = (integer)round($nextLowerIndex + (($referenceIndex - $nextLowerIndex) / 2)); } else { // there is no free space left between $referenceNode and following sibling -> we have to make room! $this->openIndexSpace($parentPath, $referenceIndex); $referenceIndex = $referenceNode->getIndex(); $nextLowerIndex = $this->findNextLowerIndex($parentPath, $referenceIndex); if ($nextLowerIndex === null) { $newIndex = (integer)round($referenceIndex / 2); } else { $newIndex = (integer)round($nextLowerIndex + (($referenceIndex - $nextLowerIndex) / 2)); } } break; case self::POSITION_AFTER: if ($referenceNode === null) { throw new \InvalidArgumentException('The reference node must be specified for POSITION_AFTER.', 1317198858); } $referenceIndex = $referenceNode->getIndex(); $nextHigherIndex = $this->findNextHigherIndex($parentPath, $referenceIndex); if ($nextHigherIndex === null) { // $referenceNode is last node, so we can safely add an index at the end by incrementing the reference index. $newIndex = $referenceIndex + 100; $this->setHighestIndexInParentPath($parentPath, $newIndex); } elseif ($nextHigherIndex > ($referenceIndex + 1)) { // $referenceNode is not last node, but there is free space left between $referenceNode and following sibling. $newIndex = (integer)round($referenceIndex + (($nextHigherIndex - $referenceIndex) / 2)); } else { // $referenceNode is not last node, and no free space is left -> we have to make room after the reference node! $this->openIndexSpace($parentPath, $referenceIndex + 1); $nextHigherIndex = $this->findNextHigherIndex($parentPath, $referenceIndex); if ($nextHigherIndex === null) { $newIndex = $referenceIndex + 100; $this->setHighestIndexInParentPath($parentPath, $newIndex); } else { $newIndex = (integer)round($referenceIndex + (($nextHigherIndex - $referenceIndex) / 2)); } } break; case self::POSITION_LAST: $nextFreeIndex = $this->findNextFreeIndexInParentPath($parentPath); $newIndex = $nextFreeIndex; break; default: throw new \InvalidArgumentException('Invalid position for new node index given.', 1329729088); } $node->setIndex($newIndex); }
php
public function setNewIndex(NodeData $node, $position, NodeInterface $referenceNode = null) { $parentPath = $node->getParentPath(); switch ($position) { case self::POSITION_BEFORE: if ($referenceNode === null) { throw new \InvalidArgumentException('The reference node must be specified for POSITION_BEFORE.', 1317198857); } $referenceIndex = $referenceNode->getIndex(); $nextLowerIndex = $this->findNextLowerIndex($parentPath, $referenceIndex); if ($nextLowerIndex === null) { // FIXME: $nextLowerIndex returns 0 and not NULL in case no lower index is found. So this case seems to be // never executed. We need to check that again! $newIndex = (integer)round($referenceIndex / 2); } elseif ($nextLowerIndex < ($referenceIndex - 1)) { // there is free space left between $referenceNode and preceding sibling. $newIndex = (integer)round($nextLowerIndex + (($referenceIndex - $nextLowerIndex) / 2)); } else { // there is no free space left between $referenceNode and following sibling -> we have to make room! $this->openIndexSpace($parentPath, $referenceIndex); $referenceIndex = $referenceNode->getIndex(); $nextLowerIndex = $this->findNextLowerIndex($parentPath, $referenceIndex); if ($nextLowerIndex === null) { $newIndex = (integer)round($referenceIndex / 2); } else { $newIndex = (integer)round($nextLowerIndex + (($referenceIndex - $nextLowerIndex) / 2)); } } break; case self::POSITION_AFTER: if ($referenceNode === null) { throw new \InvalidArgumentException('The reference node must be specified for POSITION_AFTER.', 1317198858); } $referenceIndex = $referenceNode->getIndex(); $nextHigherIndex = $this->findNextHigherIndex($parentPath, $referenceIndex); if ($nextHigherIndex === null) { // $referenceNode is last node, so we can safely add an index at the end by incrementing the reference index. $newIndex = $referenceIndex + 100; $this->setHighestIndexInParentPath($parentPath, $newIndex); } elseif ($nextHigherIndex > ($referenceIndex + 1)) { // $referenceNode is not last node, but there is free space left between $referenceNode and following sibling. $newIndex = (integer)round($referenceIndex + (($nextHigherIndex - $referenceIndex) / 2)); } else { // $referenceNode is not last node, and no free space is left -> we have to make room after the reference node! $this->openIndexSpace($parentPath, $referenceIndex + 1); $nextHigherIndex = $this->findNextHigherIndex($parentPath, $referenceIndex); if ($nextHigherIndex === null) { $newIndex = $referenceIndex + 100; $this->setHighestIndexInParentPath($parentPath, $newIndex); } else { $newIndex = (integer)round($referenceIndex + (($nextHigherIndex - $referenceIndex) / 2)); } } break; case self::POSITION_LAST: $nextFreeIndex = $this->findNextFreeIndexInParentPath($parentPath); $newIndex = $nextFreeIndex; break; default: throw new \InvalidArgumentException('Invalid position for new node index given.', 1329729088); } $node->setIndex($newIndex); }
[ "public", "function", "setNewIndex", "(", "NodeData", "$", "node", ",", "$", "position", ",", "NodeInterface", "$", "referenceNode", "=", "null", ")", "{", "$", "parentPath", "=", "$", "node", "->", "getParentPath", "(", ")", ";", "switch", "(", "$", "po...
Assigns an index to the given node which reflects the specified position. If the position is "before" or "after", an index will be chosen which makes the given node the previous or next node of the given reference node. If the position "last" is specified, an index higher than any existing index will be chosen. If no free index is available between two nodes (for "before" and "after"), the whole index of the current node level will be renumbered. @param NodeData $node The node to set the new index for @param integer $position The position the new index should reflect, must be one of the POSITION_* constants @param NodeInterface $referenceNode The reference node. Mandatory for POSITION_BEFORE and POSITION_AFTER @return void @throws \InvalidArgumentException
[ "Assigns", "an", "index", "to", "the", "given", "node", "which", "reflects", "the", "specified", "position", ".", "If", "the", "position", "is", "before", "or", "after", "an", "index", "will", "be", "chosen", "which", "makes", "the", "given", "node", "the"...
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php#L431-L495
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php
NodeDataRepository.findByParentWithoutReduce
public function findByParentWithoutReduce($parentPath, Workspace $workspace) { $parentPath = strtolower($parentPath); $workspaces = $this->collectWorkspaceAndAllBaseWorkspaces($workspace); $queryBuilder = $this->createQueryBuilder($workspaces); $this->addParentPathConstraintToQueryBuilder($queryBuilder, $parentPath); $query = $queryBuilder->getQuery(); $foundNodes = $query->getResult(); $childNodeDepth = NodePaths::getPathDepth($parentPath) + 1; /** @var $addedNode NodeData */ foreach ($this->addedNodes as $addedNode) { if ($addedNode->getDepth() === $childNodeDepth && NodePaths::getParentPath($addedNode->getPath()) === $parentPath && in_array($addedNode->getWorkspace(), $workspaces)) { $foundNodes[] = $addedNode; } } /** @var $removedNode NodeData */ foreach ($this->removedNodes as $removedNode) { if ($removedNode->getDepth() === $childNodeDepth && NodePaths::getParentPath($removedNode->getPath()) === $parentPath && in_array($removedNode->getWorkspace(), $workspaces)) { $foundNodes = array_filter($foundNodes, function ($nodeData) use ($removedNode) { return $nodeData !== $removedNode; }); } } return $foundNodes; }
php
public function findByParentWithoutReduce($parentPath, Workspace $workspace) { $parentPath = strtolower($parentPath); $workspaces = $this->collectWorkspaceAndAllBaseWorkspaces($workspace); $queryBuilder = $this->createQueryBuilder($workspaces); $this->addParentPathConstraintToQueryBuilder($queryBuilder, $parentPath); $query = $queryBuilder->getQuery(); $foundNodes = $query->getResult(); $childNodeDepth = NodePaths::getPathDepth($parentPath) + 1; /** @var $addedNode NodeData */ foreach ($this->addedNodes as $addedNode) { if ($addedNode->getDepth() === $childNodeDepth && NodePaths::getParentPath($addedNode->getPath()) === $parentPath && in_array($addedNode->getWorkspace(), $workspaces)) { $foundNodes[] = $addedNode; } } /** @var $removedNode NodeData */ foreach ($this->removedNodes as $removedNode) { if ($removedNode->getDepth() === $childNodeDepth && NodePaths::getParentPath($removedNode->getPath()) === $parentPath && in_array($removedNode->getWorkspace(), $workspaces)) { $foundNodes = array_filter($foundNodes, function ($nodeData) use ($removedNode) { return $nodeData !== $removedNode; }); } } return $foundNodes; }
[ "public", "function", "findByParentWithoutReduce", "(", "$", "parentPath", ",", "Workspace", "$", "workspace", ")", "{", "$", "parentPath", "=", "strtolower", "(", "$", "parentPath", ")", ";", "$", "workspaces", "=", "$", "this", "->", "collectWorkspaceAndAllBas...
Find NodeData by parent path without any dimension reduction and grouping by identifier Only used internally for setting the path of all child nodes @param string $parentPath @param Workspace $workspace @return array<\Neos\ContentRepository\Domain\Model\NodeData> A unreduced array of NodeData
[ "Find", "NodeData", "by", "parent", "path", "without", "any", "dimension", "reduction", "and", "grouping", "by", "identifier" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php#L630-L658
train