_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q24700 | ContentRepository.appendSingleMapping | train | private function appendSingleMapping(QueryBuilder $queryBuilder, $propertyName, $locales)
{
foreach ($locales as $locale) {
$alias = sprintf('%s%s', $locale, str_replace('-', '_', ucfirst($propertyName)));
$queryBuilder->addSelect(
'node',
| php | {
"resource": ""
} |
q24701 | ContentRepository.appendUrlMapping | train | private function appendUrlMapping(QueryBuilder $queryBuilder, $locales)
{
$structures = $this->structureManager->getStructures(Structure::TYPE_PAGE);
$urlNames = [];
foreach ($structures as $structure) {
if (!$structure->hasTag('sulu.rlp')) {
continue;
... | php | {
"resource": ""
} |
q24702 | ContentRepository.resolveAvailableLocales | train | private function resolveAvailableLocales(Row $row)
{
$locales = [];
foreach ($row->getValues() as $key => $value) {
if (preg_match('/^node.([a-zA-Z_]*?)Template/', $key, $matches) && '' !== $value
| php | {
"resource": ""
} |
q24703 | ContentRepository.resolveInternalLinkContent | train | public function resolveInternalLinkContent(
Row $row,
$locale,
$webspaceKey,
MappingInterface $mapping,
StructureType $type = null,
UserInterface $user = null
) {
$linkedContent = $this->find($row->getValue('internalLink'), $locale, $webspaceKey, $mapping);
... | php | {
"resource": ""
} |
q24704 | ContentRepository.resolveProperty | train | private function resolveProperty(Row $row, $name, $locale, $shadowLocale = null)
{
if (array_key_exists(sprintf('node.%s', $name), $row->getValues())) {
return $row->getValue($name);
}
if (null !== $shadowLocale && !in_array($name, self::$nonFallbackProperties)) {
| php | {
"resource": ""
} |
q24705 | ContentRepository.resolveUrl | train | private function resolveUrl(Row $row, $locale)
{
if (WorkflowStage::PUBLISHED !== $this->resolveProperty($row, $locale . 'State', $locale)) {
return;
}
$template = $this->resolveProperty($row, 'template', $locale);
if (empty($template)) {
return;
}
| php | {
"resource": ""
} |
q24706 | ContentRepository.resolvePath | train | private function resolvePath(Row $row, $webspaceKey)
{
return '/' . | php | {
"resource": ""
} |
q24707 | ContentRepository.resolvePermissions | train | private function resolvePermissions(Row $row, UserInterface $user = null)
{
$permissions = [];
if (null !== $user) {
foreach ($user->getRoleObjects() as $role) { | php | {
"resource": ""
} |
q24708 | ContentRepository.resolveHasChildren | train | private function resolveHasChildren(Row $row)
{
$queryBuilder = new QueryBuilder($this->qomFactory);
$queryBuilder
->select('node', 'jcr:uuid', 'uuid')
->from($this->qomFactory->selector('node', 'nt:unstructured'))
->where($this->qomFactory->childNode('node', | php | {
"resource": ""
} |
q24709 | ShadowLocaleSubscriber.onPostSerialize | train | public function onPostSerialize(ObjectEvent $event)
{
$document = $event->getObject();
if (!$document instanceof ShadowLocaleBehavior || !$this->documentRegistry->hasDocument($document)) {
return;
}
$visitor = | php | {
"resource": ""
} |
q24710 | WebspaceStructureProvider.loadStructures | train | protected function loadStructures($webspaceKey)
{
$structures = [];
$keys = [];
foreach ($this->structureManager->getStructures() as $page) {
/* @var PageBridge $page */
$template = sprintf('%s.html.twig', $page->getView());
if ($this->templateExists($temp... | php | {
"resource": ""
} |
q24711 | WebspaceStructureProvider.templateExists | train | protected function templateExists($template)
{
$loader = $this->twig->getLoader();
if (method_exists($loader, 'exists')) {
return $loader->exists($template);
}
try {
// cast possible TemplateReferenceInterface to string because the
// EngineInterf... | php | {
"resource": ""
} |
q24712 | TextUtils.truncate | train | public static function truncate($text, $length, $suffix = '...')
{
$strlen = mb_strlen($text, 'UTF-8');
if ($strlen > $length) | php | {
"resource": ""
} |
q24713 | DoctrineListBuilder.findIdsByGivenCriteria | train | protected function findIdsByGivenCriteria()
{
$select = $this->getSelectAs($this->idField);
$subQueryBuilder = $this->createSubQueryBuilder($select);
if (null != $this->limit) {
$subQueryBuilder->setMaxResults($this->limit)->setFirstResult($this->limit * ($this->page - 1));
... | php | {
"resource": ""
} |
q24714 | DoctrineListBuilder.assignSortFields | train | protected function assignSortFields($queryBuilder)
{
// if no sort has been assigned add order by id ASC as default
if (0 === count($this->sortFields)) {
$queryBuilder->addOrderBy($this->idField->getSelect(), 'ASC');
}
foreach ($this->sortFields as $index => $sortField) ... | php | {
"resource": ""
} |
q24715 | DoctrineListBuilder.assignGroupBy | train | protected function assignGroupBy($queryBuilder)
{
if (!empty($this->groupByFields)) {
| php | {
"resource": ""
} |
q24716 | DoctrineListBuilder.getJoins | train | protected function getJoins()
{
$joins = [];
$fields = array_merge($this->sortFields, $this->selectFields, $this->searchFields, $this->expressionFields);
foreach ($fields as $field) {
| php | {
"resource": ""
} |
q24717 | DoctrineListBuilder.getAllFields | train | protected function getAllFields($onlyReturnFilterFields = false)
{
$fields = array_merge(
$this->searchFields,
$this->sortFields,
$this->getUniqueExpressionFieldDescriptors($this->expressions)
);
if (true !== $onlyReturnFilterFields) {
$fields | php | {
"resource": ""
} |
q24718 | DoctrineListBuilder.createSubQueryBuilder | train | protected function createSubQueryBuilder($select = null)
{
if (!$select) {
$select = $this->getSelectAs($this->idField);
}
// get all filter-fields
$filterFields = $this->getAllFields(true);
// get entity names
$entityNames = $this->getEntityNamesOfField... | php | {
"resource": ""
} |
q24719 | DoctrineListBuilder.getNecessaryJoins | train | protected function getNecessaryJoins($necessaryEntityNames)
{
$addJoins = [];
// iterate through all field descriptors to find necessary joins
foreach ($this->getAllFields() as $key => $field) {
// if field is in any conditional clause -> add join
if (($field instanc... | php | {
"resource": ""
} |
q24720 | DoctrineListBuilder.getEntityNamesOfFieldDescriptors | train | protected function getEntityNamesOfFieldDescriptors($filterFields)
{
$fields = [];
// filter array for DoctrineFieldDescriptors
foreach ($filterFields as $field) {
// add joins of field
$fields = array_merge($fields, $field->getJoins());
if ($field insta... | php | {
"resource": ""
} |
q24721 | DoctrineListBuilder.createQueryBuilder | train | protected function createQueryBuilder($joins = null)
{
$this->queryBuilder = $this->em->createQueryBuilder()
->from($this->entityName, $this->encodeAlias($this->entityName));
$this->assignJoins($this->queryBuilder, $joins);
if (null !== $this->ids) {
$this->in($this... | php | {
"resource": ""
} |
q24722 | DoctrineListBuilder.assignJoins | train | protected function assignJoins(QueryBuilder $queryBuilder, array $joins = null)
{
if (null === $joins) {
$joins = $this->getJoins();
}
foreach ($joins as $entity => $join) {
switch ($join->getJoinMethod()) {
case DoctrineJoinDescriptor::JOIN_METHOD_LE... | php | {
"resource": ""
} |
q24723 | DoctrineListBuilder.getUniqueExpressionFieldDescriptors | train | protected function getUniqueExpressionFieldDescriptors(array $expressions)
{
if (0 === count($this->expressionFields)) {
$descriptors = [];
$uniqueNames = array_unique($this->getAllFieldNames($expressions));
foreach ($uniqueNames as $uniqueName) {
$descrip... | php | {
"resource": ""
} |
q24724 | DoctrineListBuilder.getAllFieldNames | train | protected function getAllFieldNames($expressions)
{
$fieldNames = [];
foreach ($expressions as $expression) {
if ($expression instanceof ConjunctionExpressionInterface) {
$fieldNames = array_merge($fieldNames, $expression->getFieldNames());
} elseif ($expressi... | php | {
"resource": ""
} |
q24725 | DoctrineListBuilder.getSelectAs | train | private function getSelectAs(DoctrineFieldDescriptorInterface $field, $hidden = false)
{
$select = $field->getSelect() . ' AS ';
if ($hidden) { | php | {
"resource": ""
} |
q24726 | ReorderSubscriber.handleReorder | train | public function handleReorder(ReorderEvent $event)
{ | php | {
"resource": ""
} |
q24727 | TargetGroupController.cgetAction | train | public function cgetAction(Request $request)
{
$restHelper = $this->get('sulu_core.doctrine_rest_helper');
$factory = $this->get('sulu_core.doctrine_list_builder_factory');
$listBuilder = $factory->create($this->getTargetGroupRepository()->getClassName());
$fieldDescriptors = $this-... | php | {
"resource": ""
} |
q24728 | TargetGroupController.getAction | train | public function getAction($id)
{
$findCallback = function($id) {
$targetGroup = $this->getTargetGroupRepository()->find($id);
| php | {
"resource": ""
} |
q24729 | TargetGroupController.postAction | train | public function postAction(Request $request)
{
$targetGroup = $this->deserializeData($request->getContent());
| php | {
"resource": ""
} |
q24730 | TargetGroupController.putAction | train | public function putAction(Request $request, $id)
{
$jsonData = $request->getContent();
$data = json_decode($jsonData, true);
// Id should be taken of request uri.
| php | {
"resource": ""
} |
q24731 | TargetGroupController.deleteAction | train | public function deleteAction($id)
{
$targetGroup = $this->retrieveTargetGroupById($id);
$this->getEntityManager()->remove($targetGroup);
| php | {
"resource": ""
} |
q24732 | TargetGroupController.cdeleteAction | train | public function cdeleteAction(Request $request)
{
$idsData = $request->get('ids');
$ids = explode(',', $idsData);
if (!count($ids)) {
throw new MissingParameterException('TargetGroupController', 'ids');
}
$targetGroups = $this->getTargetGroupRepository()->findBy... | php | {
"resource": ""
} |
q24733 | TargetGroupController.deserializeData | train | private function deserializeData($data)
{
$result = $this->get('jms_serializer')->deserialize(
$data,
$this->getTargetGroupRepository()->getClassName(),
'json',
| php | {
"resource": ""
} |
q24734 | TargetGroupController.retrieveTargetGroupById | train | private function retrieveTargetGroupById($id)
{
/** @var TargetGroupInterface $targetGroup */
$targetGroup = $this->getTargetGroupRepository()->find($id);
if (!$targetGroup) {
| php | {
"resource": ""
} |
q24735 | MediaStreamController.cleanUpFileName | train | private function cleanUpFileName($fileName, $locale, $extension)
{
$pathInfo = pathinfo($fileName);
$cleanedFileName = $this->get('sulu.content.path_cleaner')->cleanup($pathInfo['filename'], $locale);
| php | {
"resource": ""
} |
q24736 | TimestampableSubscriber.loadClassMetadata | train | public function loadClassMetadata(LoadClassMetadataEventArgs $event)
{
$metadata = $event->getClassMetadata();
$reflection = $metadata->getReflectionClass();
if (null !== $reflection && $reflection->implementsInterface('Sulu\Component\Persistence\Model\TimestampableInterface')) {
... | php | {
"resource": ""
} |
q24737 | TimestampableSubscriber.handleTimestamp | train | private function handleTimestamp(LifecycleEventArgs $event)
{
$entity = $event->getObject();
if (!$entity instanceof TimestampableInterface) {
return;
}
$meta = $event->getObjectManager()->getClassMetadata(get_class($entity));
| php | {
"resource": ""
} |
q24738 | LanguageController.cgetAction | train | public function cgetAction()
{
/** @var WebspaceManagerInterface $webspaceManager */
$webspaceManager = $this->get('sulu_core.webspace.webspace_manager');
$localizations = [];
$locales = [];
/** @var Webspace $webspace */
foreach ($webspaceManager->getWebspaceCollec... | php | {
"resource": ""
} |
q24739 | ExcerptStructureExtension.getExcerptStructure | train | private function getExcerptStructure($locale = null)
{
if (null === $locale) {
$locale = $this->languageCode;
}
$excerptStructure | php | {
"resource": ""
} |
q24740 | ExcerptStructureExtension.initProperties | train | private function initProperties($locale)
{
// Reset the properties before new initialization.
$this->properties = [];
/** @var PropertyInterface $property */
| php | {
"resource": ""
} |
q24741 | WebspaceImport.setDocumentSettings | train | protected function setDocumentSettings(
BasePageDocument $document,
$format,
$data,
$overrideSettings
) {
if ('true' !== $overrideSettings) {
return;
}
foreach ($data as $key => $property) {
$setter = 'set' . ucfirst($key);
... | php | {
"resource": ""
} |
q24742 | WebspaceImport.getSetterValue | train | protected function getSetterValue($key, $value)
{
if (empty($value)) {
return;
}
switch ($key) {
case 'redirectTarget':
$value = $this->documentManager->find($value);
| php | {
"resource": ""
} |
q24743 | WebspaceImport.importExtension | train | protected function importExtension(
ExportExtensionInterface $extension,
$extensionKey,
NodeInterface $node,
$data,
$webspaceKey,
$locale,
$format
) {
$extensionData = [];
foreach ($extension->getImportPropertyNames() as $propertyName) {
| php | {
"resource": ""
} |
q24744 | WebspaceImport.generateUrl | train | private function generateUrl($properties, $parentUuid, $webspaceKey, $locale, $format, $data)
{
$rlpParts = [];
foreach ($properties as $property) {
$rlpParts[] = $this->getParser($format)->getPropertyData(
| php | {
"resource": ""
} |
q24745 | HtmlTagExtractor.getAttributes | train | private function getAttributes($tag)
{
if (!preg_match_all(self::ATTRIBUTE_REGEX, $tag, $matches)) {
return [];
}
$attributes = [];
for ($i = 0, $length = count($matches['name']); $i < $length; ++$i) {
$value = $matches['value'][$i];
if ('true' =... | php | {
"resource": ""
} |
q24746 | ScriptHandler.removeComposerLockFromGitIgnore | train | public static function removeComposerLockFromGitIgnore()
{
if (!file_exists(static::GIT_IGNORE_FILE)) {
return;
}
$gitignore = file_get_contents(static::GIT_IGNORE_FILE);
| php | {
"resource": ""
} |
q24747 | ScriptHandler.removePackageLockJsonFromGitIgnore | train | public static function removePackageLockJsonFromGitIgnore()
{
if (!file_exists(static::GIT_IGNORE_FILE)) {
return;
}
$gitignore = file_get_contents(static::GIT_IGNORE_FILE);
| php | {
"resource": ""
} |
q24748 | Version201507231648.upgradeWebspace | train | private function upgradeWebspace(Webspace $webspace)
{
$sessionManager = $this->container->get('sulu.phpcr.session');
$node = $sessionManager->getContentNode($webspace->getKey());
foreach ($webspace->getAllLocalizations() as $localization) {
$locale = $localization->getLocale();... | php | {
"resource": ""
} |
q24749 | Version201507231648.upgradeNode | train | private function upgradeNode(NodeInterface $node, $propertyName, $locale)
{
foreach ($node->getNodes() as $child) {
$this->upgradeNode($child, $propertyName, $locale);
}
if (false === $node->getPropertyValueWithDefault($propertyName, false)) {
return;
}
... | php | {
"resource": ""
} |
q24750 | Version201507231648.getTags | train | private function getTags(NodeInterface $node, $locale)
{
return $node->getPropertyValueWithDefault(
| php | {
"resource": ""
} |
q24751 | Version201507231648.getCategories | train | private function getCategories(NodeInterface $node, $locale)
{
return $node->getPropertyValueWithDefault(
| php | {
"resource": ""
} |
q24752 | Version201507231648.getNavigationContext | train | private function getNavigationContext(NodeInterface $node, $locale)
{
return $node->getPropertyValueWithDefault(
| php | {
"resource": ""
} |
q24753 | AdminController.configAction | train | public function configAction(): Response
{
$user = $this->tokenStorage->getToken()->getUser();
$contact = $this->contactManager->getById($user->getContact()->getId(), $user->getLocale());
$view = View::create([
'sulu_admin' => [
'endpoints' => [
... | php | {
"resource": ""
} |
q24754 | WebspaceCollectionBuilder.buildUrls | train | private function buildUrls(
Portal $portal,
Environment $environment,
Url $url,
$segments,
$urlAddress
) {
if ($url->getLanguage()) {
$language = $url->getLanguage();
$country = $url->getCountry();
$locale = $language . ($country ? ... | php | {
"resource": ""
} |
q24755 | WebspaceCollectionBuilder.generateUrlAddress | train | private function generateUrlAddress($pattern, $replacers)
{
foreach ($replacers as $replacer => | php | {
"resource": ""
} |
q24756 | GroupRepository.findAllGroups | train | public function findAllGroups()
{
try {
$qb = $this->createQueryBuilder('grp');
$query = $qb->getQuery(); | php | {
"resource": ""
} |
q24757 | StructureMediaSearchSubscriber.getImageUrl | train | private function getImageUrl($data, $locale)
{
// new structures will container an instance of MediaSelectionContainer
if ($data instanceof MediaSelectionContainer) {
$medias = $data->getData('de');
// old ones an array ...
} else {
if (!isset($data['ids'])) {... | php | {
"resource": ""
} |
q24758 | PageRouteDefaultsProvider.documentToStructure | train | protected function documentToStructure(BasePageDocument $document)
{
$structure = $this->inspector->getStructureMetadata($document);
$documentAlias = $this->inspector->getMetadata($document)->getAlias();
| php | {
"resource": ""
} |
q24759 | MediaRedirectController.redirectAction | train | public function redirectAction(Request $request, $id)
{
$locale = $this->getRequestParameter($request, 'locale', true);
$format = $this->getRequestParameter($request, 'format');
/** @var Media $media */
$media = $this->container->get('sulu_media.media_manager')->getById($id, $locale... | php | {
"resource": ""
} |
q24760 | SnippetAreaController.putAction | train | public function putAction(Request $request, $key)
{
$webspaceKey = $this->getRequestParameter($request, 'webspace', true);
$this->get('sulu_security.security_checker')->checkPermission(
new SecurityCondition(SnippetAdmin::getDefaultSnippetsSecurityContext($webspaceKey)),
Perm... | php | {
"resource": ""
} |
q24761 | SnippetAreaController.deleteAction | train | public function deleteAction(Request $request, $key)
{
$webspaceKey = $this->getRequestParameter($request, 'webspace', true);
$this->get('sulu_security.security_checker')->checkPermission(
new SecurityCondition(SnippetAdmin::getDefaultSnippetsSecurityContext($webspaceKey)),
P... | php | {
"resource": ""
} |
q24762 | UserManager.delete | train | public function delete()
{
$delete = function($id) {
$user = $this->userRepository->findUserById($id);
if (!$user) {
| php | {
"resource": ""
} |
q24763 | UserManager.isUsernameUnique | train | public function isUsernameUnique($username)
{
if ($username) {
try {
$this->userRepository->findUserByUsername($username);
| php | {
"resource": ""
} |
q24764 | UserManager.isEmailUnique | train | public function isEmailUnique($email)
{
if ($email) {
try {
$this->userRepository->findUserByEmail($email);
| php | {
"resource": ""
} |
q24765 | UserManager.processUserRoles | train | public function processUserRoles(UserInterface $user, $userRoles)
{
$get = function($entity) {
/* @var UserInterface $entity */
return $entity->getId();
};
$delete = function($userRole) use ($user) {
$user->removeUserRole($userRole);
$this->em... | php | {
"resource": ""
} |
q24766 | UserManager.processUserGroups | train | protected function processUserGroups(UserInterface $user, $userGroups)
{
$get = function($entity) {
/* @var UserInterface $entity */
return $entity->getId();
};
$delete = function($userGroup) use ($user) {
$user->removeUserGroup($userGroup);
$... | php | {
"resource": ""
} |
q24767 | UserManager.updateUserRole | train | private function updateUserRole(UserRole $userRole, $userRoleData)
{
$role = $this->roleRepository->findRoleById($userRoleData['role']['id']);
if (!$role) {
throw new EntityNotFoundException($this->roleRepository->getClassName(), $userRole['role']['id']);
}
$userRole->s... | php | {
"resource": ""
} |
q24768 | UserManager.addUserRole | train | private function addUserRole(UserInterface $user, $userRoleData)
{
$alreadyContains = false;
$role = $this->roleRepository->findRoleById($userRoleData['role']['id']);
if (!$role) {
throw new EntityNotFoundException($this->roleRepository->getClassName(), $userRoleData['role']['i... | php | {
"resource": ""
} |
q24769 | UserManager.addUserGroup | train | private function addUserGroup(UserInterface $user, $userGroupData)
{
$group = $this->groupRepository->findGroupById($userGroupData['group']['id']);
if (!$group) {
throw new EntityNotFoundException($this->groupRepository->getClassName(), $userGroupData['group']['id']);
}
... | php | {
"resource": ""
} |
q24770 | UserManager.updateUserGroup | train | private function updateUserGroup(UserGroup $userGroup, $userGroupData)
{
$group = $this->groupRepository->findGroupById($userGroupData['group']['id']);
if (!$group) {
throw new EntityNotFoundException($this->groupRepository->getClassName(), $userGroup['group']['id']);
}
... | php | {
"resource": ""
} |
q24771 | UserManager.getContact | train | private function getContact($id)
{
$contact = $this->contactManager->findById($id);
if | php | {
"resource": ""
} |
q24772 | UserManager.processEmail | train | private function processEmail(UserInterface $user, $email, $contact = null)
{
if ($contact) {
// if no email passed try to use the contact's first email
if (null === $email &&
array_key_exists('emails', $contact) && count($contact['emails']) > 0 &&
$th... | php | {
"resource": ""
} |
q24773 | UserLocaleListener.copyUserLocaleToRequest | train | public function copyUserLocaleToRequest(GetResponseEvent $event)
{
$token = $this->tokenStorage->getToken();
if (!$token) {
return;
}
$user = $token->getUser();
if (!$user instanceof UserInterface) {
| php | {
"resource": ""
} |
q24774 | Structure.addChild | train | protected function addChild(PropertyInterface $property)
{
if ($property instanceof SectionPropertyInterface) {
foreach ($property->getChildProperties() as $childProperty) {
$this->addPropertyTags($childProperty);
}
| php | {
"resource": ""
} |
q24775 | Structure.addPropertyTags | train | protected function addPropertyTags(PropertyInterface $property)
{
foreach ($property->getTags() as $tag) {
if (!array_key_exists($tag->getName(), $this->tags)) {
$this->tags[$tag->getName()] = [
'tag' => $tag,
'properties' => [$tag->getPrio... | php | {
"resource": ""
} |
q24776 | Structure.getProperty | train | public function getProperty($name)
{
$result = $this->findProperty($name);
if (null !== $result) {
return $result;
} elseif (isset($this->properties[$name])) {
| php | {
"resource": ""
} |
q24777 | Structure.getPropertyByTagName | train | public function getPropertyByTagName($tagName, $highest = true)
{
if (array_key_exists($tagName, $this->tags)) {
return $this->tags[$tagName][true === $highest ? | php | {
"resource": ""
} |
q24778 | Structure.getPropertiesByTagName | train | public function getPropertiesByTagName($tagName)
{
if (array_key_exists($tagName, $this->tags)) {
return $this->tags[$tagName]['properties'];
| php | {
"resource": ""
} |
q24779 | Structure.findProperty | train | private function findProperty($name)
{
foreach ($this->getProperties(true) as $property) {
if ($property->getName() === $name) { | php | {
"resource": ""
} |
q24780 | Structure.getProperties | train | public function getProperties($flatten = false)
{
if (false === $flatten) {
return $this->properties;
} else {
$result = [];
foreach ($this->properties as $property) {
if ($property instanceof SectionPropertyInterface) {
| php | {
"resource": ""
} |
q24781 | Structure.__isset | train | public function __isset($property)
{
if (null !== $this->findProperty($property)) {
return true;
| php | {
"resource": ""
} |
q24782 | Structure.toArray | train | public function toArray($complete = true)
{
if ($complete) {
$result = [
'id' => $this->uuid,
'nodeType' => $this->nodeType,
'internal' => $this->internal,
'shadowLocales' => $this->getShadowLocales(),
'contentLocale... | php | {
"resource": ""
} |
q24783 | Structure.getStructureTag | train | public function getStructureTag($name)
{
if (!isset($this->structureTags[$name])) {
throw new \InvalidArgumentException(sprintf('Trying to get | php | {
"resource": ""
} |
q24784 | XmlFileLoader11.generateTemplates | train | protected function generateTemplates(Webspace $webspace)
{
foreach ($this->xpath->query('/x:webspace/x:templates/x:template') as $templateNode) {
/* @var \DOMNode | php | {
"resource": ""
} |
q24785 | ResettingController.sendEmailAction | train | public function sendEmailAction(Request $request, $generateNewKey = true)
{
try {
/** @var UserInterface $user */
$user = $this->findUser($request->get('user'));
if (true === $generateNewKey) {
$this->generateTokenForUser($user);
}
... | php | {
"resource": ""
} |
q24786 | ResettingController.resetAction | train | public function resetAction(Request $request)
{
try {
$token = $request->get('token');
/** @var UserInterface $user */
$user = $this->findUserByValidToken($token);
$this->changePassword($user, $request->get('password', ''));
$this->deleteToken($use... | php | {
"resource": ""
} |
q24787 | ResettingController.getSenderAddress | train | protected function getSenderAddress(Request $request)
{
$sender = $this->getParameter('sulu_security.reset_password.mail.sender');
if (!$sender || !$this->isEmailValid($sender)) {
| php | {
"resource": ""
} |
q24788 | ResettingController.getEmail | train | private function getEmail(UserInterface $user)
{
if (null !== $user->getEmail()) {
| php | {
"resource": ""
} |
q24789 | ResettingController.findUserByValidToken | train | private function findUserByValidToken($token)
{
try {
/** @var UserInterface $user */
$user = $this->getUserRepository()->findUserByToken($token);
if (new \DateTime() > $user->getPasswordResetTokenExpiresAt()) {
throw new InvalidTokenException($token);
| php | {
"resource": ""
} |
q24790 | ResettingController.loginUser | train | private function loginUser(UserInterface $user, $request)
{
$token = new UsernamePasswordToken($user, null, 'admin', $user->getRoles());
$this->get('security.token_storage')->setToken($token); //now the | php | {
"resource": ""
} |
q24791 | ResettingController.deleteToken | train | private function deleteToken(UserInterface $user)
{
$em = $this->getDoctrine()->getManager();
$user->setPasswordResetToken(null);
| php | {
"resource": ""
} |
q24792 | ResettingController.sendTokenEmail | train | private function sendTokenEmail(UserInterface $user, $from, $to)
{
if (null === $user->getPasswordResetToken()) {
throw new NoTokenFoundException($user);
}
$maxNumberEmails = $this->getParameter('sulu_security.reset_password.mail.token_send_limit');
if ($user->getPasswo... | php | {
"resource": ""
} |
q24793 | ResettingController.changePassword | train | private function changePassword(UserInterface $user, $password)
{
if ('' === $password) {
throw new MissingPasswordException();
}
$em | php | {
"resource": ""
} |
q24794 | ResettingController.generateTokenForUser | train | private function generateTokenForUser(UserInterface $user)
{
// if a token was already requested within the request interval time frame
if (null !== $user->getPasswordResetToken()
&& $this->dateIsInRequestFrame($user->getPasswordResetTokenExpiresAt())) {
throw new TokenAlread... | php | {
"resource": ""
} |
q24795 | ResettingController.getUniqueToken | train | private function getUniqueToken($startToken)
{
try {
$this->getUserRepository()->findUserByToken($startToken);
| php | {
"resource": ""
} |
q24796 | ResettingController.encodePassword | train | private function encodePassword(UserInterface $user, $password, $salt)
{
$encoder | php | {
"resource": ""
} |
q24797 | ResettingController.hasSystem | train | private function hasSystem(SuluUserInterface $user)
{
$system = $this->getSystem();
foreach ($user->getRoleObjects() as $role) {
if ($role->getSystem() === | php | {
"resource": ""
} |
q24798 | Cropper.isInsideImage | train | private function isInsideImage(ImageInterface $image, $x, $y, $width, $height)
{
if ($x < 0 || $y < 0) {
return false;
}
if ($x + $width > $image->getSize()->getWidth()) {
return false;
| php | {
"resource": ""
} |
q24799 | Cropper.isNotSmallerThanFormat | train | private function isNotSmallerThanFormat($width, $height, array $format)
{
if (isset($format['scale']['x']) && $width < $format['scale']['x']) {
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.