_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q24900 | ContactRepository.addPagination | train | private function addPagination($qb, $offset, $limit)
{
// Add pagination
| php | {
"resource": ""
} |
q24901 | ContactRepository.addWhere | train | private function addWhere($qb, $where, $prefix = '')
{
$prefix = '' !== $prefix ? $prefix . '.' : '';
$and = $qb->expr()->andX();
foreach ($where as $k => $v) {
| php | {
"resource": ""
} |
q24902 | TeaserContentType.getValue | train | private function getValue(PropertyInterface $property)
{
$default = ['presentAs' => null, 'items' => []];
if (!is_array($property->getValue())) {
| php | {
"resource": ""
} |
q24903 | ClassNameInflector.getUserClassName | train | public static function getUserClassName($className)
{
if (null === self::$inflector) {
static::$inflector = new ProxyManagerClassNameInflector('');
| php | {
"resource": ""
} |
q24904 | CustomerController.cgetAction | train | public function cgetAction(Request $request)
{
$ids = array_filter(explode(',', $request->get('ids', '')));
$result = $this->getCustomerManager()->findByIds($ids);
$list = new CollectionRepresentation(
$result,
| php | {
"resource": ""
} |
q24905 | Environment.addUrl | train | public function addUrl(Url $url)
{
$this->urls[] = $url;
$url->setEnvironment($this->getType());
| php | {
"resource": ""
} |
q24906 | Environment.setMainUrl | train | private function setMainUrl(Url $url)
{
if (null !== $this->mainUrl) {
$this->mainUrl->setMain(false);
| php | {
"resource": ""
} |
q24907 | ResourceSegmentSubscriber.handleHydrate | train | public function handleHydrate(AbstractMappingEvent $event)
{
$document = $event->getDocument();
if (!$this->supports($document)) {
return;
}
$node = $event->getNode();
$property = $this->getResourceSegmentProperty($document);
if (!$property) {
| php | {
"resource": ""
} |
q24908 | ResourceSegmentSubscriber.handlePersistDocument | train | public function handlePersistDocument(PersistEvent $event)
{
/** @var ResourceSegmentBehavior $document */
$document = $event->getDocument();
if (!$this->supports($document)) {
return;
}
$property = $this->getResourceSegmentProperty($document);
// check ... | php | {
"resource": ""
} |
q24909 | ResourceSegmentSubscriber.handlePersistRoute | train | public function handlePersistRoute(PublishEvent $event)
{
/** @var ResourceSegmentBehavior $document */
$document = $event->getDocument();
if (!$this->supports($document)) {
return;
}
if (!$event->getLocale()) {
return;
}
if ($docume... | php | {
"resource": ""
} |
q24910 | ResourceSegmentSubscriber.updateMovedDocument | train | public function updateMovedDocument(MoveEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof ResourceSegmentBehavior) {
return;
}
$webspaceKey = $this->documentInspector->getWebspace($event->getDocument());
if (!$webspaceKey) {
... | php | {
"resource": ""
} |
q24911 | ResourceSegmentSubscriber.updateCopiedDocument | train | public function updateCopiedDocument(CopyEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof ResourceSegmentBehavior) {
return;
}
$this->updateRoute(
| php | {
"resource": ""
} |
q24912 | ResourceSegmentSubscriber.getResourceSegmentProperty | train | private function getResourceSegmentProperty($document)
{
$structure = $this->documentInspector->getStructureMetadata($document);
if (!$structure) {
return;
}
$property = $structure->getPropertyByTagName('sulu.rlp');
if (!$property) {
throw new \Runt... | php | {
"resource": ""
} |
q24913 | ResourceSegmentSubscriber.persistDocument | train | private function persistDocument(ResourceSegmentBehavior $document, PropertyMetadata $property)
{
$document->getStructure()->getProperty(
| php | {
"resource": ""
} |
q24914 | ResourceSegmentSubscriber.persistRoute | train | private function persistRoute(ResourceSegmentBehavior $document)
{
$resourceLocatorStrategy = $this->resourceLocatorStrategyPool->getStrategyByWebspaceKey(
| php | {
"resource": ""
} |
q24915 | ResourceSegmentSubscriber.updateRoute | train | private function updateRoute($document, $generateRoutes)
{
$locales = $this->documentInspector->getLocales($document);
$webspaceKey = $this->documentInspector->getWebspace($document);
$uuid = $this->documentInspector->getUuid($document);
$path = $this->documentInspector->getPath($doc... | php | {
"resource": ""
} |
q24916 | ResourceSegmentSubscriber.updateResourceSegmentProperty | train | private function updateResourceSegmentProperty(
NodeInterface $node,
$resourceSegmentPropertyName,
$parentUuid,
$webspaceKey,
$locale
) {
$resourceLocatorStrategy = $this->resourceLocatorStrategyPool->getStrategyByWebspaceKey($webspaceKey);
| php | {
"resource": ""
} |
q24917 | PreviewRenderer.handle | train | private function handle(Request $request)
{
$kernel = $this->kernelFactory->create($this->environment);
try {
return $kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, false);
} catch (HttpException $e) {
| php | {
"resource": ""
} |
q24918 | PreviewRenderer.createServerAttributes | train | private function createServerAttributes(PortalInformation $portalInformation, Request $currentRequest = null)
{
// get server parameters
$server = [];
$host = null;
// FIXME default scheme and port should be configurable.
$scheme = 'http';
$port = 80;
if ($cu... | php | {
"resource": ""
} |
q24919 | PreviewRenderer.createPortalInformation | train | private function createPortalInformation($object, $id, $webspaceKey, $locale)
{
$webspace = $this->webspaceManager->findWebspaceByKey($webspaceKey);
$domain = $this->requestStack->getCurrentRequest()->getHost();
if (!$webspace) {
throw new WebspaceNotFoundException($object, $id,... | php | {
"resource": ""
} |
q24920 | PublishSubscriber.createNodeInPublicWorkspace | train | public function createNodeInPublicWorkspace(PersistEvent $event)
{
$node = $event->getNode();
if ($node->isNew()) {
$this->createNodesWithUuid($node);
return;
}
$liveNode = $this->getLiveNode($event->getDocument());
| php | {
"resource": ""
} |
q24921 | PublishSubscriber.removeNodeFromPublicWorkspace | train | public function removeNodeFromPublicWorkspace(RemoveEvent $event)
{
$document = $event->getDocument();
$metadata = $this->metadataFactory->getMetadataForClass(get_class($document));
| php | {
"resource": ""
} |
q24922 | PublishSubscriber.moveNodeInPublicWorkspace | train | public function moveNodeInPublicWorkspace(MoveEvent $event)
{
$liveNode = $this->getLiveNode($event->getDocument()); | php | {
"resource": ""
} |
q24923 | PublishSubscriber.reorderNodeInPublicWorkspace | train | public function reorderNodeInPublicWorkspace(ReorderEvent $event)
{
$node = $this->getLiveNode($event->getDocument());
$this->nodeHelper->reorder($node, $event->getDestId());
// FIXME duplicating logic of OrderSubscriber, maybe move to NodeHelper?
$count = 1;
foreach | php | {
"resource": ""
} |
q24924 | PublishSubscriber.removePropertiesFromPublicWorkspace | train | public function removePropertiesFromPublicWorkspace(UnpublishEvent $event)
{
$node = | php | {
"resource": ""
} |
q24925 | PublishSubscriber.createNodesWithUuid | train | private function createNodesWithUuid(NodeInterface $node)
{
$path = $node->getPath();
if ($this->liveSession->itemExists($path)) {
return;
}
$currentDefaultNode = $node->getSession()->getRootNode();
$currentLiveNode = $this->liveSession->getRootNode();
... | php | {
"resource": ""
} |
q24926 | PublishSubscriber.removeLocalizedNodeProperties | train | private function removeLocalizedNodeProperties(NodeInterface $node, $locale)
{
// remove all localized system properties from the node
foreach ($node->getProperties($this->propertyEncoder->localizedSystemName('', $locale) . '*') as $property) {
$property->remove();
}
| php | {
"resource": ""
} |
q24927 | PropertiesXmlParser.loadProperties | train | private function loadProperties(&$tags, \DOMXPath $xpath, \DOMNode $context): array
{
$result = [];
/** @var \DOMElement $node */
foreach ($xpath->query('x:*', $context) as $node) {
if ('property' === $node->tagName) {
$value = $this->loadProperty($xpath, $node, ... | php | {
"resource": ""
} |
q24928 | PropertiesXmlParser.loadProperty | train | private function loadProperty(\DOMXPath $xpath, \DOMNode $node, &$tags)
{
$result = $this->loadValues(
$xpath,
$node,
[
'name',
'type',
'minOccurs',
'maxOccurs',
'colspan',
'cs... | php | {
"resource": ""
} |
q24929 | PropertiesXmlParser.validateTag | train | private function validateTag($tag, &$tags)
{
if (!isset($tags[$tag['name']])) {
$tags[$tag['name']] = [];
| php | {
"resource": ""
} |
q24930 | PropertiesXmlParser.loadTag | train | private function loadTag(\DOMXPath $xpath, \DOMNode $node)
{
$tag = [
'name' => null,
'priority' => null,
'attributes' => [],
];
foreach ($node->attributes as $key => $attr) {
if (in_array($key, ['name', 'priority'])) {
| php | {
"resource": ""
} |
q24931 | PropertiesXmlParser.loadBlock | train | private function loadBlock(\DOMXPath $xpath, \DOMNode $node, &$tags)
{
$result = $this->loadValues(
$xpath,
$node,
[
'name',
'default-type',
'minOccurs',
'maxOccurs',
'colspan',
... | php | {
"resource": ""
} |
q24932 | PropertiesXmlParser.loadTags | train | private function loadTags(&$tags, \DOMXPath $xpath, \DOMNode $context = null)
{
$result = [];
/** @var \DOMElement $node */
foreach ($xpath->query('x:tag', $context) as $node) {
| php | {
"resource": ""
} |
q24933 | PropertiesXmlParser.loadTypes | train | private function loadTypes(&$tags, \DOMXPath $xpath, \DOMNode $context = null)
{
$result = [];
/** @var \DOMElement $node */
foreach ($xpath->query('x:types/x:type', $context) as $node) {
| php | {
"resource": ""
} |
q24934 | PropertiesXmlParser.loadValues | train | private function loadValues(\DOMXPath $xpath, \DOMNode $node, $keys, $prefix = '@')
{
$result = [];
foreach ($keys as $key) {
| php | {
"resource": ""
} |
q24935 | PropertiesXmlParser.loadParams | train | private function loadParams($path, \DOMXPath $xpath, \DOMNode $context = null)
{
$result = [];
/** @var \DOMElement $node */
foreach ($xpath->query($path, $context) as $node) {
| php | {
"resource": ""
} |
q24936 | ContactAddress.setAddress | train | public function setAddress(\Sulu\Bundle\ContactBundle\Entity\Address $address)
{
| php | {
"resource": ""
} |
q24937 | RouteManager.isUnique | train | private function isUnique(RouteInterface $route)
{
$persistedRoute = $this->routeRepository->findByPath($route->getPath(), | php | {
"resource": ""
} |
q24938 | RouteManager.resolve | train | private function resolve(RouteInterface $route, RoutableInterface $entity)
{
$persistedRoute = $this->routeRepository->findByPath($route->getPath(), $route->getLocale());
if (!$persistedRoute) {
return $route;
}
if ($persistedRoute->getEntityClass() === | php | {
"resource": ""
} |
q24939 | BlameSubscriber.setBlamesOnDocument | train | public function setBlamesOnDocument(HydrateEvent $event)
{
$document = $event->getDocument();
if (!$this->supports($document)) {
return;
}
$node = $event->getNode();
$locale = $event->getLocale();
$encoding = $this->getPropertyEncoding($document);
... | php | {
"resource": ""
} |
q24940 | BlameSubscriber.setBlamesOnNodeForPersist | train | public function setBlamesOnNodeForPersist(PersistEvent $event)
{
$document = $event->getDocument();
if (!$this->supports($document)) {
return;
}
$this->setBlamesOnNode(
| php | {
"resource": ""
} |
q24941 | BlameSubscriber.setBlamesOnNodeForPublish | train | public function setBlamesOnNodeForPublish(PublishEvent $event)
{
$document = $event->getDocument();
if (!$this->supports($document)) {
return;
}
$this->setBlamesOnNode(
| php | {
"resource": ""
} |
q24942 | BlameSubscriber.setBlamesOnNode | train | public function setBlamesOnNode(
LocalizedBlameBehavior $document,
NodeInterface $node,
$locale,
DocumentAccessor $accessor,
$userId
) {
if (!$document instanceof BlameBehavior && !$locale) {
return;
}
$encoding = $this->getPropertyEncodin... | php | {
"resource": ""
} |
q24943 | BlameSubscriber.setChangerForRestore | train | public function setChangerForRestore(RestoreEvent $event)
{
$document = $event->getDocument();
if (!$this->supports($event->getDocument())) {
return;
}
$encoding = $this->getPropertyEncoding($document);
$event->getNode()->setProperty(
| php | {
"resource": ""
} |
q24944 | TargetGroupEvaluator.evaluateTargetGroup | train | private function evaluateTargetGroup(TargetGroupInterface $targetGroup)
{
foreach ($targetGroup->getRules() as | php | {
"resource": ""
} |
q24945 | TargetGroupEvaluator.evaluateTargetGroupRule | train | private function evaluateTargetGroupRule(TargetGroupRuleInterface $targetGroupRule)
{
foreach ($targetGroupRule->getConditions() as $targetGroupCondition) {
$rule = $this->ruleCollection->getRule($targetGroupCondition->getType());
| php | {
"resource": ""
} |
q24946 | JsConfig.addParameters | train | public function addParameters(array $params)
{
if (!is_array($params)) {
throw new | php | {
"resource": ""
} |
q24947 | NavigationRegistry.processNavigationItem | train | private function processNavigationItem(NavigationItem $navigationItem): void
{
// create label from name when no label is set
if (!$navigationItem->getLabel()) {
$navigationItem->setLabel($this->translator->trans($navigationItem->getName(), [], 'admin'));
}
// add child ... | php | {
"resource": ""
} |
q24948 | MetaTwigExtension.getAlternateLinks | train | public function getAlternateLinks($urls)
{
// determine default and current values
$webspaceKey = $this->requestAnalyzer->getWebspace()->getKey();
$currentPortal = $this->requestAnalyzer->getPortal();
$defaultLocale = null;
if (null !== $currentPortal && null !== ($defaultLo... | php | {
"resource": ""
} |
q24949 | MetaTwigExtension.getSeoMetaTags | train | public function getSeoMetaTags($extension, $content)
{
$seo = [];
if (array_key_exists('seo', $extension)) {
$seo = $extension['seo'];
}
$excerpt = [];
if (array_key_exists('excerpt', $extension)) {
$excerpt = $extension['excerpt'];
}
... | php | {
"resource": ""
} |
q24950 | BaseXmlFormatLoader.addFormatFromFormatNode | train | private function addFormatFromFormatNode(\DOMNode $formatNode, &$formats)
{
$key = $this->getKeyFromFormatNode($formatNode);
$internal = $this->getInternalFlagFromFormatNode($formatNode);
$meta = $this->getMetaFromFormatNode($formatNode);
$scale = $this->getScaleFromFormatNode($form... | php | {
"resource": ""
} |
q24951 | BaseXmlFormatLoader.tryLoad | train | private function tryLoad($file)
{
try {
return XmlUtils::loadFile($file, __DIR__ . static::SCHEME_PATH);
} catch (\InvalidArgumentException $e) { | php | {
"resource": ""
} |
q24952 | BaseXmlFormatLoader.getParametersFromNode | train | protected function getParametersFromNode($node, $parameterName = 'parameter')
{
if (null === $node) {
return [];
}
$parameters = [];
foreach ($this->xpath->query('x:' . $parameterName, $node) as $parameterNode) {
| php | {
"resource": ""
} |
q24953 | BaseXmlFormatLoader.getOptionsFromFormatNode | train | private function getOptionsFromFormatNode(\DOMNode $formatNode)
{
$optionsNode = $this->xpath->query('x:options', $formatNode)->item(0);
| php | {
"resource": ""
} |
q24954 | LocalizationFinder.findAvailableParentLocalization | train | private function findAvailableParentLocalization(array $availableLocales, Localization $localization)
{
do {
if (in_array($localization->getLocale(), $availableLocales)) {
return $localization;
}
| php | {
"resource": ""
} |
q24955 | LocalizationFinder.findAvailableChildLocalization | train | private function findAvailableChildLocalization(array $availableLocales, Localization $localization)
{
$childrenLocalizations = $localization->getChildren();
if (!empty($childrenLocalizations)) {
foreach ($childrenLocalizations as $childrenLocalization) {
// return the l... | php | {
"resource": ""
} |
q24956 | LocalizationFinder.findAvailableLocalization | train | private function findAvailableLocalization(array $availableLocales, array $localizations)
{
foreach ($localizations as $localization) {
if (in_array($localization->getLocale(), $availableLocales)) {
return $localization; | php | {
"resource": ""
} |
q24957 | RecoverCommand.findCategoriesWithoutParents | train | private function findCategoriesWithoutParents()
{
// get categories that have no parent but depth > 0
$qb = $this->categoryRepository->createQueryBuilder('c2')
->select('count(c2.id)')
->leftJoin('c2.parent', 'c1')
| php | {
"resource": ""
} |
q24958 | RecoverCommand.fixWrongDepthGap | train | private function fixWrongDepthGap()
{
// FIXME: convert this native query to DQL (once its possible to join within UPDATE statement)
// fix categories where difference to parents depth > 1
$sql = 'UPDATE ca_categories c2
JOIN ca_categories c1 ON c2.idCategoriesParent = c1.id
... | php | {
"resource": ""
} |
q24959 | RecoverCommand.fixCategoriesWithoutParents | train | private function fixCategoriesWithoutParents()
{
// fix categories that have no parent but depth > 0
$qb = $this->categoryRepository->createQueryBuilder('c2')
->update()
| php | {
"resource": ""
} |
q24960 | SnippetAreaTwigExtension.loadByArea | train | public function loadByArea($area, $webspaceKey = null, $locale = null)
{
if (!$webspaceKey) {
$webspaceKey = $this->requestAnalyzer->getWebspace()->getKey();
}
if (!$locale) {
$locale = $this->requestAnalyzer->getCurrentLocalization()->getLocale();
}
... | php | {
"resource": ""
} |
q24961 | Configuration.addFileSystemNode | train | private function addFileSystemNode()
{
$builder = new TreeBuilder();
$node = $builder->root('file_system');
$node
->addDefaultsIfNotSet()
->children() | php | {
"resource": ""
} |
q24962 | Configuration.addRedisNode | train | private function addRedisNode()
{
$builder = new TreeBuilder();
$node = $builder->root('redis');
$node
->addDefaultsIfNotSet()
->children()
->scalarNode('connection_id')->defaultNull()->end()
->scalarNode('host')->defaultValue('127.0.0... | php | {
"resource": ""
} |
q24963 | BlameTimestampSubscriber.handleBlameTimestamp | train | public function handleBlameTimestamp(PreIndexEvent $event)
{
$subject = $event->getSubject();
$document = $event->getDocument();
if ($subject instanceof UserBlameInterface) {
$this->mapCreatorAndChanger($document, $subject->getCreator(), $subject->getChanger());
}
... | php | {
"resource": ""
} |
q24964 | BlameTimestampSubscriber.getFieldValue | train | private function getFieldValue($document, $fieldName)
{
if (false === $document->hasField($fieldName)) {
return;
| php | {
"resource": ""
} |
q24965 | BlameTimestampSubscriber.mapTimestamp | train | private function mapTimestamp(Document $document, \DateTime $created = null, \DateTime $changed = null)
{
$document->addField(
$this->factory->createField('created', $created ? $created->format('c') : null, 'string')
);
| php | {
"resource": ""
} |
q24966 | BlameTimestampSubscriber.mapCreatorAndChanger | train | private function mapCreatorAndChanger(Document $document, UserInterface $creator = null, UserInterface $changer = null)
{
$document->addField(
$this->factory->createField('changer', $changer ? $changer->getUsername() : null, 'string')
);
$document->addField(
$this->fa... | php | {
"resource": ""
} |
q24967 | WebspaceImportCommand.printExceptions | train | protected function printExceptions($import, $output = null)
{
if (null === $output) {
$output = new NullOutput();
}
$output->writeln([
'',
'',
'<info>Import Result</info>',
'<info>===============</info>',
'<info>' . $im... | php | {
"resource": ""
} |
q24968 | XmlFileLoader10.parseXml | train | protected function parseXml($file)
{
$this->xpath = new \DOMXPath($this->tryLoad($file));
$this->xpath->registerNamespace('x', 'http://schemas.sulu.io/webspace/webspace');
// set simple webspace properties
$this->webspace = new Webspace();
$this->webspace->setName($this->xpa... | php | {
"resource": ""
} |
q24969 | XmlFileLoader10.tryLoad | train | protected function tryLoad($file)
{
try {
return XmlUtils::loadFile($file, __DIR__ . static::SCHEMA_LOCATION);
} catch (\InvalidArgumentException $e) {
throw new InvalidWebspaceException(
sprintf(
| php | {
"resource": ""
} |
q24970 | XmlFileLoader10.loadPortalLocalizationDefaultFromWebspace | train | protected function loadPortalLocalizationDefaultFromWebspace($portal)
{
$webspaceDefaultLocalization = $this->webspace->getDefaultLocalization();
foreach ($portal->getLocalizations() as $localization) {
if ($webspaceDefaultLocalization
&& $webspaceDefaultLocalization->ge... | php | {
"resource": ""
} |
q24971 | XmlFileLoader10.generatePortalLocalizations | train | protected function generatePortalLocalizations(\DOMNode $portalNode, Portal $portal)
{
if ($this->xpath->query('x:localizations', $portalNode)->length > 0) {
// set localizations from portal, if they are set
$localizationNodes = $this->xpath->query('x:localizations/x:localization', $... | php | {
"resource": ""
} |
q24972 | XmlFileLoader10.generateLocalizationsFromNodeList | train | protected function generateLocalizationsFromNodeList(\DOMNodeList $localizationNodes, Portal $portal, $flat = false)
{
foreach ($localizationNodes as $localizationNode) {
$localization = | php | {
"resource": ""
} |
q24973 | XmlFileLoader10.generateLocalizationFromNode | train | protected function generateLocalizationFromNode(\DOMElement $localizationNode, $flat = false, $parent = null)
{
$localization = new Localization();
$localization->setLanguage($localizationNode->attributes->getNamedItem('language')->nodeValue);
// set parent if given
if ($parent) {
... | php | {
"resource": ""
} |
q24974 | XmlFileLoader10.generateSecurity | train | protected function generateSecurity()
{
$securitySystemNode = $this->xpath->query('/x:webspace/x:security/x:system');
if ($securitySystemNode->length > 0) | php | {
"resource": ""
} |
q24975 | XmlFileLoader10.generateWebspaceLocalizations | train | protected function generateWebspaceLocalizations()
{
foreach ($this->xpath->query('/x:webspace/x:localizations/x:localization') as | php | {
"resource": ""
} |
q24976 | XmlFileLoader10.generateSegments | train | protected function generateSegments()
{
foreach ($this->xpath->query('/x:webspace/x:segments/x:segment') as $segmentNode) {
/** @var \DOMNode $segmentNode */
$segment = new Segment();
$segment->setName($segmentNode->nodeValue);
$segment->setKey($segmentNode->a... | php | {
"resource": ""
} |
q24977 | XmlFileLoader10.generatePortals | train | protected function generatePortals()
{
foreach ($this->xpath->query('/x:webspace/x:portals/x:portal') as $portalNode) {
/** @var \DOMNode $portalNode */
$portal = new Portal();
$portal->setName($this->xpath->query('x:name', $portalNode)->item(0)->nodeValue);
... | php | {
"resource": ""
} |
q24978 | XmlFileLoader10.generateTheme | train | protected function generateTheme()
{
$nodes = $this->xpath->query('/x:webspace/x:theme/x:key');
if ($nodes->length > 0) {
return $nodes->item(0)->nodeValue;
}
| php | {
"resource": ""
} |
q24979 | XmlFileLoader10.generateTemplates | train | protected function generateTemplates(Webspace $webspace)
{
$defaultErrorTemplates = 0;
foreach ($this->xpath->query('/x:webspace/x:theme/x:error-templates/x:error-template') as $errorTemplateNode) {
/* @var \DOMNode $errorTemplateNode */
$template = $errorTemplateNode->nodeV... | php | {
"resource": ""
} |
q24980 | XmlFileLoader10.generateDefaultTemplates | train | protected function generateDefaultTemplates(Webspace $webspace)
{
$expected = ['page', 'home'];
foreach ($this->xpath->query('/x:webspace/x:theme/x:default-templates/x:default-template') as $node) {
/* @var \DOMNode $node */
$template = $node->nodeValue;
$type = ... | php | {
"resource": ""
} |
q24981 | XmlFileLoader10.generateNavigation | train | protected function generateNavigation()
{
$contexts = [];
foreach ($this->xpath->query('/x:webspace/x:navigation/x:contexts/x:context') as $contextNode) {
/* @var \DOMNode $contextNode */
$contexts[] = new NavigationContext(
| php | {
"resource": ""
} |
q24982 | XmlFileLoader10.loadMeta | train | protected function loadMeta($path, \DOMNode $context = null)
{
$result = [];
/** @var \DOMElement $node */
foreach ($this->xpath->query($path, $context) as $node) {
$attribute = $node->tagName; | php | {
"resource": ""
} |
q24983 | XmlFileLoader10.generateEnvironments | train | protected function generateEnvironments(\DOMNode $portalNode, Portal $portal)
{
foreach ($this->xpath->query('x:environments/x:environment', $portalNode) as $environmentNode) {
/** @var \DOMNode $environmentNode */
$environment = new Environment();
$environment->setType($... | php | {
"resource": ""
} |
q24984 | XmlFileLoader10.generateUrls | train | protected function generateUrls(\DOMNode $environmentNode, Environment $environment)
{
foreach ($this->xpath->query('x:urls/x:url', $environmentNode) as $urlNode) {
// check if the url is valid, and throw an exception otherwise
if (!$this->checkUrlNode($urlNode)) {
th... | php | {
"resource": ""
} |
q24985 | XmlFileLoader10.generateCustomUrls | train | protected function generateCustomUrls(\DOMNode $environmentNode, Environment $environment)
{
foreach ($this->xpath->query('x:custom-urls/x:custom-url', $environmentNode) as $urlNode) {
/** @var \DOMNode $urlNode */
$url = new CustomUrl();
$url->setUrl(rtrim($urlNode->nod... | php | {
"resource": ""
} |
q24986 | XmlFileLoader10.getOptionalNodeAttribute | train | protected function getOptionalNodeAttribute(\DOMNode $node, $name, $default = null)
{
$attribute = $node->attributes->getNamedItem($name);
if ($attribute) {
| php | {
"resource": ""
} |
q24987 | XmlFileLoader10.checkUrlNode | train | protected function checkUrlNode(\DOMNode $urlNode)
{
$hasLocalization = (null != $urlNode->attributes->getNamedItem('localization'))
|| (false !== strpos($urlNode->nodeValue, '{localization}'));
$hasLanguage = (null != $urlNode->attributes->getNamedItem('language'))
|| (fals... | php | {
"resource": ""
} |
q24988 | XmlFileLoader10.validateWebspaceDefaultLocalization | train | protected function validateWebspaceDefaultLocalization()
{
try {
$this->validateDefaultLocalization($this->webspace->getLocalizations());
| php | {
"resource": ""
} |
q24989 | XmlFileLoader10.validateDefaultPortalLocalization | train | protected function validateDefaultPortalLocalization()
{
// check all portal localizations
foreach ($this->webspace->getPortals() as $portal) {
try {
if (!$this->validateDefaultLocalization($portal->getLocalizations())) {
// try to load the webspace lo... | php | {
"resource": ""
} |
q24990 | XmlFileLoader10.validateWebspaceDefaultSegment | train | protected function validateWebspaceDefaultSegment()
{
// check if there are duplicate defaults in the webspaces segments
$segments = $this->webspace->getSegments();
if ($segments) {
$webspaceDefaultSegmentFound = false;
foreach ($segments as $webspaceSegment) {
... | php | {
"resource": ""
} |
q24991 | XmlFileLoader10.validateDefaultLocalization | train | protected function validateDefaultLocalization($localizations)
{
$result = false;
foreach ($localizations as $localization) {
if ($localization->isDefault()) {
if ($result) {
| php | {
"resource": ""
} |
q24992 | CollectionRepository.getIdsQuery | train | private function getIdsQuery(
$depth = 0,
$filter = [],
$sortBy = [],
CollectionInterface $collection = null,
$select = 'collection.id'
) {
$queryBuilder = $this->createQueryBuilder('collection')
->select($select)
->where('collection.depth <= :... | php | {
"resource": ""
} |
q24993 | RefreshSubscriber.refreshDocument | train | public function refreshDocument(RefreshEvent $event)
{
$document = $event->getDocument();
$node = $this->documentRegistry->getNodeForDocument($document);
$locale = $this->documentRegistry->getLocaleForDocument($document);
| php | {
"resource": ""
} |
q24994 | RefreshSubscriber.refreshDocumentForDeleteDraft | train | public function refreshDocumentForDeleteDraft(RemoveDraftEvent $event)
{
| php | {
"resource": ""
} |
q24995 | RefreshSubscriber.rehydrateDocument | train | private function rehydrateDocument($document, NodeInterface $node, $locale)
{
$hydrateEvent = new HydrateEvent($node, $locale, ['rehydrate' => true]);
| php | {
"resource": ""
} |
q24996 | TargetGroupEvaluationController.targetGroupAction | train | public function targetGroupAction(Request $request)
{
$currentTargetGroup = null;
if ($request->headers->has($this->targetGroupHeader)) {
$currentTargetGroup = $this->targetGroupRepository->find($request->headers->get($this->targetGroupHeader));
}
$targetGroup = $this->t... | php | {
"resource": ""
} |
q24997 | TargetGroupEvaluationController.targetGroupHitAction | train | public function targetGroupHitAction()
{
$currentTargetGroup = $this->targetGroupRepository->find($this->targetGroupStore->getTargetGroupId(true));
$targetGroup = $this->targetGroupEvaluator->evaluate(TargetGroupRuleInterface::FREQUENCY_HIT, $currentTargetGroup);
$response = new Response();... | php | {
"resource": ""
} |
q24998 | FilterManager.updateConditionGroup | train | protected function updateConditionGroup(ConditionGroupEntity $conditionGroup, $matchedEntry)
{
if (array_key_exists('id', $matchedEntry) && isset($matchedEntry['conditions'])) {
$conditionIds = [];
foreach ($matchedEntry['conditions'] as $conditionData) {
if (array_ke... | php | {
"resource": ""
} |
q24999 | FilterManager.getValueForCondition | train | protected function getValueForCondition($value, $type)
{
// check if date and not a relative value like -1 week
if (DataTypes::DATETIME_TYPE === $type && !preg_match('/[A-Za-z]{3,}/', $value)) {
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.