idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
11,800
protected function addAccessControl ( QueryBuilder $ queryBuilder , UserInterface $ user , $ permission , $ entityClass , $ entityAlias ) { $ queryBuilder -> leftJoin ( AccessControl :: class , 'accessControl' , 'WITH' , 'accessControl.entityClass = :entityClass AND accessControl.entityId = ' . $ entityAlias . '.id' ) ...
Adds joins and conditions to the QueryBuilder in order to only return entities the given user is allowed to see .
11,801
private function initListBuilder ( ContainerBuilder $ container , Loader \ XmlFileLoader $ loader ) { if ( SuluKernel :: CONTEXT_ADMIN === $ container -> getParameter ( 'sulu.context' ) ) { $ loader -> load ( 'list_builder.xml' ) ; } }
Initializes list builder .
11,802
protected function getExtensionData ( BasePageDocument $ document ) { $ extensionData = [ ] ; foreach ( $ document -> getExtensionsData ( ) -> toArray ( ) as $ extensionName => $ extensionProperties ) { $ extension = $ this -> extensionManager -> getExtension ( $ document -> getStructureType ( ) , $ extensionName ) ; i...
Returns a flat array with the extensions of the given document .
11,803
protected function getSettingData ( BasePageDocument $ document ) { if ( $ created = $ document -> getCreated ( ) ) { $ created = $ created -> format ( 'c' ) ; } if ( $ changed = $ document -> getChanged ( ) ) { $ changed = $ changed -> format ( 'c' ) ; } if ( $ published = $ document -> getPublished ( ) ) { $ publishe...
Returns a flat array with the settings of the given document .
11,804
protected function getDocuments ( $ webspaceKey , $ uuid = null , $ nodes = null , $ ignoredNodes = null ) { $ queryString = $ this -> getDocumentsQueryString ( $ webspaceKey , $ uuid , $ nodes , $ ignoredNodes ) ; $ query = $ this -> documentManager -> createQuery ( $ queryString , $ this -> exportLocale ) ; return $ ...
Returns all Documents from given webspace .
11,805
protected function getDocumentsQueryString ( $ webspaceKey , $ uuid = null , $ nodes = null , $ ignoredNodes = null ) { $ where = [ ] ; $ where [ ] = '([jcr:mixinTypes] = "sulu:page" OR [jcr:mixinTypes] = "sulu:home")' ; $ where [ ] = sprintf ( '(ISDESCENDANTNODE("/cmf/%s/contents") OR ISSAMENODE("/cmf/%s/contents"))' ...
Create the query to get all documents from given webspace and language .
11,806
protected function buildNodeUuidToPathWhere ( $ nodes , $ not = false ) { if ( $ nodes ) { $ paths = $ this -> getPathsByUuids ( $ nodes ) ; $ wheres = [ ] ; foreach ( $ nodes as $ key => $ uuid ) { if ( isset ( $ paths [ $ uuid ] ) ) { $ wheres [ ] = sprintf ( 'ISDESCENDANTNODE("%s")' , $ paths [ $ uuid ] ) ; } } if (...
Build query to return only specific nodes .
11,807
protected function getPathsByUuids ( $ uuids ) { $ paths = [ ] ; $ where = [ ] ; foreach ( $ uuids as $ uuid ) { $ where [ ] = sprintf ( '[jcr:uuid] = "%s"' , $ uuid ) ; } $ queryString = 'SELECT * FROM [nt:unstructured] AS a WHERE ' . implode ( ' OR ' , $ where ) ; $ query = $ this -> documentManager -> createQuery ( ...
Returns node path from given uuid .
11,808
public function onPostSerialize ( ObjectEvent $ event ) { $ teaser = $ event -> getObject ( ) ; $ visitor = $ event -> getVisitor ( ) ; $ context = $ event -> getContext ( ) ; if ( ! ( $ teaser instanceof Teaser ) ) { return ; } $ visitor -> addData ( 'teaserId' , $ context -> accept ( sprintf ( '%s;%s' , $ teaser -> g...
Add uniqueid and media - data to serialized data .
11,809
private function setNodeName ( AbstractMappingEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ document instanceof NodeNameBehavior ) { return ; } $ node = $ event -> getNode ( ) ; $ accessor = $ event -> getAccessor ( ) ; $ accessor -> set ( 'nodeName' , $ node -> getName ( ) ) ; }
Sets the node name .
11,810
private function getChildPropertyDatas ( $ child ) { $ childProperties = [ ] ; foreach ( array_keys ( $ child ) as $ childKey ) { $ childProperties [ $ childKey ] = $ this -> getPropertyData ( $ childKey , $ child , $ contentTypeName = null , $ extension = null ) ; } return $ childProperties ; }
Prepare data for structure .
11,811
private function utf8ToCharset ( $ content , $ encoding = null ) { if ( 'UTF-8' !== $ encoding && ! empty ( $ encoding ) ) { if ( function_exists ( 'mb_convert_encoding' ) ) { return mb_convert_encoding ( $ content , $ encoding , 'UTF-8' ) ; } if ( function_exists ( 'iconv' ) ) { return iconv ( 'UTF-8' , $ encoding , $...
Part of Symfony XliffFileLoader .
11,812
private function getArea ( $ template , $ area , $ locales , $ templateTitles ) { $ key = $ area [ 'key' ] ; $ titles = [ ] ; foreach ( $ locales as $ locale ) { $ title = $ templateTitles [ $ locale ] . ' ' . ucfirst ( $ key ) ; if ( isset ( $ area [ 'title' ] [ $ locale ] ) ) { $ title = $ area [ 'title' ] [ $ locale...
Get area .
11,813
public function setConditionGroup ( \ Sulu \ Bundle \ ResourceBundle \ Entity \ ConditionGroup $ conditionGroup ) { $ this -> conditionGroup = $ conditionGroup ; return $ this ; }
Set conditionGroup .
11,814
public function onPostDeserialize ( ObjectEvent $ event ) { $ targetGroupRule = $ event -> getObject ( ) ; if ( ! $ targetGroupRule instanceof TargetGroupRuleInterface ) { return ; } if ( $ targetGroupRule -> getConditions ( ) ) { foreach ( $ targetGroupRule -> getConditions ( ) as $ condition ) { $ condition -> setRul...
Called after a target group rule was deserialized .
11,815
protected function buildWhere ( $ webspaceKey , $ locale ) { $ where = [ ] ; if ( null !== $ this -> context ) { $ where [ ] = sprintf ( "page.[i18n:%s-navContexts] = '%s'" , $ locale , $ this -> context ) ; } if ( null !== $ this -> parent ) { $ where [ ] = sprintf ( "ISDESCENDANTNODE(page, '%s')" , $ this -> parent )...
Returns custom select statement .
11,816
public function getAction ( $ id , Request $ request ) { try { $ locale = $ this -> getRequestParameter ( $ request , 'locale' , true ) ; $ mediaManager = $ this -> getMediaManager ( ) ; $ view = $ this -> responseGetById ( $ id , function ( $ id ) use ( $ locale , $ mediaManager ) { $ media = $ mediaManager -> getById...
Shows a single media with the given id .
11,817
public function cgetAction ( Request $ request ) { $ locale = $ this -> getRequestParameter ( $ request , 'locale' , true ) ; $ fieldDescriptors = $ this -> getFieldDescriptors ( $ locale , false ) ; $ types = array_filter ( explode ( ',' , $ request -> get ( 'types' ) ) ) ; $ listBuilder = $ this -> getListBuilder ( $...
Lists all media .
11,818
private function getListBuilder ( Request $ request , array $ fieldDescriptors , $ types ) { $ restHelper = $ this -> get ( 'sulu_core.doctrine_rest_helper' ) ; $ factory = $ this -> get ( 'sulu_core.doctrine_list_builder_factory' ) ; $ listBuilder = $ factory -> create ( $ this -> getParameter ( 'sulu.model.media.clas...
Returns a list - builder for media list .
11,819
public function deleteAction ( $ id ) { $ delete = function ( $ id ) { try { $ this -> getMediaManager ( ) -> delete ( $ id , true ) ; } catch ( MediaNotFoundException $ e ) { $ entityName = $ this -> getParameter ( 'sulu.model.media.class' ) ; throw new EntityNotFoundException ( $ entityName , $ id ) ; } catch ( Media...
Delete a media with the given id .
11,820
protected function moveEntity ( $ id , Request $ request ) { try { $ locale = $ this -> getRequestParameter ( $ request , 'locale' , true ) ; $ destination = $ this -> getRequestParameter ( $ request , 'destination' , true ) ; $ mediaManager = $ this -> getMediaManager ( ) ; $ media = $ mediaManager -> move ( $ id , $ ...
Move an entity to another collection .
11,821
public function getContactsAction ( $ id , Request $ request ) { if ( 'true' == $ request -> get ( 'flat' ) ) { $ account = $ this -> getRepository ( ) -> findById ( $ id ) ; $ restHelper = $ this -> getRestHelper ( ) ; $ factory = $ this -> get ( 'sulu_core.doctrine_list_builder_factory' ) ; $ listBuilder = $ factory ...
Lists all contacts of an account . optional parameter flat calls listAction .
11,822
public function getAddressesAction ( $ id , Request $ request ) { if ( 'true' == $ request -> get ( 'flat' ) ) { $ restHelper = $ this -> getRestHelper ( ) ; $ factory = $ this -> get ( 'sulu_core.doctrine_list_builder_factory' ) ; $ listBuilder = $ factory -> create ( $ this -> getAccountEntityName ( ) ) ; $ restHelpe...
Lists all addresses of an account optional parameter flat calls listAction .
11,823
public function deleteContactsAction ( $ accountId , $ contactId ) { try { $ accountContact = $ this -> getDoctrine ( ) -> getRepository ( self :: $ accountContactEntityName ) -> findByForeignIds ( $ accountId , $ contactId ) ; if ( ! $ accountContact ) { throw new EntityNotFoundException ( 'AccountContact' , $ account...
Deleted account contact .
11,824
public function cgetAction ( Request $ request ) { $ locale = $ this -> getUser ( ) -> getLocale ( ) ; if ( 'true' == $ request -> get ( 'flat' ) ) { $ restHelper = $ this -> get ( 'sulu_core.doctrine_rest_helper' ) ; $ fieldDescriptors = $ this -> getFieldDescriptors ( ) ; $ listBuilder = $ this -> generateFlatListBui...
Lists all accounts . Optional parameter flat calls listAction .
11,825
protected function generateFlatListBuilder ( ) { $ factory = $ this -> get ( 'sulu_core.doctrine_list_builder_factory' ) ; $ listBuilder = $ factory -> create ( $ this -> getAccountEntityName ( ) ) ; return $ listBuilder ; }
Creates a listbuilder instance .
11,826
protected function applyRequestParameters ( Request $ request , $ listBuilder ) { if ( json_decode ( $ request -> get ( 'hasNoParent' , null ) ) ) { $ listBuilder -> where ( $ this -> getFieldDescriptorForNoParent ( ) , null ) ; } if ( json_decode ( $ request -> get ( 'hasEmail' , null ) ) ) { $ listBuilder -> whereNot...
Applies the filter parameter and hasNoparent parameter for listbuilder .
11,827
public function postAction ( Request $ request ) { $ name = $ request -> get ( 'name' ) ; try { if ( null == $ name ) { throw new RestException ( 'There is no name for the account given' ) ; } $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ account = $ this -> doPost ( $ request ) ; $ em -> persist ( $ account )...
Creates a new account .
11,828
protected function doPost ( Request $ request ) { $ accountManager = $ this -> getAccountManager ( ) ; $ account = $ this -> get ( 'sulu_contact.account_factory' ) -> createEntity ( ) ; $ account -> setName ( $ request -> get ( 'name' ) ) ; $ account -> setCorporation ( $ request -> get ( 'corporation' ) ) ; if ( null ...
Maps data from request to a new account .
11,829
public function putAction ( $ id , Request $ request ) { try { $ account = $ this -> getRepository ( ) -> findAccountById ( $ id ) ; if ( ! $ account ) { throw new EntityNotFoundException ( $ this -> getAccountEntityName ( ) , $ id ) ; } else { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ this -> doPut ( $ ac...
Edits the existing contact with the given id .
11,830
protected function doPut ( AccountInterface $ account , Request $ request ) { $ account -> setName ( $ request -> get ( 'name' ) ) ; $ account -> setCorporation ( $ request -> get ( 'corporation' ) ) ; $ accountManager = $ this -> getAccountManager ( ) ; if ( null !== $ request -> get ( 'uid' ) ) { $ account -> setUid ...
processes given entity for put .
11,831
private function setParent ( $ parentData , AccountInterface $ account ) { if ( null != $ parentData && isset ( $ parentData [ 'id' ] ) && 'null' != $ parentData [ 'id' ] && '' != $ parentData [ 'id' ] ) { $ parent = $ this -> getRepository ( ) -> findAccountById ( $ parentData [ 'id' ] ) ; if ( ! $ parent ) { throw ne...
Set parent to account .
11,832
protected function doPatch ( AccountInterface $ account , Request $ request , ObjectManager $ entityManager ) { $ accountManager = $ this -> getAccountManager ( ) ; if ( null !== $ request -> get ( 'uid' ) ) { $ account -> setUid ( $ request -> get ( 'uid' ) ) ; } if ( null !== $ request -> get ( 'registerNumber' ) ) {...
Process geiven entity for patch .
11,833
public function deleteAction ( $ id , Request $ request ) { $ delete = function ( $ id ) use ( $ request ) { $ account = $ this -> getRepository ( ) -> findAccountByIdAndDelete ( $ id ) ; if ( ! $ account ) { throw new EntityNotFoundException ( $ this -> getAccountEntityName ( ) , $ id ) ; } $ em = $ this -> getDoctrin...
Delete an account with the given id .
11,834
public function multipledeleteinfoAction ( Request $ request ) { $ ids = $ request -> get ( 'ids' ) ; $ response = [ ] ; $ numContacts = 0 ; $ numChildren = 0 ; foreach ( $ ids as $ id ) { $ account = $ this -> getRepository ( ) -> countDistinctAccountChildrenAndContacts ( $ id ) ; $ numChildren += $ account [ 'numChil...
Returns delete info for multiple ids .
11,835
public function getAction ( $ id , Request $ request ) { $ includes = explode ( ',' , $ request -> get ( 'include' ) ) ; $ accountManager = $ this -> getAccountManager ( ) ; $ locale = $ this -> getUser ( ) -> getLocale ( ) ; try { $ view = $ this -> responseGetById ( $ id , function ( $ id ) use ( $ includes , $ accou...
Shows a single account with the given id .
11,836
private function addLogos ( $ accounts , $ locale ) { $ ids = array_filter ( array_column ( $ accounts , 'logo' ) ) ; $ logos = $ this -> get ( 'sulu_media.media_manager' ) -> getFormatUrls ( $ ids , $ locale ) ; foreach ( $ accounts as $ key => $ account ) { if ( array_key_exists ( 'logo' , $ account ) && $ account [ ...
Takes an array of accounts and resets the logo - property containing the media id with the actual urls to the logo thumbnails .
11,837
private function retrieveFilter ( Request $ request ) { $ filter = [ ] ; $ ids = $ request -> get ( 'ids' ) ; if ( $ ids ) { if ( is_string ( $ ids ) ) { $ ids = explode ( ',' , $ ids ) ; } $ filter [ 'id' ] = $ ids ; } return $ filter ; }
Retrieves the ids from the request .
11,838
public function findSecurityTypeById ( $ id ) { try { $ qb = $ this -> createQueryBuilder ( 'securityType' ) -> where ( 'securityType.id=:securityTypeId' ) ; $ query = $ qb -> getQuery ( ) ; $ query -> setParameter ( 'securityTypeId' , $ id ) ; return $ query -> getSingleResult ( ) ; } catch ( NoResultException $ ex ) ...
Searches for a role with a specific id .
11,839
protected function saveProperty ( NodeInterface $ node , $ data , $ name , $ default = '' ) { $ value = isset ( $ data [ $ name ] ) ? $ data [ $ name ] : $ default ; $ node -> setProperty ( $ this -> getPropertyName ( $ name ) , $ value ) ; }
save a single property value .
11,840
protected function getMainAccountContact ( ) { $ accountContacts = $ this -> getAccountContacts ( ) ; if ( ! is_null ( $ accountContacts ) ) { foreach ( $ accountContacts as $ accountContact ) { if ( $ accountContact -> getMain ( ) ) { return $ accountContact ; } } } return ; }
Returns main account contact .
11,841
public function createProxyForNode ( $ fromDocument , NodeInterface $ targetNode , $ options = [ ] ) { $ locale = $ this -> registry -> getOriginalLocaleForDocument ( $ fromDocument ) ; if ( $ this -> registry -> hasNode ( $ targetNode , $ locale ) ) { $ document = $ this -> registry -> getDocumentForNode ( $ targetNod...
Create a new proxy object from the given document for the given target node .
11,842
public function createChildrenCollection ( $ document , array $ options = [ ] ) { $ node = $ this -> registry -> getNodeForDocument ( $ document ) ; $ locale = $ this -> registry -> getOriginalLocaleForDocument ( $ document ) ; return new ChildrenCollection ( $ node , $ this -> dispatcher , $ locale , $ options ) ; }
Create a new children collection for the given document .
11,843
public function createReferrerCollection ( $ document ) { $ node = $ this -> registry -> getNodeForDocument ( $ document ) ; $ locale = $ this -> registry -> getOriginalLocaleForDocument ( $ document ) ; return new ReferrerCollection ( $ node , $ this -> dispatcher , $ locale ) ; }
Create a new collection of referrers from a list of referencing items .
11,844
public function load ( array $ paths ) { $ finder = new Finder ( ) ; $ finder -> in ( $ paths ) ; $ finder -> name ( '*Fixture.php' ) ; foreach ( $ finder as $ file ) { $ declaredClasses = get_declared_classes ( ) ; require_once $ file ; $ declaredClassesDiff = array_diff ( get_declared_classes ( ) , $ declaredClasses ...
Load instantiate and sort all fixture files found within the given paths .
11,845
public function copyShadowProperties ( AbstractMappingEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supports ( $ document ) ) { return ; } if ( ! $ event -> getDocument ( ) -> isShadowLocaleEnabled ( ) ) { $ this -> copyToShadows ( $ event -> getDocument ( ) , $ event -> getNode ( ) ) ; }...
Handles persist event of document manager .
11,846
public function copyToShadows ( $ document , NodeInterface $ node ) { $ tags = $ this -> getTags ( $ node , $ document -> getLocale ( ) ) ; $ categories = $ this -> getCategories ( $ node , $ document -> getLocale ( ) ) ; $ navigationContext = $ this -> getNavigationContext ( $ node , $ document -> getLocale ( ) ) ; fo...
Copy tags and categories from current locale to all shadowed pages with this locale as base - locale .
11,847
public function copyFromShadow ( $ document , NodeInterface $ node ) { $ shadowLocale = $ document -> getShadowLocale ( ) ; $ tags = $ this -> getTags ( $ node , $ shadowLocale ) ; $ categories = $ this -> getCategories ( $ node , $ shadowLocale ) ; $ navigationContext = $ this -> getNavigationContext ( $ node , $ shad...
Copy tags and categories from base - locale to current locale .
11,848
protected function addMediaToEntity ( $ entityName , $ id , $ mediaId ) { try { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = $ em -> getRepository ( $ entityName ) -> find ( $ id ) ; $ media = $ this -> container -> get ( 'sulu.repository.media' ) -> find ( $ mediaId ) ; if ( ! $ entity ) { throw new...
Adds a relation between a media and the entity .
11,849
protected function removeMediaFromEntity ( $ entityName , $ id , $ mediaId ) { try { $ delete = function ( ) use ( $ entityName , $ id , $ mediaId ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = $ em -> getRepository ( $ entityName ) -> find ( $ id ) ; $ media = $ this -> container -> get ( 'sulu.re...
Removes a media from the relation with an entity .
11,850
protected function getMultipleView ( $ entityName , $ routeName , AbstractContactManager $ contactManager , $ id , $ request ) { try { $ locale = $ this -> getUser ( ) -> getLocale ( ) ; if ( 'true' === $ request -> get ( 'flat' ) ) { $ restHelper = $ this -> get ( 'sulu_core.doctrine_rest_helper' ) ; $ factory = $ thi...
Returns a view containing all media of an entity .
11,851
protected function getFieldsView ( $ entityName ) { return $ this -> handleView ( $ this -> view ( array_values ( $ this -> getFieldDescriptors ( $ entityName , null ) ) , 200 ) ) ; }
Returns the the media fields for the current entity .
11,852
private function getFieldDescriptors ( $ entityName , $ id ) { if ( null === $ this -> fieldDescriptors ) { $ this -> initFieldDescriptors ( $ entityName , $ id ) ; } return $ this -> fieldDescriptors ; }
Returns the field - descriptors . Ensures that the descriptors get only instantiated once .
11,853
private function addThumbnails ( $ entities , $ locale ) { $ ids = array_filter ( array_column ( $ entities , 'thumbnails' ) ) ; $ thumbnails = $ this -> getMediaManager ( ) -> getFormatUrls ( $ ids , $ locale ) ; foreach ( $ entities as $ key => $ entity ) { if ( array_key_exists ( 'thumbnails' , $ entity ) && $ entit...
Takes an array of entities and resets the thumbnails - property containing the media id with the actual urls to the thumbnails .
11,854
private function addUrls ( $ entities , $ locale ) { $ ids = array_filter ( array_column ( $ entities , 'id' ) ) ; $ apiEntities = $ this -> getMediaManager ( ) -> getByIds ( $ ids , $ locale ) ; $ i = 0 ; foreach ( $ entities as $ key => $ entity ) { $ entities [ $ key ] [ 'url' ] = $ apiEntities [ $ i ] -> getUrl ( )...
Takes an array of entities and resets the url - property with the actual urls to the original file .
11,855
public function onPermissionUpdate ( PermissionUpdateEvent $ event ) { if ( Collection :: class !== $ event -> getType ( ) ) { return ; } foreach ( $ this -> fileVersionMetaRepository -> findByCollectionId ( $ event -> getIdentifier ( ) ) as $ fileVersionMeta ) { $ this -> searchManager -> deindex ( $ fileVersionMeta )...
Removes all FileVersionMetas belonging to the collection which just got secured .
11,856
private function checkTemplate ( $ document , $ type ) { $ area = $ this -> areas -> get ( $ type ) ; return $ document -> getStructureType ( ) === $ area [ 'template' ] ; }
Check template .
11,857
public function handlePersistStructureType ( PersistEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supportsBehavior ( $ document ) ) { return ; } $ structureMetadata = $ this -> inspector -> getStructureMetadata ( $ document ) ; $ structure = $ document -> getStructure ( ) ; if ( $ structu...
Set the structure type early so that subsequent subscribers operate upon the correct structure type .
11,858
public function handlePersistStagedProperties ( PersistEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supportsBehavior ( $ document ) ) { return ; } $ document -> getStructure ( ) -> commitStagedData ( $ event -> getOption ( 'clear_missing_content' ) ) ; }
Commit the properties which are only staged on the structure yet .
11,859
private function getDefaultStructureType ( StructureBehavior $ document ) { $ alias = $ this -> inspector -> getMetadata ( $ document ) -> getAlias ( ) ; $ webspace = $ this -> webspaceManager -> findWebspaceByKey ( $ this -> inspector -> getWebspace ( $ document ) ) ; if ( ! $ webspace ) { return $ this -> getDefaultS...
Return the default structure for the given StructureBehavior implementing document .
11,860
private function mapContentToNode ( $ document , NodeInterface $ node , $ locale , $ ignoreRequired ) { $ structure = $ document -> getStructure ( ) ; $ webspaceName = $ this -> inspector -> getWebspace ( $ document ) ; $ metadata = $ this -> inspector -> getStructureMetadata ( $ document ) ; if ( ! $ metadata ) { thro...
Map to the content properties to the node using the content types .
11,861
private function getStructure ( $ document , $ structureType , $ rehydrate ) { if ( $ structureType ) { return $ this -> createStructure ( $ document ) ; } if ( ! $ rehydrate && $ document -> getStructure ( ) ) { return $ document -> getStructure ( ) ; } return new Structure ( ) ; }
Return the a structure for the document .
11,862
public function getLocalization ( $ localization ) { $ localizations = $ this -> getLocalizations ( ) ; if ( ! empty ( $ localizations ) ) { foreach ( $ localizations as $ webspaceLocalization ) { $ result = $ webspaceLocalization -> findLocalization ( $ localization ) ; if ( $ result ) { return $ result ; } } } return...
Returns the localization object for a given localization string .
11,863
public function setDefaultLocalization ( $ defaultLocalization ) { $ this -> defaultLocalization = $ defaultLocalization ; if ( ! $ this -> getXDefaultLocalization ( ) ) { $ this -> xDefaultLocalization = $ defaultLocalization ; } }
Sets the default localization for this webspace .
11,864
public function addSegment ( Segment $ segment ) { $ this -> segments [ ] = $ segment ; if ( $ segment -> isDefault ( ) ) { $ this -> setDefaultSegment ( $ segment ) ; } }
Adds a segment to the webspace .
11,865
public function hasDomain ( $ domain , $ environment , $ locale = null ) { $ localizationParts = explode ( '_' , $ locale ) ; $ language = $ localizationParts [ 0 ] ; $ country = isset ( $ localizationParts [ 1 ] ) ? $ localizationParts [ 1 ] : '' ; foreach ( $ this -> getPortals ( ) as $ portal ) { foreach ( $ portal ...
Returns false if domain not exists in webspace .
11,866
public function getTemplate ( $ type , $ format = 'html' ) { if ( array_key_exists ( $ type , $ this -> templates ) ) { return $ this -> templates [ $ type ] . '.' . $ format . '.twig' ; } return ; }
Returns a template for the given type .
11,867
public function getIsMultiple ( ) { $ minOccurs = $ this -> getMinOccurs ( ) ; $ maxOccurs = $ this -> getMaxOccurs ( ) ; if ( is_null ( $ minOccurs ) && is_null ( $ maxOccurs ) ) { return false ; } if ( 0 === $ minOccurs && 1 === $ maxOccurs ) { return true ; } if ( 1 === $ minOccurs && 1 === $ maxOccurs ) { return fa...
returns TRUE if property is multiple .
11,868
protected function getRequestParameter ( Request $ request , $ name , $ force = false , $ default = null ) { $ value = $ request -> get ( $ name , $ default ) ; if ( $ force && null === $ value ) { throw new MissingParameterException ( get_class ( $ this ) , $ name ) ; } return $ value ; }
returns request parameter with given name .
11,869
protected function getBooleanRequestParameter ( $ request , $ name , $ force = false , $ default = null ) { $ value = $ this -> getRequestParameter ( $ request , $ name , $ force , $ default ) ; if ( 'true' === $ value || true === $ value ) { $ value = true ; } elseif ( 'false' === $ value || false === $ value ) { $ va...
returns request parameter as boolean true = > true false = > false .
11,870
private function normalizePath ( SessionInterface $ session , $ identifier ) { if ( ! UUIDHelper :: isUUID ( $ identifier ) ) { return $ identifier ; } return $ session -> getNodeByIdentifier ( $ identifier ) -> getPath ( ) ; }
Returns the path based on the given UUID .
11,871
public function onPostSerialize ( ObjectEvent $ event ) { $ document = $ event -> getObject ( ) ; if ( ! $ document instanceof RedirectTypeBehavior ) { return ; } $ visitor = $ event -> getVisitor ( ) ; $ redirectType = $ document -> getRedirectType ( ) ; if ( RedirectType :: INTERNAL == $ redirectType && null !== $ do...
Adds the type of redirect and the redirect location to the serialization .
11,872
private function getDocumentFromNode ( NodeInterface $ node ) { $ metadata = $ this -> metadataFactory -> getMetadataForPhpcrNode ( $ node ) ; return $ this -> instantiateFromMetadata ( $ metadata ) ; }
Instantiate a new document . The class is determined from the mixins present in the PHPCR node for legacy reasons .
11,873
public function cgetAction ( Request $ request ) { $ locale = $ this -> getRequestParameter ( $ request , 'locale' , true ) ; $ entityClass = $ this -> getRequestParameter ( $ request , 'entityClass' , true ) ; $ entityId = $ this -> getRequestParameter ( $ request , 'entityId' , true ) ; $ history = $ this -> getBoole...
Returns list of routes for given entity .
11,874
private function findRoutes ( $ history , $ entityClass , $ entityId , $ locale ) { $ routeRespository = $ this -> get ( 'sulu.repository.route' ) ; if ( $ history ) { return $ routeRespository -> findHistoryByEntity ( $ entityClass , $ entityId , $ locale ) ; } return [ $ routeRespository -> findByEntity ( $ entityCla...
Find routes with given parameters .
11,875
public function deleteAction ( $ id ) { $ routeRespository = $ this -> get ( 'sulu.repository.route' ) ; $ route = $ routeRespository -> find ( $ id ) ; if ( ! $ route ) { throw new EntityNotFoundException ( RouteInterface :: class , $ id ) ; } $ entityManager = $ this -> get ( 'doctrine.orm.entity_manager' ) ; $ entit...
Delete given history - route .
11,876
public function toArray ( ) { $ res = [ ] ; foreach ( [ 'id' , 'displayTitle' , 'street' , 'number' , 'code' , 'town' , 'country' , 'longitude' , 'latitude' , ] as $ propertyName ) { $ res [ $ propertyName ] = $ this -> { 'get' . ucfirst ( $ propertyName ) } ( ) ; } $ res [ 'name' ] = TextUtils :: truncate ( $ this -> ...
Serialize the location to an array .
11,877
private function needsIndex ( ) { return 1 < count ( $ this -> sitemapProviderPool -> getProviders ( ) ) || 1 < array_reduce ( $ this -> sitemapProviderPool -> getIndex ( ) , function ( $ v1 , Sitemap $ v2 ) { return $ v1 + $ v2 -> getMaxPage ( ) ; } ) ; }
Returns true if a index exists .
11,878
private function getArrayIndexByKeyValue ( $ array , $ value , $ key = 'id' ) { foreach ( $ array as $ index => $ result ) { if ( $ result [ $ key ] === $ value ) { return $ index ; } } return false ; }
returns array index of by a specified key value .
11,879
public function getCount ( $ where = [ ] , $ joinConditions = [ ] , $ prefix = 'u' ) { return $ this -> find ( $ where , $ prefix , true , $ joinConditions ) ; }
returns the amount of data .
11,880
public function getFieldsWitTypes ( array $ types , $ intersectArray = null ) { $ result = [ ] ; foreach ( $ this -> getClassMetadata ( ) -> getFieldNames ( ) as $ field ) { $ type = $ this -> getClassMetadata ( ) -> getTypeOfField ( $ field ) ; if ( in_array ( $ type , $ types ) ) { $ result [ ] = $ field ; } } if ( !...
returns all fields with a specified type .
11,881
public function getExtension ( ) { $ pathInfo = pathinfo ( $ this -> getName ( ) ) ; $ extension = ExtensionGuesser :: getInstance ( ) -> guess ( $ this -> getMimeType ( ) ) ; if ( $ extension ) { return $ extension ; } elseif ( isset ( $ pathInfo [ 'extension' ] ) ) { return $ pathInfo [ 'extension' ] ; } return null ...
Get extension .
11,882
public function addPublishLanguage ( \ Sulu \ Bundle \ MediaBundle \ Entity \ FileVersionPublishLanguage $ publishLanguages ) { $ this -> publishLanguages [ ] = $ publishLanguages ; return $ this ; }
Add publishLanguages .
11,883
public function removePublishLanguage ( \ Sulu \ Bundle \ MediaBundle \ Entity \ FileVersionPublishLanguage $ publishLanguages ) { $ this -> publishLanguages -> removeElement ( $ publishLanguages ) ; }
Remove publishLanguages .
11,884
public function addMeta ( \ Sulu \ Bundle \ MediaBundle \ Entity \ FileVersionMeta $ meta ) { $ this -> meta [ ] = $ meta ; return $ this ; }
Add meta .
11,885
public function removeMeta ( \ Sulu \ Bundle \ MediaBundle \ Entity \ FileVersionMeta $ meta ) { $ this -> meta -> removeElement ( $ meta ) ; }
Remove meta .
11,886
public function setDefaultMeta ( \ Sulu \ Bundle \ MediaBundle \ Entity \ FileVersionMeta $ defaultMeta = null ) { $ this -> defaultMeta = $ defaultMeta ; return $ this ; }
Set defaultMeta .
11,887
public function cgetAction ( Request $ request ) { $ webspaceKey = $ request -> get ( 'webspace' ) ; $ webspaceManager = $ this -> get ( 'sulu_core.webspace.webspace_manager' ) ; $ webspace = $ webspaceManager -> findWebspaceByKey ( $ webspaceKey ) ; if ( $ webspace ) { $ localizations = new CollectionRepresentation ( ...
Returns the localizations for the given webspace .
11,888
public function getMeta ( ) { $ arrReturn = [ ] ; if ( null !== $ this -> entity -> getMeta ( ) ) { foreach ( $ this -> entity -> getMeta ( ) as $ meta ) { if ( ! $ meta -> getLocale ( ) || $ meta -> getLocale ( ) === $ this -> locale ) { array_push ( $ arrReturn , [ 'id' => $ meta -> getId ( ) , 'key' => $ meta -> get...
Returns the name of the Category dependent on the locale .
11,889
public function getCreator ( ) { $ strReturn = '' ; $ creator = $ this -> entity -> getCreator ( ) ; if ( $ creator ) { return $ this -> getUserFullName ( $ creator ) ; } return $ strReturn ; }
Returns the creator of the category .
11,890
public function getChanger ( ) { $ strReturn = '' ; $ changer = $ this -> entity -> getChanger ( ) ; if ( $ changer ) { return $ this -> getUserFullName ( $ changer ) ; } return $ strReturn ; }
Returns the changer of the category .
11,891
public function getChildren ( ) { $ children = [ ] ; if ( $ this -> entity -> getChildren ( ) ) { foreach ( $ this -> entity -> getChildren ( ) as $ child ) { $ children [ ] = new self ( $ child , $ this -> locale ) ; } } return $ children ; }
Returns the children of a category .
11,892
public function setTranslation ( CategoryTranslationInterface $ translation ) { $ translationEntity = $ this -> getTranslationByLocale ( $ translation -> getLocale ( ) ) ; if ( ! $ translationEntity ) { $ translationEntity = $ translation ; $ this -> entity -> addTranslation ( $ translationEntity ) ; } $ translationEnt...
Sets a translation to the entity . If no other translation was assigned before the translation is added as default .
11,893
public function setMeta ( $ metaEntities ) { $ currentMeta = $ this -> entity -> getMeta ( ) ; foreach ( $ metaEntities as $ singleMeta ) { $ metaEntity = $ this -> getSingleMetaById ( $ currentMeta , $ singleMeta -> getId ( ) ) ; if ( ! $ metaEntity ) { $ metaEntity = $ singleMeta ; $ this -> entity -> addMeta ( $ met...
Takes meta as array and sets it to the entity .
11,894
public function getParent ( ) { $ parent = $ this -> getEntity ( ) -> getParent ( ) ; if ( $ parent ) { return new self ( $ parent , $ this -> locale ) ; } return ; }
Returns a parent category if one exists .
11,895
public function getKeywords ( ) { $ keywords = [ ] ; $ translation = $ this -> getTranslation ( true ) ; if ( ! $ translation ) { return $ keywords ; } foreach ( $ translation -> getKeywords ( ) as $ keyword ) { $ keywords [ ] = $ keyword -> getKeyword ( ) ; } return $ keywords ; }
Returns the keywords of the category translations .
11,896
private function getUserFullName ( $ user ) { $ strReturn = '' ; if ( $ user && method_exists ( $ user , 'getContact' ) ) { $ strReturn = $ user -> getContact ( ) -> getFirstName ( ) . ' ' . $ user -> getContact ( ) -> getLastName ( ) ; } return $ strReturn ; }
Takes a user entity and returns the fullname .
11,897
private function getSingleMetaById ( $ meta , $ id ) { if ( null !== $ id ) { foreach ( $ meta as $ singleMeta ) { if ( $ singleMeta -> getId ( ) === $ id ) { return $ singleMeta ; } } } }
Takes an array of CollectionMeta and returns a single meta for a given id .
11,898
public function toArray ( ) { return [ 'id' => $ this -> getId ( ) , 'key' => $ this -> getKey ( ) , 'name' => $ this -> getName ( ) , 'meta' => $ this -> getMeta ( ) , 'keywords' => $ this -> getKeywords ( ) , 'defaultLocale' => $ this -> getDefaultLocale ( ) , 'creator' => $ this -> getCreator ( ) , 'changer' => $ th...
Returns an array representation of the object .
11,899
private function getTranslation ( $ withDefault = false ) { $ translation = $ this -> getTranslationByLocale ( $ this -> locale ) ; if ( true === $ withDefault && null === $ translation && null !== $ this -> getDefaultLocale ( ) ) { return $ this -> getTranslationByLocale ( $ this -> getDefaultLocale ( ) ) ; } return $...
Returns the translation with the current locale .