idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
11,600
public function setOptions ( $ options ) { $ this -> options = [ 'config_dir' => null , 'cache_dir' => null , 'debug' => false , 'cache_class' => 'WebspaceCollectionCache' , 'base_class' => 'WebspaceCollection' , ] ; $ this -> options = array_merge ( $ this -> options , $ options ) ; }
Sets the options for the manager .
11,601
protected function isFromDomain ( $ url , $ domain ) { if ( ! $ domain ) { return true ; } $ parsedUrl = parse_url ( $ url ) ; if ( isset ( $ parsedUrl [ 'host' ] ) && ( $ parsedUrl [ 'host' ] == $ domain || fnmatch ( '*.' . $ domain , $ parsedUrl [ 'host' ] ) ) ) { return true ; } return false ; }
Url is from domain .
11,602
private function createResourceLocatorUrl ( $ scheme , $ portalUrl , $ resourceLocator ) { if ( false !== strpos ( $ portalUrl , '/' ) ) { $ resourceLocator = rtrim ( $ resourceLocator , '/' ) ; } return rtrim ( sprintf ( '%s://%s' , $ scheme , $ portalUrl ) , '/' ) . $ resourceLocator ; }
Return a valid resource locator url .
11,603
protected function loadTemplateAttributes ( $ resource , \ DOMXPath $ xpath , $ type ) { if ( 'page' === $ type || 'home' === $ type ) { $ result = [ 'key' => $ this -> getValueFromXPath ( '/x:template/x:key' , $ xpath ) , 'view' => $ this -> getValueFromXPath ( '/x:template/x:view' , $ xpath ) , 'controller' => $ this...
Load template attributes .
11,604
private function loadCacheLifetime ( $ path , \ DOMXPath $ xpath ) { $ nodeList = $ xpath -> query ( $ path ) ; if ( ! $ nodeList -> length ) { return [ 'type' => CacheLifetimeResolverInterface :: TYPE_SECONDS , 'value' => 0 , ] ; } $ node = $ nodeList -> item ( 0 ) ; $ type = $ node -> getAttribute ( 'type' ) ; if ( '...
Load cache lifetime metadata .
11,605
public function getStatement ( QueryBuilder $ queryBuilder ) { $ paramName1 = $ this -> getFieldName ( ) . $ this -> getUniqueId ( ) ; $ paramName2 = $ this -> getFieldName ( ) . $ this -> getUniqueId ( ) ; $ queryBuilder -> setParameter ( $ paramName1 , $ this -> getStart ( ) ) ; $ queryBuilder -> setParameter ( $ par...
Returns a statement for an expression .
11,606
public function addFieldMapping ( $ name , $ mapping ) { $ mapping = array_merge ( [ 'encoding' => 'content' , 'property' => $ name , 'type' => null , 'mapped' => true , 'multiple' => false , 'default' => null , ] , $ mapping ) ; $ this -> fieldMappings [ $ name ] = $ mapping ; }
Add a field mapping for field with given name for example .
11,607
public function getReflectionClass ( ) { if ( $ this -> reflection ) { return $ this -> reflection ; } if ( ! $ this -> class ) { throw new \ InvalidArgumentException ( 'Cannot retrieve ReflectionClass on metadata which has no class attribute' ) ; } $ this -> reflection = new \ ReflectionClass ( $ this -> class ) ; ret...
Returns reflection - class .
11,608
public function execute ( array $ fixtures , $ purge = true , $ initialize = true , OutputInterface $ output = null ) { $ output = $ output ? : new NullOutput ( ) ; if ( true === $ initialize ) { $ output -> writeln ( '<comment>Initializing repository</comment>' ) ; $ this -> initializer -> initialize ( $ output , $ pu...
Load the given fixture classes .
11,609
public function onKernelRequest ( GetResponseEvent $ event ) { $ request = $ event -> getRequest ( ) ; $ this -> requestAnalyzer -> analyze ( $ request ) ; $ this -> baseRouteListener -> onKernelRequest ( $ event ) ; if ( false !== $ request -> attributes -> get ( static :: REQUEST_ANALYZER , true ) ) { $ this -> reque...
Analyzes the request before passing the event to the default RouterListener from symfony and validates the result afterwards .
11,610
public function getParent ( ) { $ account = $ this -> entity -> getParent ( ) ; if ( $ account ) { return new self ( $ account , $ this -> locale ) ; } return ; }
Get parent .
11,611
public function getSocialMediaProfiles ( ) { $ socialMediaProfiles = [ ] ; if ( $ this -> entity -> getSocialMediaProfiles ( ) ) { foreach ( $ this -> entity -> getSocialMediaProfiles ( ) as $ socialMediaProfile ) { $ socialMediaProfiles [ ] = $ socialMediaProfile ; } } return $ socialMediaProfiles ; }
Get social media profiles .
11,612
public function getBankAccounts ( ) { $ bankAccounts = [ ] ; if ( $ this -> entity -> getBankAccounts ( ) ) { foreach ( $ this -> entity -> getBankAccounts ( ) as $ bankAccount ) { $ bankAccounts [ ] = new BankAccount ( $ bankAccount ) ; } } return $ bankAccounts ; }
Get bankAccounts .
11,613
public function getAccountContacts ( ) { $ accountContacts = [ ] ; if ( $ this -> entity -> getAccountContacts ( ) ) { foreach ( $ this -> entity -> getAccountContacts ( ) as $ AccountContact ) { $ accountContacts [ ] = new AccountContact ( $ AccountContact , $ this -> locale ) ; } } return $ accountContacts ; }
Get accountContacts .
11,614
public function getMainContact ( ) { if ( $ this -> entity -> getMainContact ( ) ) { return new Contact ( $ this -> entity -> getMainContact ( ) , $ this -> locale ) ; } }
Get mainContact .
11,615
public function getAccountAddresses ( ) { $ accountAddresses = [ ] ; if ( $ this -> entity -> getAccountAddresses ( ) ) { foreach ( $ this -> entity -> getAccountAddresses ( ) as $ adr ) { $ accountAddress [ ] = new AccountAddress ( $ adr ) ; } } return $ accountAddresses ; }
Get accountAddresses .
11,616
public function getAddresses ( ) { $ accountAddresses = $ this -> entity -> getAccountAddresses ( ) ; $ addresses = [ ] ; if ( ! is_null ( $ accountAddresses ) ) { foreach ( $ accountAddresses as $ accountAddress ) { $ address = $ accountAddress -> getAddress ( ) ; $ address -> setPrimaryAddress ( $ accountAddress -> g...
returns addresses .
11,617
public function getMainAddress ( ) { $ accountAddresses = $ this -> entity -> getAccountAddresses ( ) ; if ( ! is_null ( $ accountAddresses ) ) { foreach ( $ accountAddresses as $ accountAddress ) { if ( $ accountAddress -> getMain ( ) ) { return $ accountAddress -> getAddress ( ) ; } } } return ; }
Returns the main address .
11,618
public function getLogo ( ) { if ( $ this -> logo ) { return [ 'id' => $ this -> logo -> getId ( ) , 'url' => $ this -> logo -> getUrl ( ) , 'thumbnails' => $ this -> logo -> getFormats ( ) , ] ; } return ; }
Get the accounts logo and return the array of different formats .
11,619
public function cleanup ( $ dirty , $ languageCode = null ) { $ replacers = $ this -> replacers [ 'default' ] ; if ( null !== $ languageCode ) { $ replacers = array_merge ( $ replacers , ( isset ( $ this -> replacers [ $ languageCode ] ) ? $ this -> replacers [ $ languageCode ] : [ ] ) ) ; } if ( count ( $ replacers ) ...
returns a clean string .
11,620
public function getProperty ( $ name ) { if ( ! isset ( $ this -> properties [ $ name ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Unknown model property "%s", in structure "%s". Known model properties: "%s". Loaded from "%s"' , $ name , $ this -> getName ( ) , implode ( '", "' , array_keys ( $ this -> pro...
Return a model property .
11,621
public function getPropertyByTagName ( $ tagName , $ highest = true ) { $ properties = $ this -> getPropertiesByTagName ( $ tagName ) ; if ( ! $ properties ) { throw new \ InvalidArgumentException ( sprintf ( 'No property with tag "%s" exists. In structure "%s" loaded from "%s"' , $ tagName , $ this -> name , $ this ->...
Return true if the structure contains a property with the given tag name .
11,622
public function getPropertiesByTagName ( $ tagName ) { $ properties = [ ] ; foreach ( $ this -> properties as $ property ) { foreach ( $ property -> tags as $ tag ) { if ( $ tag [ 'name' ] == $ tagName ) { $ properties [ $ property -> name ] = $ property ; } } } return $ properties ; }
Return all properties with the given tag name .
11,623
private function getMedia ( Document $ document , $ field ) { $ images = json_decode ( $ document -> getField ( $ field ) -> getValue ( ) , true ) ; if ( ! array_key_exists ( 'ids' , $ images ) || 0 === count ( $ images [ 'ids' ] ) ) { return ; } return $ images [ 'ids' ] [ 0 ] ; }
Returns media - id .
11,624
public function findUserByUsername ( $ username ) { $ qb = $ this -> createQueryBuilder ( 'user' ) -> where ( 'user.username=:username' ) ; $ query = $ qb -> getQuery ( ) ; $ query -> setParameter ( 'username' , $ username ) ; return $ query -> getSingleResult ( ) ; }
Finds a user for the given username .
11,625
public function findAllUsersByRoleId ( $ roleId ) { $ qb = $ this -> createQueryBuilder ( 'user' ) -> leftJoin ( 'user.userRoles' , 'userRole' ) -> leftJoin ( 'userRole.role' , 'role' ) -> where ( 'role=:roleId' ) ; $ query = $ qb -> getQuery ( ) ; $ query -> setParameter ( 'roleId' , $ roleId ) ; return $ query -> get...
Finds all users for the role with the given id .
11,626
public function findUserByEmail ( $ email ) { $ qb = $ this -> createQueryBuilder ( 'user' ) -> where ( 'user.email=:email' ) ; $ query = $ qb -> getQuery ( ) ; $ query -> setParameter ( 'email' , $ email ) ; return $ query -> getSingleResult ( ) ; }
Finds a user for a given email .
11,627
public function findUserByToken ( $ token ) { $ qb = $ this -> createQueryBuilder ( 'user' ) -> where ( 'user.passwordResetToken=:token' ) ; $ query = $ qb -> getQuery ( ) ; $ query -> setParameter ( 'token' , $ token ) ; return $ query -> getSingleResult ( ) ; }
Finds a user for a given password - reset - token .
11,628
public function findUserBySystem ( $ system ) { $ queryBuilder = $ this -> createQueryBuilder ( 'user' ) -> select ( 'user' , 'contact' ) -> leftJoin ( 'user.userRoles' , 'userRoles' ) -> leftJoin ( 'user.contact' , 'contact' ) -> leftJoin ( 'userRoles.role' , 'role' ) -> where ( 'role.system = :system' ) ; $ query = $...
Returns all users with the given system including their contacts .
11,629
public function searchAction ( Request $ request ) { $ queryString = $ request -> query -> get ( 'q' ) ; $ index = $ request -> query -> get ( 'index' , null ) ; $ locale = $ request -> query -> get ( 'locale' , null ) ; $ page = $ this -> listRestHelper -> getPage ( ) ; $ limit = $ this -> listRestHelper -> getLimit (...
Perform a search and return a JSON response .
11,630
public function indexesAction ( ) { return $ this -> viewHandler -> handle ( View :: create ( array_map ( function ( $ indexName ) { $ indexConfiguration = $ this -> indexConfigurationProvider -> getIndexConfiguration ( $ indexName ) ; return $ indexConfiguration ? : new IndexConfiguration ( $ indexName ) ; } , $ this ...
Return a JSON encoded scalar array of index names .
11,631
private function getIndexTotals ( $ hits ) { $ indexNames = $ this -> searchManager -> getIndexNames ( ) ; $ indexCount = array_combine ( $ indexNames , array_fill ( 0 , count ( $ indexNames ) , 0 ) ) ; foreach ( $ hits as $ hit ) { ++ $ indexCount [ $ hit -> getDocument ( ) -> getIndex ( ) ] ; } return $ indexCount ; ...
Return the category totals for the search results .
11,632
public function addLocalization ( Localization $ localization ) { $ this -> localizations [ ] = $ localization ; if ( $ localization -> isDefault ( ) ) { $ this -> setDefaultLocalization ( $ localization ) ; } if ( $ localization -> isXDefault ( ) ) { $ this -> setXDefaultLocalization ( $ localization ) ; } }
Adds the given language to the portal .
11,633
public function setEnvironments ( array $ environments ) { $ this -> environments = [ ] ; foreach ( $ environments as $ environment ) { $ this -> addEnvironment ( $ environment ) ; } }
Sets the environments for this portal .
11,634
public function getEnvironment ( $ type ) { if ( ! isset ( $ this -> environments [ $ type ] ) ) { throw new EnvironmentNotFoundException ( $ this , $ type ) ; } return $ this -> environments [ $ type ] ; }
Returns the environment with the given type and throws an exception if the environment does not exist .
11,635
private function getLanguage ( Request $ request ) { $ locale = $ this -> getRequestParameter ( $ request , 'locale' , false , null ) ; if ( $ locale ) { return $ locale ; } return $ this -> getRequestParameter ( $ request , 'language' , true ) ; }
returns language code from request .
11,636
public function getAction ( Request $ request , $ id ) { if ( null !== $ request -> get ( 'fields' ) ) { return $ this -> getContent ( $ request , $ id ) ; } return $ this -> getSingleNode ( $ request , $ id ) ; }
returns a content item with given UUID as JSON String .
11,637
private function getContent ( Request $ request , $ id ) { $ properties = array_filter ( explode ( ',' , $ request -> get ( 'fields' , '' ) ) ) ; $ excludeGhosts = $ this -> getBooleanRequestParameter ( $ request , 'exclude-ghosts' , false , false ) ; $ excludeShadows = $ this -> getBooleanRequestParameter ( $ request ...
Returns single content .
11,638
private function getTreeContent ( $ id , $ locale , $ webspaceKey , $ webspaceNodes , MappingInterface $ mapping , UserInterface $ user ) { if ( ! in_array ( $ webspaceNodes , [ static :: WEBSPACE_NODE_SINGLE , static :: WEBSPACE_NODES_ALL , null ] ) ) { throw new ParameterDataTypeException ( get_class ( $ this ) , 'we...
Returns tree response for given id .
11,639
private function getTreeForUuid ( Request $ request , $ id ) { $ language = $ this -> getLanguage ( $ request ) ; $ webspace = $ this -> getWebspace ( $ request , false ) ; $ excludeGhosts = $ this -> getBooleanRequestParameter ( $ request , 'exclude-ghosts' , false , false ) ; $ excludeShadows = $ this -> getBooleanRe...
Returns a tree along the given path with the siblings of all nodes on the path . This functionality is required for preloading the content navigation .
11,640
private function getNodesByIds ( Request $ request , $ idString ) { $ language = $ this -> getLanguage ( $ request ) ; $ webspace = $ this -> getWebspace ( $ request , false ) ; $ result = $ this -> getRepository ( ) -> getNodesByIds ( preg_split ( '/[,]/' , $ idString , - 1 , PREG_SPLIT_NO_EMPTY ) , $ webspace , $ lan...
Returns nodes by given ids .
11,641
public function indexAction ( Request $ request ) { $ language = $ this -> getLanguage ( $ request ) ; $ webspace = $ this -> getWebspace ( $ request ) ; $ result = $ this -> getRepository ( ) -> getIndexNode ( $ webspace , $ language ) ; return $ this -> handleView ( $ this -> view ( $ result ) ) ; }
returns a content item for startpage .
11,642
public function cgetAction ( Request $ request ) { if ( null !== $ request -> get ( 'fields' ) ) { return $ this -> cgetContent ( $ request ) ; } return $ this -> cgetNodes ( $ request ) ; }
returns all content items as JSON String .
11,643
public function cgetNodes ( Request $ request ) { $ tree = $ this -> getBooleanRequestParameter ( $ request , 'tree' , false , false ) ; $ ids = $ this -> getRequestParameter ( $ request , 'ids' ) ; if ( true === $ tree ) { return $ this -> getTreeForUuid ( $ request , $ this -> getRequestParameter ( $ request , 'id' ,...
Returns complete nodes .
11,644
public function putAction ( Request $ request , $ id ) { $ language = $ this -> getLanguage ( $ request ) ; $ action = $ request -> get ( 'action' ) ; $ this -> checkActionParameterSecurity ( $ action , $ language , $ id ) ; $ document = $ this -> getDocumentManager ( ) -> find ( $ id , $ language , [ 'load_ghost_conte...
saves node with given id and data .
11,645
public function postAction ( Request $ request ) { $ type = 'page' ; $ language = $ this -> getLanguage ( $ request ) ; $ action = $ request -> get ( 'action' ) ; $ this -> checkActionParameterSecurity ( $ action , $ language ) ; $ document = $ this -> getDocumentManager ( ) -> create ( $ type ) ; $ formType = $ this -...
Updates a content item and returns result as JSON String .
11,646
public function deleteAction ( Request $ request , $ id ) { $ language = $ this -> getLanguage ( $ request ) ; $ webspace = $ this -> getWebspace ( $ request ) ; $ force = $ this -> getBooleanRequestParameter ( $ request , 'force' , false , false ) ; if ( ! $ force ) { $ references = array_filter ( $ this -> getReposit...
deletes node with given id .
11,647
private function checkActionParameterSecurity ( $ actionParameter , $ locale , $ id = null ) { $ permission = null ; switch ( $ actionParameter ) { case 'publish' : $ permission = 'live' ; break ; } if ( ! $ permission ) { return ; } $ this -> get ( 'sulu_security.security_checker' ) -> checkPermission ( new SecurityCo...
Checks if the user has the required permissions for the given action with the given locale . The additional id parameter will also include checks for the document identified by it .
11,648
private function handleActionParameter ( $ actionParameter , $ document , $ locale ) { switch ( $ actionParameter ) { case 'publish' : $ this -> getDocumentManager ( ) -> publish ( $ document , $ locale ) ; break ; } }
Delegates actions by given actionParameter which can be retrieved from the request .
11,649
public function addCondition ( \ Sulu \ Bundle \ ResourceBundle \ Entity \ Condition $ conditions ) { $ this -> conditions [ ] = $ conditions ; return $ this ; }
Add conditions .
11,650
public function removeCondition ( \ Sulu \ Bundle \ ResourceBundle \ Entity \ Condition $ conditions ) { $ this -> conditions -> removeElement ( $ conditions ) ; }
Remove conditions .
11,651
public function getIds ( ) { $ idsString = $ this -> getRequest ( ) -> get ( 'ids' ) ; return ( null !== $ idsString ) ? array_filter ( explode ( ',' , $ idsString ) ) : null ; }
Returns an array of ids to which the response should be restricted . If null is returned entities in the response should not be restricted by their id .
11,652
public function getExcludedIds ( ) { $ excludedIdsString = $ this -> getRequest ( ) -> get ( 'excludedIds' ) ; return ( null !== $ excludedIdsString ) ? array_filter ( explode ( ',' , $ excludedIdsString ) ) : [ ] ; }
Returns an array of ids which should be excluded from the response .
11,653
public function getLimit ( ) { $ default = 10 ; if ( 'csv' === $ this -> getRequest ( ) -> getRequestFormat ( ) ) { $ default = null ; } $ ids = $ this -> getIds ( ) ; if ( null != $ ids ) { $ default = count ( $ ids ) ; } return $ this -> getRequest ( ) -> get ( 'limit' , $ default ) ; }
Returns the maximum number of elements in a single response .
11,654
public function getFields ( ) { $ fields = $ this -> getRequest ( ) -> get ( 'fields' ) ; return ( null != $ fields ) ? explode ( ',' , $ fields ) : null ; }
Returns an array with all the fields which should be contained in the response . If null is returned every field should be contained .
11,655
protected function getLinkItem ( Content $ content , $ locale , $ scheme ) { $ published = ! empty ( $ content -> getPropertyWithDefault ( 'published' ) ) ; $ url = $ this -> webspaceManager -> findUrlByResourceLocator ( $ content -> getUrl ( ) , $ this -> environment , $ locale , $ content -> getWebspaceKey ( ) , null...
Returns new link item .
11,656
public function getFileVersion ( $ version ) { foreach ( $ this -> fileVersions as $ fileVersion ) { if ( $ fileVersion -> getVersion ( ) === $ version ) { return $ fileVersion ; } } return null ; }
Get file version .
11,657
public function setVersionMixin ( AbstractMappingEvent $ event ) { if ( ! $ this -> support ( $ event -> getDocument ( ) ) ) { return ; } $ event -> getNode ( ) -> addMixin ( 'mix:versionable' ) ; }
Sets the versionable mixin on the node if it is a versionable document .
11,658
public function setVersionsOnDocument ( HydrateEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> support ( $ document ) ) { return ; } $ node = $ event -> getNode ( ) ; $ versions = [ ] ; $ versionProperty = $ node -> getPropertyValueWithDefault ( static :: VERSION_PROPERTY , [ ] ) ; foreach ...
Sets the version information set on the node to the document .
11,659
public function rememberCheckoutUuids ( PersistEvent $ event ) { if ( ! $ this -> support ( $ event -> getDocument ( ) ) ) { return ; } $ this -> checkoutUuids [ ] = $ event -> getNode ( ) -> getIdentifier ( ) ; }
Remember which uuids need to be checked out after everything has been saved .
11,660
public function rememberCreateVersion ( PublishEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> support ( $ document ) ) { return ; } $ this -> checkpointUuids [ ] = [ 'uuid' => $ event -> getNode ( ) -> getIdentifier ( ) , 'locale' => $ document -> getLocale ( ) , 'author' => $ event -> get...
Remember for which uuids a new version has to be created .
11,661
public function applyVersionOperations ( ) { foreach ( $ this -> checkoutUuids as $ uuid ) { $ node = $ this -> defaultSession -> getNodeByIdentifier ( $ uuid ) ; $ path = $ node -> getPath ( ) ; if ( ! $ this -> versionManager -> isCheckedOut ( $ path ) ) { $ this -> versionManager -> checkout ( $ path ) ; } } $ this ...
Apply all the operations which have been remembered after the flush .
11,662
public function restoreProperties ( RestoreEvent $ event ) { if ( ! $ this -> support ( $ event -> getDocument ( ) ) ) { $ event -> stopPropagation ( ) ; return ; } $ contentPropertyPrefix = $ this -> propertyEncoder -> localizedContentName ( '' , $ event -> getLocale ( ) ) ; $ systemPropertyPrefix = $ this -> property...
Restore the properties of the old version .
11,663
private function restoreNode ( NodeInterface $ node , NodeInterface $ frozenNode , $ contentPropertyPrefix , $ systemPropertyPrefix ) { foreach ( $ node -> getProperties ( ) as $ property ) { if ( $ this -> isRestoreProperty ( $ property -> getName ( ) , $ contentPropertyPrefix , $ systemPropertyPrefix ) ) { $ property...
Restore given node with properties given from frozen - node . Will be called recursive .
11,664
public function addSetting ( RoleSettingInterface $ setting ) { $ this -> settings -> set ( $ setting -> getKey ( ) , $ setting ) ; return $ this ; }
Add setting .
11,665
private function createWebspaceNode ( $ webspaceKey , $ languageCode , $ depth = 1 , $ excludeGhosts = false ) { $ webspace = $ this -> webspaceManager -> getWebspaceCollection ( ) -> getWebspace ( $ webspaceKey ) ; if ( $ depth > 0 ) { $ nodes = $ this -> getMapper ( ) -> loadByParent ( null , $ webspaceKey , $ langua...
Creates a webspace node .
11,666
private function getParentNode ( $ parent , $ webspaceKey , $ languageCode ) { if ( null != $ parent ) { return $ this -> getMapper ( ) -> load ( $ parent , $ webspaceKey , $ languageCode ) ; } else { return $ this -> getMapper ( ) -> loadStartPage ( $ webspaceKey , $ languageCode ) ; } }
if parent is null return home page else the page with given uuid .
11,667
private function loadNodeAndAncestors ( $ uuid , $ webspaceKey , $ locale , $ excludeGhosts , $ excludeShadows , $ complete ) { $ descendants = $ this -> getMapper ( ) -> loadNodeAndAncestors ( $ uuid , $ locale , $ webspaceKey , $ excludeGhosts , $ excludeShadows ) ; $ descendants = array_reverse ( $ descendants ) ; $...
Load the node and its ancestors and convert them into a HATEOAS representation .
11,668
private function iterateTiers ( $ tiers , & $ result ) { reset ( $ tiers ) ; $ uuid = key ( $ tiers ) ; $ tier = array_shift ( $ tiers ) ; $ found = false ; if ( is_array ( $ result ) ) { foreach ( $ result as & $ node ) { if ( $ node [ 'id' ] === $ uuid ) { $ node [ '_embedded' ] [ 'nodes' ] = $ tier ; $ found = true ...
Iterate over the ancestor tiers and build up the result .
11,669
public static function getDebugTitle ( $ document ) { $ title = spl_object_hash ( $ document ) ; if ( $ document instanceof PathBehavior && $ document -> getPath ( ) ) { $ title .= ' (' . $ document -> getPath ( ) . ')' ; } elseif ( $ document instanceof TitleBehavior && $ document -> getTitle ( ) ) { $ title .= ' (' ....
Return a debug title for the document for use in exception messages .
11,670
public function onAuthenticationSuccess ( Request $ request , TokenInterface $ token ) { if ( $ this -> session -> get ( '_security.admin.target_path' ) && false !== strpos ( $ this -> session -> get ( '_security.admin.target_path' ) , '#' ) ) { $ url = $ this -> session -> get ( '_security.admin.target_path' ) ; } els...
Handler for AuthenticationSuccess . Returns a JsonResponse if request is an AJAX - request . Returns a RedirectResponse otherwise .
11,671
public function onAuthenticationFailure ( Request $ request , AuthenticationException $ exception ) { if ( $ request -> isXmlHttpRequest ( ) ) { $ array = [ 'message' => $ exception -> getMessage ( ) ] ; $ response = new JsonResponse ( $ array , 401 ) ; } else { $ this -> session -> set ( Security :: AUTHENTICATION_ERR...
Handler for AuthenticationFailure . Returns a JsonResponse if request is an AJAX - request . Returns a Redirect - response otherwise .
11,672
public function toArray ( ) { $ this -> init ( ) ; $ values = [ ] ; foreach ( array_keys ( $ this -> structureMetadata -> getProperties ( ) ) as $ childName ) { $ values [ $ childName ] = $ this -> normalize ( $ this -> getProperty ( $ childName ) -> getValue ( ) ) ; } return $ values ; }
Return an array copy of the property data .
11,673
public function setWorkflowStageOnDocument ( HydrateEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supports ( $ event ) ) { return ; } $ node = $ event -> getNode ( ) ; $ locale = $ event -> getLocale ( ) ; $ document -> setWorkflowStage ( $ node -> getPropertyValueWithDefault ( $ this -> ...
Sets the workflow properties from the node on the document .
11,674
public function setWorkflowStageToPublished ( PublishEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supports ( $ event ) ) { return ; } $ this -> setWorkflowStage ( $ document , $ event -> getAccessor ( ) , WorkflowStage :: PUBLISHED , $ event -> getLocale ( ) , true ) ; }
Sets the workflow stage for the passed document to published .
11,675
private function setWorkflowStage ( WorkflowStageBehavior $ document , DocumentAccessor $ accessor , $ workflowStage , $ locale , $ live ) { $ path = $ this -> documentInspector -> getPath ( $ document ) ; $ document -> setWorkflowStage ( $ workflowStage ) ; $ publishDate = $ document -> getPublished ( ) ; if ( ! $ pub...
Sets the workflow properties on the given document .
11,676
private function setWorkflowStageOnNode ( NodeInterface $ node , $ locale , $ workflowStage , \ DateTime $ publishDate = null ) { $ node -> setProperty ( $ this -> propertyEncoder -> localizedSystemName ( self :: WORKFLOW_STAGE_FIELD , $ locale ) , $ workflowStage ) ; if ( $ publishDate ) { $ node -> setProperty ( $ th...
Sets the workflow stage properties on the given node .
11,677
private function cleanup ( OutputInterface $ output , NodeInterface $ node , $ rootPath , $ dryRun ) { foreach ( $ node -> getNodes ( ) as $ childNode ) { $ this -> cleanup ( $ output , $ childNode , $ rootPath , $ dryRun ) ; } $ path = ltrim ( str_replace ( $ rootPath , '' , $ node -> getPath ( ) ) , '/' ) ; if ( ! $ ...
Cleanup specific node and his children .
11,678
private function getUserObjectPermission ( SecurityCondition $ securityCondition , UserInterface $ user ) { $ permissions = $ this -> getPermissions ( $ securityCondition -> getObjectType ( ) , $ securityCondition -> getObjectId ( ) ) ; return $ this -> getUserObjectPermissionByArray ( $ permissions , $ user ) ; }
Returns the permissions for the given object for the given user .
11,679
private function getUserObjectPermissionByArray ( $ permissions , UserInterface $ user ) { if ( empty ( $ permissions ) ) { return [ ] ; } $ userPermission = [ ] ; $ roles = $ user -> getRoleObjects ( ) ; foreach ( $ roles as $ role ) { $ roleId = $ role -> getId ( ) ; if ( ! isset ( $ permissions [ $ roleId ] ) ) { co...
Returns the permissions for the given permission array and the given user .
11,680
private function getUserSecurityContextPermissions ( $ locale , $ securityContext , UserInterface $ user , $ checkPermissionType ) { $ userPermissions = [ ] ; foreach ( $ user -> getUserRoles ( ) as $ userRole ) { $ userPermissions = $ this -> cumulatePermissions ( $ userPermissions , $ this -> getUserRoleSecurityConte...
Returns the permissions for the given security context for the given user .
11,681
private function getUserRoleSecurityContextPermission ( $ locale , $ securityContext , UserRole $ userRole , $ checkPermissionType ) { $ userPermission = $ this -> maskConverter -> convertPermissionsToArray ( 0 ) ; foreach ( $ userRole -> getRole ( ) -> getPermissions ( ) as $ permission ) { $ hasContext = $ permission...
Returns the permissions for the given security context for the given user role .
11,682
private function cumulatePermissions ( array $ userPermission , array $ permissions ) { return $ this -> mapPermissions ( $ userPermission , $ permissions , function ( $ permission1 , $ permission2 ) { return $ permission1 || $ permission2 ; } ) ; }
Merges all the true values for the given permission arrays .
11,683
private function restrictPermissions ( array $ userPermission , array $ permissions ) { return $ this -> mapPermissions ( $ userPermission , $ permissions , function ( $ permission1 , $ permission2 ) { return $ permission1 && $ permission2 ; } ) ; }
Merges all the values for the given permission arrays . Only returns true if all values are true .
11,684
private function getAccessControlProvider ( $ type ) { foreach ( $ this -> accessControlProviders as $ accessControlProvider ) { if ( $ accessControlProvider -> supports ( $ type ) ) { return $ accessControlProvider ; } } }
Returns the AccessControlProvider which supports the given type .
11,685
private function findAccountsByIds ( $ ids ) { if ( 0 === count ( $ ids ) ) { return [ ] ; } $ queryBuilder = $ this -> entityManager -> createQueryBuilder ( ) -> select ( 'CONCAT(\'a\', a.id) AS id, a.name AS name' ) -> from ( $ this -> accountEntityClass , 'a' ) -> where ( 'a.id IN (:ids)' ) ; $ query = $ queryBuilde...
Returns array of accounts by ids .
11,686
private function findContactsByIds ( $ ids ) { if ( 0 === count ( $ ids ) ) { return [ ] ; } $ queryBuilder = $ this -> entityManager -> createQueryBuilder ( ) -> select ( 'CONCAT(\'c\', c.id) AS id, CONCAT(CONCAT(c.firstName, \' \'), c.lastName) AS name' ) -> from ( $ this -> contactEntityClass , 'c' ) -> where ( 'c.i...
Returns array of contacts by ids .
11,687
public function cgetAction ( $ id , Request $ request ) { $ formatOptions = $ this -> getFormatOptionsManager ( ) -> getAll ( $ id ) ; return $ this -> handleView ( $ this -> view ( count ( $ formatOptions ) > 0 ? $ formatOptions : new \ stdClass ( ) ) ) ; }
Returns all format resources .
11,688
public function putAction ( $ id , $ key , Request $ request ) { $ options = $ request -> request -> all ( ) ; if ( empty ( $ options ) ) { $ this -> getFormatOptionsManager ( ) -> delete ( $ id , $ key ) ; } else { $ this -> getFormatOptionsManager ( ) -> save ( $ id , $ key , $ options ) ; } $ this -> get ( 'doctrine...
Edits a format resource .
11,689
private function dumpProviderSitemap ( $ alias , PortalInformation $ portalInformation , $ scheme ) { $ maxPage = $ this -> sitemapProviderPool -> getProvider ( $ alias ) -> getMaxPage ( ) ; for ( $ page = 1 ; $ page <= $ maxPage ; ++ $ page ) { $ sitemap = $ this -> sitemapRenderer -> renderSitemap ( $ alias , $ page ...
Render sitemap for provider .
11,690
private function removeRoute ( StructureBehavior $ document ) { foreach ( $ this -> documentInspector -> getReferrers ( $ document ) as $ referrer ) { if ( $ referrer instanceof RouteBehavior ) { $ this -> documentManager -> remove ( $ referrer ) ; } } }
Removes related route of given document .
11,691
public function getPropertyWithDefault ( $ name , $ default = null ) { if ( ! array_key_exists ( $ name , $ this -> data ) ) { return $ default ; } return $ this -> data [ $ name ] ; }
Returns value for given property or given default .
11,692
public function compareEntitiesWithData ( $ entities , array $ requestEntities , callable $ compare , callable $ add = null , callable $ update = null , callable $ delete = null ) { $ matchFunction = function ( $ entity , $ requestEntities , & $ matchedEntry , & $ matchedKey ) use ( $ compare ) { $ this -> findMatchByC...
Compares entities with data array and calls the given callbacks .
11,693
public function compareData ( $ entities , array $ requestEntities , callable $ compare = null , callable $ add = null , callable $ update = null , callable $ delete = null ) { $ success = true ; if ( ! empty ( $ entities ) ) { foreach ( $ entities as $ entity ) { $ matchedEntry = null ; $ matchedKey = null ; $ compare...
function compares entities with data of array and makes callback .
11,694
public function removeFaxe ( \ Sulu \ Bundle \ ContactBundle \ Entity \ Fax $ faxes ) { $ this -> faxes -> removeElement ( $ faxes ) ; }
Remove faxes .
11,695
public function removeAddresse ( \ Sulu \ Bundle \ ContactBundle \ Entity \ Address $ addresses ) { $ this -> addresses -> removeElement ( $ addresses ) ; }
Remove addresses .
11,696
public function setTitleOnDocument ( AbstractMappingEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supports ( $ document ) ) { return ; } if ( $ document instanceof LocalizedTitleBehavior ) { if ( ! $ event -> getLocale ( ) ) { return ; } $ document -> setTitle ( $ event -> getNode ( ) -> ...
Sets the title on the document from the node .
11,697
public function setTitleOnNode ( AbstractMappingEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supports ( $ document ) ) { return ; } if ( $ document instanceof LocalizedTitleBehavior ) { if ( ! $ event -> getLocale ( ) ) { return ; } $ event -> getNode ( ) -> setProperty ( $ this -> prope...
Sets the title on the node from the value in the document .
11,698
public function getRepository ( $ entityName ) { return new ListRepository ( $ this -> em , $ this -> em -> getClassMetadata ( $ entityName ) , $ this ) ; }
Create a ListRepository for given EntityName .
11,699
public function find ( $ entityName , $ where = [ ] , $ joinConditions = [ ] ) { return $ this -> getRepository ( $ entityName ) -> find ( $ where , 'u' , false , $ joinConditions ) ; }
Create a ListRepository for given EntityName and find Entities for list .