idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
11,000
private function generateChildNavigation ( StructureInterface $ content , $ webspace , $ language , $ flat = false , $ context = null ) { $ children = [ ] ; if ( is_array ( $ content -> getChildren ( ) ) && count ( $ content -> getChildren ( ) ) > 0 ) { $ children = $ this -> generateNavigation ( $ content -> getChildr...
generate child navigation of given content .
11,001
public function inNavigation ( StructureInterface $ content , $ context = null ) { $ contexts = $ content -> getNavContexts ( ) ; if ( Structure :: STATE_PUBLISHED !== $ content -> getNodeState ( ) ) { return false ; } if ( is_array ( $ contexts ) && ( null === $ context || in_array ( $ context , $ contexts ) ) ) { ret...
checks if content should be displayed .
11,002
public function getAction ( $ id ) { $ find = function ( $ id ) { return $ this -> getUserManager ( ) -> getUserById ( $ id ) ; } ; $ view = $ this -> responseGetById ( $ id , $ find ) ; $ this -> addSerializationGroups ( $ view ) ; return $ this -> handleView ( $ view ) ; }
Returns the user with the given id .
11,003
public function postAction ( Request $ request ) { try { $ this -> checkArguments ( $ request ) ; $ locale = $ this -> getRequestParameter ( $ request , 'locale' , true ) ; $ data = $ request -> request -> all ( ) ; $ data [ 'contactId' ] = $ request -> query -> get ( 'contactId' ) ; $ user = $ this -> getUserManager (...
Creates a new user in the system .
11,004
public function putAction ( Request $ request , $ id ) { try { $ this -> checkArguments ( $ request ) ; $ locale = $ this -> getRequestParameter ( $ request , 'locale' , true ) ; $ user = $ this -> getUserManager ( ) -> save ( $ request -> request -> all ( ) , $ locale , $ id ) ; $ view = $ this -> view ( $ user , 200 ...
Updates the given user with the given data .
11,005
public function deleteAction ( $ id ) { $ delete = $ this -> getUserManager ( ) -> delete ( ) ; $ view = $ this -> responseDelete ( $ id , $ delete ) ; return $ this -> handleView ( $ view ) ; }
Deletes the user with the given id .
11,006
public function cgetAction ( Request $ request ) { $ view = null ; if ( 'true' == $ request -> get ( 'flat' ) ) { $ restHelper = $ this -> get ( 'sulu_core.doctrine_rest_helper' ) ; $ factory = $ this -> get ( 'sulu_core.doctrine_list_builder_factory' ) ; $ listBuilder = $ factory -> create ( $ this -> container -> get...
Returns a user with a specific contact id or all users optional parameter flat calls listAction .
11,007
public function cgetAction ( ) { $ localizationManager = $ this -> get ( 'sulu.core.localization_manager' ) ; $ representation = new CollectionRepresentation ( array_values ( $ localizationManager -> getLocalizations ( ) ) , 'localizations' ) ; return $ this -> handleView ( $ this -> view ( $ representation , 200 ) ) ;...
Returns all the localizations available in this system .
11,008
public function indexAction ( Request $ request ) { if ( null !== ( $ response = $ this -> getDumpedIndexResponse ( $ request ) ) ) { return $ response ; } $ sitemap = $ this -> get ( 'sulu_website.sitemap.xml_renderer' ) -> renderIndex ( ) ; if ( ! $ sitemap ) { $ aliases = array_keys ( $ this -> get ( 'sulu_website.s...
Render sitemap - index of all available sitemap . xml files . If only one provider exists this provider will be rendered directly .
11,009
public function sitemapAction ( $ alias ) { if ( ! $ this -> get ( 'sulu_website.sitemap.pool' ) -> hasProvider ( $ alias ) ) { return new Response ( null , 404 ) ; } return $ this -> redirectToRoute ( 'sulu_website.paginated_sitemap' , [ 'alias' => $ alias , 'page' => 1 ] , 301 ) ; }
Redirect to the first page of a single sitemap provider .
11,010
public function sitemapPaginatedAction ( Request $ request , $ alias , $ page ) { if ( null !== ( $ response = $ this -> getDumpedSitemapResponse ( $ request , $ alias , $ page ) ) ) { return $ response ; } $ portal = $ request -> get ( '_sulu' ) -> getAttribute ( 'portal' ) ; $ localization = $ request -> get ( '_sulu...
Render a single page for a single sitemap . xml provider .
11,011
private function setCacheLifetime ( Response $ response ) { $ response -> headers -> set ( SuluHttpCache :: HEADER_REVERSE_PROXY_TTL , $ response -> getAge ( ) + $ this -> container -> getParameter ( 'sulu_website.sitemap.cache.lifetime' ) ) ; return $ response -> setMaxAge ( 240 ) -> setSharedMaxAge ( 960 ) ; }
Set cache headers .
11,012
private function createBinaryFileResponse ( $ file ) { $ response = new BinaryFileResponse ( $ file ) ; $ response -> headers -> addCacheControlDirective ( 'no-store' , true ) ; return $ response ; }
Create a binary file response .
11,013
public function setPermissions ( $ type , $ identifier , $ permissions ) { foreach ( $ permissions as $ roleId => $ rolePermissions ) { $ accessControl = $ this -> accessControlRepository -> findByTypeAndIdAndRole ( $ type , $ identifier , $ roleId ) ; if ( $ accessControl ) { $ accessControl -> setPermissions ( $ this...
Sets the permissions for the object with the given class and id for the given security identity .
11,014
public function getPermissions ( $ type , $ identifier ) { $ accessControls = $ this -> accessControlRepository -> findByTypeAndId ( $ type , $ identifier ) ; $ permissions = [ ] ; foreach ( $ accessControls as $ accessControl ) { $ permissions [ $ accessControl -> getRole ( ) -> getId ( ) ] = $ this -> maskConverter -...
Returns the permissions for all security identities .
11,015
public function getAction ( $ roleId , $ key ) { $ settingValue = $ this -> get ( 'sulu.repository.role_setting' ) -> findSettingValue ( $ roleId , $ key ) ; return $ this -> handleView ( $ this -> view ( $ settingValue ) ) ; }
Returns value for given role - setting .
11,016
public function putAction ( Request $ request , $ roleId , $ key ) { $ entityManager = $ this -> get ( 'doctrine.orm.entity_manager' ) ; $ repository = $ this -> get ( 'sulu.repository.role_setting' ) ; $ setting = $ repository -> findSetting ( $ roleId , $ key ) ; if ( ! $ setting ) { $ setting = $ repository -> creat...
Save role - setting with value from request body .
11,017
protected function getClassMappingConfiguration ( $ className ) { if ( array_key_exists ( $ className , $ this -> mappings ) ) { return [ 'className' => $ className , 'mapping' => $ this -> mappings [ $ className ] , ] ; } $ reflection = new \ ReflectionClass ( $ className ) ; while ( $ reflection = $ reflection -> get...
Get class mapping configuration by class name or inheritance chain .
11,018
public function cgetAction ( Request $ request ) { if ( 'true' == $ request -> get ( 'flat' ) ) { $ restHelper = $ this -> get ( 'sulu_core.doctrine_rest_helper' ) ; $ factory = $ this -> get ( 'sulu_core.doctrine_list_builder_factory' ) ; $ listBuilder = $ factory -> create ( $ this -> container -> getParameter ( 'sul...
returns all roles .
11,019
public function getAction ( $ id ) { $ find = function ( $ id ) { $ role = $ this -> getRoleRepository ( ) -> findRoleById ( $ id ) ; return $ this -> convertRole ( $ role ) ; } ; $ view = $ this -> responseGetById ( $ id , $ find ) ; return $ this -> handleView ( $ view ) ; }
Returns the role with the given id .
11,020
public function postAction ( Request $ request ) { $ name = $ request -> get ( 'name' ) ; $ system = $ request -> get ( 'system' ) ; try { if ( null === $ name ) { throw new InvalidArgumentException ( 'Role' , 'name' ) ; } if ( null === $ system ) { throw new InvalidArgumentException ( 'Role' , 'name' ) ; } $ em = $ th...
Creates a new role with the given data .
11,021
public function putAction ( Request $ request , $ id ) { $ role = $ this -> getRoleRepository ( ) -> findRoleById ( $ id ) ; try { if ( ! $ role ) { throw new EntityNotFoundException ( $ this -> getRoleRepository ( ) -> getClassName ( ) , $ id ) ; } else { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ name = $...
Updates the role with the given id and the data given by the request .
11,022
public function deleteAction ( $ id ) { $ delete = function ( $ id ) { $ role = $ this -> getRoleRepository ( ) -> findRoleById ( $ id ) ; if ( ! $ role ) { throw new EntityNotFoundException ( $ this -> getRoleRepository ( ) -> getClassName ( ) , $ id ) ; } $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> r...
Deletes the role with the given id .
11,023
protected function processPermissions ( RoleInterface $ role , $ permissions ) { $ restHelper = $ this -> get ( 'sulu_core.doctrine_rest_helper' ) ; $ get = function ( $ entity ) { return $ entity -> getId ( ) ; } ; $ delete = function ( $ permission ) { $ this -> getDoctrine ( ) -> getManager ( ) -> remove ( $ permiss...
Process all permissions from request .
11,024
protected function addPermission ( RoleInterface $ role , $ permissionData ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ alreadyContains = false ; if ( isset ( $ permissionData [ 'id' ] ) ) { $ permission = $ em -> getRepository ( static :: ENTITY_NAME_PERMISSION ) -> find ( $ permissionData [ 'id' ] ) ; i...
Adds a permission to the given role .
11,025
private function updatePermission ( Permission $ permission , $ permissionData ) { $ permission -> setContext ( $ permissionData [ 'context' ] ) ; $ permission -> setPermissions ( $ this -> get ( 'sulu_security.mask_converter' ) -> convertPermissionsToNumber ( $ permissionData [ 'permissions' ] ) ) ; return true ; }
Updates an already existing permission .
11,026
protected function convertRole ( RoleInterface $ role ) { $ roleData [ 'id' ] = $ role -> getId ( ) ; $ roleData [ 'name' ] = $ role -> getName ( ) ; $ roleData [ 'identifier' ] = $ role -> getIdentifier ( ) ; $ roleData [ 'system' ] = $ role -> getSystem ( ) ; $ roleData [ 'permissions' ] = [ ] ; $ permissions = $ rol...
Converts a role object into an array for the rest service .
11,027
private function setSecurityType ( $ role , $ securityTypeData ) { $ securityType = $ this -> getDoctrine ( ) -> getRepository ( 'SuluSecurityBundle:SecurityType' ) -> findSecurityTypeById ( $ securityTypeData [ 'id' ] ) ; if ( ! $ securityType ) { throw new EntityNotFoundException ( 'SuluSecurityBundle:SecurityType' ,...
Sets the securityType from the given data to the role .
11,028
private function buildSelectForStructures ( $ locale , $ structures , & $ names ) { $ result = '' ; foreach ( $ structures as $ structure ) { $ result .= $ this -> buildSelectForStructure ( $ locale , $ structure , $ names ) ; } return $ result ; }
Returns select statement with all url and title properties .
11,029
private function buildSelectForStructure ( $ locale , StructureInterface $ structure , & $ names ) { $ nodeNameProperty = $ structure -> getProperty ( 'title' ) ; $ result = '' ; $ name = $ this -> getTranslatedProperty ( $ nodeNameProperty , $ locale ) -> getName ( ) ; if ( ! in_array ( $ name , $ names ) ) { $ names ...
Returns select of a single structure with title and url selector .
11,030
private function buildSelectorForExcerpt ( $ locale , & $ additionalFields ) { $ excerptStructure = $ this -> structureManager -> getStructure ( 'excerpt' ) ; $ extension = $ this -> extensionManager -> getExtension ( '' , 'excerpt' ) ; foreach ( $ excerptStructure -> getProperties ( true ) as $ property ) { $ addition...
Returns a select statement for excerpt data .
11,031
public function unsetMain ( $ arrayCollection ) { if ( $ arrayCollection && ! $ arrayCollection -> isEmpty ( ) ) { return $ arrayCollection -> forAll ( function ( $ index , $ entry ) { if ( true === $ entry -> getMain ( ) ) { $ entry -> setMain ( false ) ; return false ; } return true ; } ) ; } }
unsets main of all elements of an ArrayCollection | PersistanceCollection .
11,032
public function setMainForCollection ( $ arrayCollection ) { if ( $ arrayCollection && ! $ arrayCollection -> isEmpty ( ) && ! $ this -> hasMain ( $ arrayCollection ) ) { $ arrayCollection -> first ( ) -> setMain ( true ) ; } }
sets the first element to main if none is set .
11,033
private function hasMain ( $ arrayCollection , & $ mainEntity = null ) { if ( $ arrayCollection && ! $ arrayCollection -> isEmpty ( ) ) { return $ arrayCollection -> exists ( function ( $ index , $ entity ) { $ mainEntity = $ entity ; return true === $ entity -> getMain ( ) ; } ) ; } return false ; }
checks if a collection for main attribute .
11,034
public function setMainEmail ( $ entity ) { if ( $ entity -> getEmails ( ) -> isEmpty ( ) ) { $ entity -> setMainEmail ( null ) ; } else { $ entity -> setMainEmail ( $ entity -> getEmails ( ) -> first ( ) -> getEmail ( ) ) ; } }
sets Entity s Main - Email .
11,035
public function setMainPhone ( $ entity ) { if ( $ entity -> getPhones ( ) -> isEmpty ( ) ) { $ entity -> setMainPhone ( null ) ; } else { $ entity -> setMainPhone ( $ entity -> getPhones ( ) -> first ( ) -> getPhone ( ) ) ; } }
sets Entity s Main - Phone .
11,036
public function setMainFax ( $ entity ) { if ( $ entity -> getFaxes ( ) -> isEmpty ( ) ) { $ entity -> setMainFax ( null ) ; } else { $ entity -> setMainFax ( $ entity -> getFaxes ( ) -> first ( ) -> getFax ( ) ) ; } }
sets Entity s Main - Fax .
11,037
public function setMainUrl ( $ entity ) { if ( $ entity -> getUrls ( ) -> isEmpty ( ) ) { $ entity -> setMainUrl ( null ) ; } else { $ entity -> setMainUrl ( $ entity -> getUrls ( ) -> first ( ) -> getUrl ( ) ) ; } }
sets Entity s Main - Url .
11,038
public function getAccounContact ( AccountInterface $ account , Contact $ contact ) { foreach ( $ contact -> getAccountContacts ( ) as $ accountContact ) { if ( $ accountContact -> getAccount ( ) === $ account ) { return $ accountContact ; } } return ; }
Returns AccountContact relation if exists .
11,039
public function getMainAccountContact ( $ contact ) { foreach ( $ contact -> getAccountContacts ( ) as $ accountContact ) { if ( $ accountContact -> getMain ( ) ) { return $ accountContact ; } } return false ; }
returns the main account - contact relation .
11,040
public function createMainAccountContact ( Contact $ contact , AccountInterface $ account , $ position = null ) { $ accountContact = new AccountContact ( ) ; $ accountContact -> setAccount ( $ account ) ; $ accountContact -> setContact ( $ contact ) ; $ accountContact -> setMain ( true ) ; $ this -> em -> persist ( $ a...
creates a new main Account Contacts relation .
11,041
public function deleteAllRelations ( $ entity ) { $ this -> deleteNotes ( $ entity ) ; $ this -> deleteAddresses ( $ entity ) ; $ this -> deleteEmails ( $ entity ) ; $ this -> deleteFaxes ( $ entity ) ; $ this -> deleteSocialMediaProfiles ( $ entity ) ; $ this -> deletePhones ( $ entity ) ; $ this -> deleteUrls ( $ ent...
clears all relational data from entity and deletes it .
11,042
public function deleteAddresses ( $ entity ) { if ( $ entity -> getAccountAddresses ( ) ) { foreach ( $ entity -> getAccountAddresses ( ) as $ accountAddresses ) { $ this -> em -> remove ( $ accountAddresses -> getAddress ( ) ) ; $ this -> em -> remove ( $ accountAddresses ) ; } } }
deletes all addresses that are assigned to entity .
11,043
public function getDeliveryAddress ( $ entity , $ force = false ) { $ conditionCallback = function ( $ address ) { return $ address -> getDeliveryAddress ( ) ; } ; return $ this -> getAddressByCondition ( $ entity , $ conditionCallback , $ force ) ; }
Returns the delivery address .
11,044
public function contactIsEmployeeOfAccount ( $ contact , $ account ) { if ( $ contact -> getAccountContacts ( ) && ! $ contact -> getAccountContacts ( ) -> isEmpty ( ) ) { foreach ( $ contact -> getAccountContacts ( ) as $ accountContact ) { if ( $ accountContact -> getAccount ( ) -> getId ( ) === $ account -> getId ( ...
checks if an account is employee of a company .
11,045
private function getAddresses ( $ entity ) { if ( $ entity instanceof AccountInterface ) { return $ entity -> getAccountAddresses ( ) ; } elseif ( $ entity instanceof Contact ) { return $ entity -> getContactAddresses ( ) ; } return ; }
returns addresses from account or contact .
11,046
public function getAddressByCondition ( $ entity , callable $ conditionCallback , $ force = false ) { $ addresses = $ this -> getAddresses ( $ entity ) ; $ address = null ; $ main = null ; if ( ! is_null ( $ addresses ) ) { foreach ( $ addresses as $ address ) { if ( $ conditionCallback ( $ address -> getAddress ( ) ) ...
Returns an address by callback - condition .
11,047
public function addNewContactRelations ( $ contact , $ data ) { $ urls = $ this -> getProperty ( $ data , 'urls' ) ; if ( ! empty ( $ urls ) ) { foreach ( $ urls as $ urlData ) { $ this -> addUrl ( $ contact , $ urlData ) ; } $ this -> setMainUrl ( $ contact ) ; } $ faxes = $ this -> getProperty ( $ data , 'faxes' ) ; ...
adds new relations .
11,048
public function processEmails ( $ contact , $ emails ) { $ get = function ( $ email ) { return $ email -> getId ( ) ; } ; $ delete = function ( $ email ) use ( $ contact ) { return $ contact -> removeEmail ( $ email ) ; } ; $ update = function ( $ email , $ matchedEntry ) { return $ this -> updateEmail ( $ email , $ ma...
Process all emails from request .
11,049
protected function addEmail ( $ contact , $ emailData ) { $ success = true ; $ emailType = $ this -> em -> getRepository ( self :: $ emailTypeEntityName ) -> find ( $ emailData [ 'emailType' ] [ 'id' ] ) ; if ( isset ( $ emailData [ 'id' ] ) ) { throw new EntityIdAlreadySetException ( self :: $ emailEntityName , $ emai...
Adds a new email to the given contact and persist it with the given object manager .
11,050
protected function updateEmail ( Email $ email , $ entry ) { $ success = true ; $ emailType = $ this -> em -> getRepository ( self :: $ emailTypeEntityName ) -> find ( $ entry [ 'emailType' ] [ 'id' ] ) ; if ( ! $ emailType ) { throw new EntityNotFoundException ( self :: $ emailTypeEntityName , $ entry [ 'emailType' ] ...
Updates the given email address .
11,051
public function processUrls ( $ contact , $ urls ) { $ get = function ( $ url ) { return $ url -> getId ( ) ; } ; $ delete = function ( $ url ) use ( $ contact ) { return $ contact -> removeUrl ( $ url ) ; } ; $ update = function ( $ url , $ matchedEntry ) { return $ this -> updateUrl ( $ url , $ matchedEntry ) ; } ; $...
Process all urls of request .
11,052
public function processCategories ( $ contact , $ categoryIds ) { $ contact -> getCategories ( ) -> clear ( ) ; if ( ! $ categoryIds ) { return true ; } foreach ( $ categoryIds as $ categoryId ) { $ category = $ this -> em -> getRepository ( self :: $ categoryEntityName ) -> find ( $ categoryId ) ; if ( ! $ category ) ...
Process all categories of request .
11,053
protected function addUrl ( $ contact , $ data ) { $ success = true ; $ urlType = $ this -> em -> getRepository ( self :: $ urlTypeEntityName ) -> find ( $ data [ 'urlType' ] [ 'id' ] ) ; if ( isset ( $ data [ 'id' ] ) ) { throw new EntityIdAlreadySetException ( self :: $ urlEntityName , $ data [ 'id' ] ) ; } elseif ( ...
Adds a new tag to the given contact .
11,054
public function processPhones ( $ contact , $ phones ) { $ get = function ( $ phone ) { return $ phone -> getId ( ) ; } ; $ delete = function ( $ phone ) use ( $ contact ) { return $ contact -> removePhone ( $ phone ) ; } ; $ update = function ( $ phone , $ matchedEntry ) { return $ this -> updatePhone ( $ phone , $ ma...
Process all phones from request .
11,055
protected function addPhone ( $ contact , $ phoneData ) { $ success = true ; $ phoneType = $ this -> em -> getRepository ( self :: $ phoneTypeEntityName ) -> find ( $ phoneData [ 'phoneType' ] [ 'id' ] ) ; if ( isset ( $ phoneData [ 'id' ] ) ) { throw new EntityIdAlreadySetException ( self :: $ phoneEntityName , $ phon...
Add a new phone to the given contact and persist it with the given object manager .
11,056
protected function updatePhone ( Phone $ phone , $ entry ) { $ success = true ; $ phoneType = $ this -> em -> getRepository ( self :: $ phoneTypeEntityName ) -> find ( $ entry [ 'phoneType' ] [ 'id' ] ) ; if ( ! $ phoneType ) { throw new EntityNotFoundException ( self :: $ phoneTypeEntityName , $ entry [ 'phoneType' ] ...
Updates the given phone .
11,057
protected function getBooleanValue ( $ value ) { if ( is_string ( $ value ) ) { return 'true' === $ value ? true : false ; } elseif ( is_bool ( $ value ) ) { return $ value ; } elseif ( is_numeric ( $ value ) ) { return 1 === $ value ? true : false ; } }
Checks if a value is a boolean and converts it if necessary and returns it .
11,058
public function processNotes ( $ contact , $ notes ) { $ get = function ( $ note ) { return $ note -> getId ( ) ; } ; $ delete = function ( $ note ) use ( $ contact ) { $ contact -> removeNote ( $ note ) ; return true ; } ; $ update = function ( $ note , $ matchedEntry ) { return $ this -> updateNote ( $ note , $ match...
Process all notes from request .
11,059
public function processTags ( $ contact , $ tags ) { $ get = function ( $ tag ) { return $ tag -> getId ( ) ; } ; $ delete = function ( $ tag ) use ( $ contact ) { return $ contact -> removeTag ( $ tag ) ; } ; $ update = function ( ) { return true ; } ; $ add = function ( $ tag ) use ( $ contact ) { return $ this -> ad...
Process all tags of request .
11,060
protected function addTag ( $ contact , $ data ) { $ success = true ; $ resolvedTag = $ this -> getTagManager ( ) -> findByName ( $ data ) ; $ contact -> addTag ( $ resolvedTag ) ; return $ success ; }
Adds a new tag to the given contact and persist it with the given object manager .
11,061
public function processBankAccounts ( $ contact , $ bankAccounts ) { $ get = function ( $ bankAccount ) { return $ bankAccount -> getId ( ) ; } ; $ delete = function ( $ bankAccounts ) use ( $ contact ) { $ contact -> removeBankAccount ( $ bankAccounts ) ; return true ; } ; $ update = function ( $ bankAccounts , $ matc...
Process all bankAccounts of a request .
11,062
public function processAddresses ( $ contact , $ addresses ) { $ getAddressId = function ( $ addressRelation ) { return $ addressRelation -> getAddress ( ) -> getId ( ) ; } ; $ delete = function ( $ addressRelation ) use ( $ contact ) { $ this -> removeAddressRelation ( $ contact , $ addressRelation ) ; return true ; }...
Process all addresses from request .
11,063
public function handleHydrate ( HydrateEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ document instanceof RouteBehavior ) { return ; } $ document -> setHistory ( $ event -> getNode ( ) -> getPropertyValue ( self :: NODE_HISTORY_FIELD ) ) ; }
Writes the history status of the node to the document .
11,064
public function handleSetNodeOnPersist ( PersistEvent $ event ) { $ document = $ event -> getDocument ( ) ; $ options = $ event -> getOptions ( ) ; if ( ! $ document instanceof RouteBehavior || ! array_key_exists ( 'path' , $ options ) ) { return ; } $ parentPath = PathHelper :: getParentPath ( $ options [ 'path' ] ) ;...
Receives node for route and overwrite when the node is empty .
11,065
public function handlePersist ( PersistEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ document instanceof RouteBehavior ) { return ; } $ node = $ event -> getNode ( ) ; $ node -> setProperty ( self :: NODE_HISTORY_FIELD , $ document -> isHistory ( ) ) ; $ targetDocument = $ document -> getTargetDo...
Updates the route for the given document and creates history routes if necessary .
11,066
public function handleRemove ( RemoveEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ document instanceof RouteBehavior ) { return ; } $ this -> recursivelyRemoveRoutes ( $ document ) ; }
Removes the routes for the given document and removes history routes if necessary .
11,067
public function handlePublish ( PublishEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ document instanceof RouteBehavior ) { return ; } $ event -> getNode ( ) -> setProperty ( self :: NODE_HISTORY_FIELD , $ document -> isHistory ( ) ) ; }
Handles the history field for the route on publish .
11,068
private function recursivelyRemoveRoutes ( RouteBehavior $ document ) { $ referrers = $ this -> documentInspector -> getReferrers ( $ document ) ; foreach ( $ referrers as $ referrer ) { if ( ! $ referrer instanceof RouteBehavior ) { continue ; } $ this -> recursivelyRemoveRoutes ( $ referrer ) ; $ this -> documentMana...
Remove given Route and his history .
11,069
private function changeOldPathToHistoryRoutes ( RouteBehavior $ oldDocument , RouteBehavior $ newDocument ) { $ oldDocument -> setTargetDocument ( $ newDocument ) ; $ oldDocument -> setHistory ( true ) ; $ oldRouteNode = $ this -> documentInspector -> getNode ( $ oldDocument ) ; $ oldRouteNode -> setProperty ( self :: ...
Changes the old route to a history route and redirect to the new route .
11,070
public function getData ( ) { if ( null === $ this -> data ) { $ this -> data = $ this -> loadData ( ) ; } return $ this -> data ; }
Lazy loads the data based on the filter criteria from the config .
11,071
private function loadData ( ) { $ result = [ ] ; if ( null !== $ this -> ids && count ( $ this -> ids ) > 0 ) { $ this -> contentQueryBuilder -> init ( [ 'ids' => $ this -> ids , 'properties' => ( isset ( $ this -> params [ 'properties' ] ) ? $ this -> params [ 'properties' ] -> getValue ( ) : [ ] ) , 'published' => ! ...
lazy load data .
11,072
private function getSuluVersion ( $ dir ) { $ version = '_._._' ; $ composerFile = new SplFileInfo ( $ dir . '/composer.lock' , '' , '' ) ; if ( ! $ composerFile -> isFile ( ) ) { return $ version ; } $ composer = json_decode ( $ composerFile -> getContents ( ) , true ) ; foreach ( $ composer [ 'packages' ] as $ packag...
Read composer . lock file and return version of sulu .
11,073
private function getAppVersion ( $ dir ) { $ version = null ; $ composerFile = new SplFileInfo ( $ dir . '/composer.json' , '' , '' ) ; if ( ! $ composerFile -> isFile ( ) ) { return $ version ; } $ composerJson = json_decode ( $ composerFile -> getContents ( ) , true ) ; if ( ! array_key_exists ( 'version' , $ compose...
Read composer . json file and return version of app .
11,074
private function resolveOptions ( $ string , array $ options ) { foreach ( $ options as $ key => $ value ) { $ string = str_replace ( ':' . $ key , $ value , $ string ) ; } return $ string ; }
Resolves options for string .
11,075
public function postAction ( $ id , Request $ request ) { try { $ mediaManager = $ this -> getMediaManager ( ) ; $ systemCollectionManager = $ this -> get ( 'sulu_media.system_collections.manager' ) ; $ locale = $ this -> getLocale ( $ request ) ; $ media = $ mediaManager -> getById ( $ id , $ locale ) ; $ mediaEntity ...
Creates a new preview image and saves it to the provided media .
11,076
public function deleteAction ( $ id , Request $ request ) { try { $ mediaManager = $ this -> getMediaManager ( ) ; $ locale = $ this -> getLocale ( $ request ) ; $ media = $ mediaManager -> getById ( $ id , $ locale ) ; $ mediaEntity = $ media -> getEntity ( ) ; if ( null !== $ mediaEntity -> getPreviewImage ( ) ) { $ ...
Removes current preview image and sets default video thumbnail .
11,077
public function find ( $ prefix = 'u' ) { $ selectFromDQL = $ this -> getSelectFrom ( $ prefix ) ; $ whereDQL = $ this -> getWhere ( $ prefix ) ; if ( true != $ this -> countQuery ) { $ orderDQL = $ this -> getOrderBy ( $ prefix ) ; } else { $ orderDQL = '' ; } $ dql = sprintf ( '%s %s %s' , $ selectFromDQL , $ whereDQ...
Searches Entity by filter for fields pagination and sorted by a column .
11,078
public function justCount ( $ countAttribute = 'u.id' , $ alias = 'totalcount' ) { $ this -> countQuery = true ; $ this -> replaceSelect = 'COUNT(' . $ countAttribute . ') as ' . $ alias ; }
just return count .
11,079
private function getSelectFrom ( $ prefix = 'u' ) { $ this -> joins = '' ; $ this -> prefixes = [ $ prefix ] ; $ fieldsWhere = array_merge ( ( null != $ this -> fields ) ? $ this -> fields : [ ] , array_keys ( $ this -> where ) ) ; $ fieldsWhere = array_merge ( $ fieldsWhere , $ this -> searchTextFields , $ this -> sea...
Create a Select ... From ... Statement for given fields with joins .
11,080
private function performSelectFromField ( $ field , $ prefix = 'u' ) { $ fieldParts = explode ( '_' , $ field ) ; $ realFieldName = $ field ; if ( preg_match ( '/^(.*)\[(\d+)\]$/' , $ fieldParts [ 0 ] , $ regresult ) ) { $ fieldParts [ 0 ] = $ regresult [ 1 ] ; $ realFieldName = implode ( '_' , $ fieldParts ) ; $ this ...
solves the relations for a single field and generate dql for select and joins .
11,081
private function generateJoinCondition ( $ field ) { if ( ! array_key_exists ( $ field , $ this -> joinConditions ) ) { return '' ; } $ format = ' WITH %s' ; return sprintf ( $ format , $ this -> joinConditions [ $ field ] ) ; }
generates the join condition .
11,082
private function getWhere ( $ prefix ) { $ result = '' ; if ( count ( $ this -> where ) > 0 || count ( $ this -> searchFields ) > 0 ) { $ wheres = [ ] ; $ searches = [ ] ; $ whereKeys = array_keys ( $ this -> where ) ; $ fields = array_unique ( array_merge ( $ whereKeys , $ this -> searchFields ) ) ; foreach ( $ fields...
Get DQL for Where clause .
11,083
private function getOrderBy ( $ prefix ) { $ result = '' ; if ( null != $ this -> sorting && count ( $ this -> sorting ) > 0 ) { $ orderBy = '' ; foreach ( $ this -> sorting as $ col => $ dir ) { if ( strlen ( $ orderBy ) > 0 ) { $ orderBy .= ', ' ; } $ orderBy .= $ prefix . '.' . $ col . ' ' . $ dir ; } $ result .= ' ...
Get DQL for Sorting .
11,084
public function setPhoneType ( \ Sulu \ Bundle \ ContactBundle \ Entity \ PhoneType $ phoneType ) { $ this -> phoneType = $ phoneType ; return $ this ; }
Set phoneType .
11,085
public function import ( $ locale , $ filePath , OutputInterface $ output = null , $ format = '1.2.xliff' ) { $ parsedDataList = $ this -> getParser ( $ format ) -> parse ( $ filePath , $ locale ) ; $ failedImports = [ ] ; $ importedCounter = 0 ; $ successCounter = 0 ; if ( null === $ output ) { $ output = new NullOutp...
Import Snippet by given XLIFF - File .
11,086
private function getCountries ( ) { $ countries = [ ] ; foreach ( Intl :: getRegionBundle ( ) -> getCountryNames ( ) as $ countryCode => $ countryName ) { $ countries [ strtolower ( $ countryCode ) ] = new PropertyParameter ( strtolower ( $ countryCode ) , $ countryName ) ; } return $ countries ; }
Returns array of countries with the country - code as array key .
11,087
public function addValue ( \ Sulu \ Bundle \ ResourceBundle \ Entity \ OperatorValue $ values ) { $ this -> values [ ] = $ values ; return $ this ; }
Add values .
11,088
public function removeValue ( \ Sulu \ Bundle \ ResourceBundle \ Entity \ OperatorValue $ values ) { $ this -> values -> removeElement ( $ values ) ; }
Remove values .
11,089
private function encodePassword ( $ user , $ password , $ salt ) { $ encoder = $ this -> encoderFactory -> getEncoder ( $ user ) ; return $ encoder -> encodePassword ( $ password , $ salt ) ; }
Encodes the given password for the given password with he given salt and returns the result .
11,090
private function getRoleNames ( ) { $ roleNames = $ this -> roleRepository -> getRoleNames ( ) ; if ( empty ( $ roleNames ) ) { throw new \ RuntimeException ( sprintf ( 'The system currently has no roles. Use the "sulu:security:role:create" command to create roles.' ) ) ; } return $ roleNames ; }
Return the names of all the roles .
11,091
public function getAction ( $ id , Request $ request ) { if ( $ this -> getBooleanRequestParameter ( $ request , 'tree' , false , false ) ) { $ collections = $ this -> getCollectionManager ( ) -> getTreeById ( $ id , $ this -> getRequestParameter ( $ request , 'locale' , true ) ) ; return $ this -> handleView ( $ this ...
Shows a single collection with the given id .
11,092
public function cgetAction ( Request $ request ) { try { $ listRestHelper = $ this -> get ( 'sulu_core.list_rest_helper' ) ; $ securityChecker = $ this -> get ( 'sulu_security.security_checker' ) ; $ flat = $ this -> getBooleanRequestParameter ( $ request , 'flat' , false ) ; $ depth = $ request -> get ( 'depth' , 0 ) ...
lists all collections .
11,093
public function deleteAction ( $ id ) { $ delete = function ( $ id ) { try { $ collectionManager = $ this -> getCollectionManager ( ) ; $ collectionManager -> delete ( $ id ) ; } catch ( CollectionNotFoundException $ cnf ) { throw new EntityNotFoundException ( self :: $ entityName , $ id ) ; } catch ( MediaException $ ...
Delete a collection with the given id .
11,094
protected function moveEntity ( $ id , Request $ request ) { $ destinationId = $ this -> getRequestParameter ( $ request , 'destination' ) ; $ locale = $ this -> getRequestParameter ( $ request , 'locale' , true ) ; $ collection = $ this -> getCollectionManager ( ) -> move ( $ id , $ locale , $ destinationId ) ; $ view...
Moves an entity into another one .
11,095
private function assertExists ( $ type ) { if ( ! isset ( $ this -> typePaths [ $ type ] ) ) { throw new Exception \ DocumentTypeNotFoundException ( sprintf ( 'Structure path for document type "%s" is not mapped. Mapped structure types: "%s"' , $ type , implode ( '", "' , array_keys ( $ this -> typePaths ) ) ) ) ; } }
Assert type exists .
11,096
private function getPaths ( $ type ) { $ typeConfigs = $ this -> typePaths [ $ type ] ; $ paths = [ ] ; foreach ( $ typeConfigs as $ typeConfig ) { $ paths [ ] = $ typeConfig [ 'path' ] ; } return $ paths ; }
Get the paths from the type path configuration .
11,097
private function getCategoryQuery ( ) { return $ this -> createQueryBuilder ( 'category' ) -> leftJoin ( 'category.meta' , 'categoryMeta' ) -> leftJoin ( 'category.translations' , 'categoryTranslations' ) -> leftJoin ( 'categoryTranslations.keywords' , 'categoryKeywords' ) -> leftJoin ( 'category.parent' , 'categoryPar...
Returns the general part of the query .
11,098
protected function getOperatorQuery ( $ locale ) { $ qb = $ this -> createQueryBuilder ( 'operator' ) -> addSelect ( 'operatorValues' ) -> addSelect ( 'translations' ) -> addSelect ( 'operatorValueTranslations' ) -> leftJoin ( 'operator.translations' , 'translations' , 'WITH' , 'translations.locale = :locale' ) -> left...
Returns the query for operators .
11,099
public function postGenerateSchemaTable ( GenerateSchemaTableEventArgs $ args ) { $ classMetadata = $ args -> getClassMetadata ( ) ; $ table = $ args -> getClassTable ( ) ; foreach ( $ classMetadata -> getFieldNames ( ) as $ fieldName ) { $ mapping = $ classMetadata -> getFieldMapping ( $ fieldName ) ; if ( ! isset ( $...
Parses the mapping and adds foreign - key constraints for each references option found .