idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
20,200 | public function save ( Indexation $ index ) { $ existing = $ this -> find ( [ '_content' => $ index -> getContent ( ) , '_field' => $ index -> getField ( ) , ] ) ; if ( null === $ existing ) { $ existing = $ index ; $ this -> getEntityManager ( ) -> persist ( $ existing ) ; } else { $ existing -> setValue ( $ index -> ... | Saves an indexation entity persists it first if need . |
20,201 | public static function create ( array $ config ) { if ( false === array_key_exists ( 'transport' , $ config ) ) { throw new MisconfigurationException ( sprintf ( 'Can not create Transport : missing classname.' ) ) ; } $ classname = $ config [ 'transport' ] ; if ( false === class_exists ( $ classname ) ) { throw new Mis... | Creates a new AbstractTransport instance . |
20,202 | public static function getScheduledEntityInsertionsByClassname ( EntityManager $ em , $ classnames ) { $ entities = array ( ) ; $ classnames = ( array ) $ classnames ; foreach ( $ em -> getUnitOfWork ( ) -> getScheduledEntityInsertions ( ) as $ entity ) { if ( true === in_array ( ClassUtils :: getRealClass ( $ entity )... | Returns an array of scheduled entities by classname for insertions . |
20,203 | public static function getScheduledEntityUpdatesByClassname ( EntityManager $ em , $ classnames ) { $ entities = array ( ) ; $ classnames = ( array ) $ classnames ; foreach ( $ em -> getUnitOfWork ( ) -> getScheduledEntityUpdates ( ) as $ entity ) { if ( true === in_array ( ClassUtils :: getRealClass ( $ entity ) , $ c... | Returns an array of scheduled entities by classname for updates . |
20,204 | public static function getScheduledEntityDeletionsByClassname ( EntityManager $ em , $ classnames ) { $ entities = array ( ) ; $ classnames = ( array ) $ classnames ; foreach ( $ em -> getUnitOfWork ( ) -> getScheduledEntityDeletions ( ) as $ entity ) { if ( true === in_array ( ClassUtils :: getRealClass ( $ entity ) ,... | Returns an array of scheduled entities by classname for deletions . |
20,205 | public static function getScheduledEntityByClassname ( EntityManager $ em , $ classnames ) { return array_merge ( self :: getScheduledEntityInsertionsByClassname ( $ em , $ classnames ) , self :: getScheduledEntityUpdatesByClassname ( $ em , $ classnames ) , self :: getScheduledEntityDeletionsByClassname ( $ em , $ cla... | Returns an array of scheduled entities by classname for insertions updates or deletions . |
20,206 | public static function getScheduledAClassContentInsertions ( EntityManager $ em , $ with_revision = false , $ exclude_base_element = false ) { $ entities = array ( ) ; foreach ( $ em -> getUnitOfWork ( ) -> getScheduledEntityInsertions ( ) as $ entity ) { if ( false !== $ tmp = self :: getScheduledEntity ( $ entity , $... | Returns an array of AbstractClassContent scheduled for insertions . |
20,207 | public static function getScheduledAClassContentUpdates ( EntityManager $ em , $ with_revision = false , $ exclude_base_element = false ) { $ entities = array ( ) ; foreach ( $ em -> getUnitOfWork ( ) -> getScheduledEntityUpdates ( ) as $ entity ) { if ( false !== $ tmp = self :: getScheduledEntity ( $ entity , $ with_... | Returns an array of AbstractClassContent scheduled for updates . |
20,208 | public static function getSchedulesAClassContentDeletions ( EntityManager $ em , $ exclude_base_element = false ) { $ entities = array ( ) ; foreach ( $ em -> getUnitOfWork ( ) -> getScheduledEntityDeletions ( ) as $ entity ) { if ( $ entity instanceof AbstractClassContent && ( ! $ exclude_base_element || ! $ entity ->... | Returns an array of AbstractClassContent scheduled for deletions . |
20,209 | public static function getScheduledAClassContentNotForDeletions ( EntityManager $ em , $ with_revision = false ) { return array_merge ( self :: getScheduledAClassContentInsertions ( $ em , $ with_revision ) , self :: getScheduledAClassContentUpdates ( $ em , $ with_revision ) ) ; } | Returns an array of AbstractClassContent scheduled for insertions or updates . |
20,210 | public function onPostSerialize ( ObjectEvent $ event ) { if ( $ this -> container -> has ( 'routing' ) ) { $ uri = $ this -> container -> get ( 'routing' ) -> getUri ( $ event -> getObject ( ) -> getUrl ( ) ) ; $ event -> getVisitor ( ) -> addData ( 'uri' , $ uri ) ; } } | Method called on serializer . post_serialize event for Page object . |
20,211 | public function setTwigCache ( $ cacheDir ) { if ( ! is_dir ( $ cacheDir ) && ( ! is_writable ( dirname ( $ cacheDir ) ) || false === @ mkdir ( $ cacheDir , 0755 ) ) ) { throw new RendererException ( sprintf ( 'Unable to create twig cache "%s"' , $ cacheDir ) , RendererException :: RENDERING_ERROR ) ; } if ( ! is_writa... | Set Twig cache directory . |
20,212 | private function addDirPathIntoLoaderIfNotExists ( array $ templateDir ) { $ paths = $ this -> loader -> getPaths ( ) ; if ( ( count ( $ paths ) !== count ( $ templateDir ) ) || ( 0 < count ( array_diff ( $ paths , $ templateDir ) ) ) ) { $ this -> loader -> removeAllPaths ( ) ; try { $ this -> loader -> setPaths ( $ t... | Add dir path into loader only if it not already exists . |
20,213 | public function fake ( $ elementName = null ) { if ( $ elementName === null ) { throw new MissingRequiredOptionException ( 'element to fake' ) ; } $ this -> startElement = $ elementName ; $ this -> out = array ( ) ; $ this -> outString = null ; return $ this ; } | Setups the fake element and initializes the output . |
20,214 | public function fakeEntity ( $ entity = null ) { if ( $ entity === null ) { throw new MissingRequiredOptionException ( 'entity to fake' ) ; } $ entityFiller = new EntityFiller ( $ entity , $ this ) ; return $ entityFiller -> fill ( ) ; } | Fills the given entity with fake data . |
20,215 | public function fakeTable ( $ tableName = null ) { if ( null === $ tableName ) { throw new MissingRequiredOptionException ( 'table name' ) ; } $ dbFiller = new DbFiller ( $ this -> db , $ tableName , $ this , $ this -> num ) ; $ rows = $ dbFiller -> fill ( ) ; return $ rows ; } | Fills the given table with fake data . |
20,216 | public function fakeTemplate ( $ file ) { $ this -> template -> loadTemplate ( $ file ) ; $ varsName = $ this -> template -> getVariables ( ) ; $ out = '' ; $ num = $ this -> num ; for ( $ i = 0 ; $ i < $ num ; $ i ++ ) { $ fakeData = $ this -> num ( 1 ) -> fake ( $ varsName ) -> toArray ( ) ; $ data = array_combine ( ... | Fakes a template file . |
20,217 | public static function onApplicationReady ( Event $ event ) { $ app = $ event -> getTarget ( ) ; $ twigAdapter = $ app -> getRenderer ( ) -> getAdapter ( 'twig' ) ; if ( null === $ twigAdapter ) { return ; } foreach ( $ app -> getContainer ( ) -> findTaggedServiceIds ( 'twig.extension' ) as $ id => $ data ) { $ twigAda... | occurs on bbapplication . init . |
20,218 | private function generateMeta ( bbMetaData $ meta ) { if ( 0 === $ meta -> count ( ) || 'title' === $ meta -> getName ( ) ) { return '' ; } $ result = '<meta ' ; foreach ( $ meta as $ attribute => $ value ) { if ( false !== strpos ( $ meta -> getName ( ) , 'keyword' ) && 'content' === $ attribute ) { $ keywords = explo... | Generates HTML tag according to the metadata . |
20,219 | private function resolveResourceThumbnail ( $ defaultImage ) { $ baseFolder = $ this -> getBaseFolder ( ) ; $ iconUrl = $ baseFolder . DIRECTORY_SEPARATOR . 'default_thumbnail.png' ; foreach ( $ this -> getThumbnailBaseFolderPaths ( ) as $ path ) { $ imageFilePath = $ path . DIRECTORY_SEPARATOR . $ defaultImage ; if ( ... | Resolves the thumbnail resource URL depending on the default image provided . |
20,220 | private function getBaseFolder ( ) { $ container = $ this -> application -> getContainer ( ) ; if ( null === $ this -> baseFolder && $ container -> hasParameter ( 'classcontent_thumbnail.base_folder' ) ) { $ this -> baseFolder = $ container -> getParameter ( 'classcontent_thumbnail.base_folder' ) ; } return $ this -> b... | Returns the container base folder for thumnails or null |
20,221 | private function getThumbnailBaseFolderPaths ( ) { if ( is_array ( $ this -> thumbnailBaseDir ) ) { return $ this -> thumbnailBaseDir ; } $ this -> thumbnailBaseDir = [ ] ; if ( null !== $ baseFolder = $ this -> getBaseFolder ( ) ) { $ thumbnailBaseDir = array_map ( function ( $ directory ) use ( $ baseFolder ) { retur... | Getter of class content thumbnails folder paths |
20,222 | public static function onFlushElementFile ( Event $ event ) { $ revision = $ event -> getTarget ( ) ; $ content = $ revision -> getContent ( ) ; if ( ! ( $ content instanceof ElementFile ) || ! is_file ( $ content -> path ) ) { return ; } $ application = $ event -> getApplication ( ) ; $ em = $ application -> getEntity... | Occurs on revision . onflush events . |
20,223 | public static function onPrerenderContent ( Event $ event ) { $ dispatcher = $ event -> getDispatcher ( ) ; if ( null === $ application = $ dispatcher -> getApplication ( ) ) { return ; } if ( null === $ token = $ application -> getBBUserToken ( ) ) { return ; } $ renderer = $ event -> getEventArgs ( ) ; if ( ! is_a ( ... | Occurs on classcontent . prerender events . |
20,224 | public function save ( $ id , $ data , $ lifetime = null , $ tag = null ) { try { if ( \ apc_store ( $ id , $ data , $ lifetime ) ) { $ this -> _hashmap [ $ tag ] [ $ id ] = array ( "time" => time ( ) , "ttl" => $ lifetime ) ; return $ this -> saveHashmap ( ) ; } else { return false ; } } catch ( \ Exception $ e ) { $ ... | Store provided data into cache . |
20,225 | private function removeTag ( $ tag ) { try { if ( isset ( $ this -> _hashmap [ $ tag ] ) ) { foreach ( array_keys ( $ this -> _hashmap [ $ tag ] ) as $ key ) { if ( \ apc_delete ( $ key ) ) { unset ( $ this -> _hashmap [ $ tag ] [ $ key ] ) ; } } return $ this -> saveHashmap ( ) ; } } catch ( \ Exception $ e ) { $ this... | Removes all cache records associated to provided tag . |
20,226 | private function updateExpireTag ( $ tag , $ lifetime = null ) { try { if ( isset ( $ this -> _hashmap [ $ tag ] ) ) { foreach ( array_keys ( $ this -> _hashmap [ $ tag ] ) as $ key ) { $ value = $ this -> load ( $ key ) ; if ( $ value ) { $ this -> save ( $ key , $ value , $ lifetime , $ tag ) ; } } return true ; } } ... | Updates the TTL for all cache records associated to provided tag . |
20,227 | private function removeFromHashmapById ( $ id ) { try { foreach ( $ this -> _hashmap as $ tag => $ vars ) { foreach ( array_keys ( $ vars ) as $ key ) { if ( $ key == $ id ) { unset ( $ this -> _hashmap [ $ tag ] [ $ key ] ) ; return $ this -> saveHashmap ( ) ; } } } } catch ( \ Exception $ e ) { $ this -> log ( 'warni... | Remove provided id from hashmap . |
20,228 | private function saveHashmap ( ) { try { return \ apc_store ( $ this -> _hashmapId , $ this -> _hashmap , self :: HASHMAP_TTL ) ; } catch ( \ Exception $ e ) { $ this -> log ( 'warning' , \ sprintf ( 'Unable to store hashmap %s : %s' , $ this -> _hashmapId , $ e -> getMessage ( ) ) ) ; return false ; } } | Store hasmap for current hashmap id . |
20,229 | public function loadHashmap ( ) { try { if ( $ this -> _hashmap = \ apc_fetch ( $ this -> _hashmapId ) ) { return $ this -> _hashmap ; } else { return array ( ) ; } } catch ( \ Exception $ e ) { $ this -> log ( 'warning' , \ sprintf ( 'Unable to load hashmap %s : %s' , $ this -> _hashmapId , $ e -> getMessage ( ) ) ) ;... | Retrieve hasmap according current hashmap id . |
20,230 | public function getMetadataAction ( Page $ page ) { $ metadata = null !== $ page -> getMetaData ( ) ? $ page -> getMetaData ( ) -> jsonSerialize ( ) : array ( ) ; if ( empty ( $ metadata ) ) { $ metadata = $ this -> application -> getContainer ( ) -> get ( 'nestednode.metadata.resolver' ) -> resolve ( $ page ) ; } retu... | Get page s metadatas . |
20,231 | public function getAncestorsAction ( Page $ page ) { $ ancestors = $ this -> getPageRepository ( ) -> getAncestors ( $ page ) ; return $ this -> createResponse ( $ this -> formatCollection ( $ ancestors ) ) ; } | Get page ancestors |
20,232 | public function putMetadataAction ( Page $ page , Request $ request ) { $ metadatas = $ this -> application -> getContainer ( ) -> get ( 'nestednode.metadata.resolver' ) -> resolve ( $ page ) ; foreach ( $ request -> request -> all ( ) as $ name => $ attributes ) { if ( $ metadatas -> has ( $ name ) ) { foreach ( $ att... | Update page s metadatas . |
20,233 | public function getCollectionAction ( Request $ request , $ start , $ count , Page $ parent = null ) { $ response = null ; $ contentUid = $ request -> query -> get ( 'content_uid' , null ) ; $ contentType = $ request -> query -> get ( 'content_type' , null ) ; if ( null !== $ contentUid && null !== $ contentType ) { $ ... | Get collection of page entity . |
20,234 | private function isFinal ( Page $ page = null ) { $ result = false ; if ( null !== $ page ) { $ layout = $ page -> getLayout ( ) ; if ( null !== $ layout && $ layout -> isFinal ( ) ) { $ result = true ; } } return $ result ; } | Check if the page is final |
20,235 | public function putCollectionAction ( Request $ request ) { $ result = [ ] ; foreach ( $ request -> request -> all ( ) as $ data ) { if ( ! isset ( $ data [ 'uid' ] ) ) { throw new BadRequestHttpException ( 'uid is missing.' ) ; } try { $ page = $ this -> getEntityManager ( ) -> getRepository ( 'BackBee\NestedNode\Page... | Update page collecton . |
20,236 | private function softDelete ( Page $ page ) { if ( $ page -> isRoot ( ) ) { throw new BadRequestHttpException ( 'Cannot remove root page of a site.' ) ; } $ this -> granted ( 'DELETE' , $ page ) ; $ this -> granted ( 'EDIT' , $ page -> getParent ( ) ) ; if ( $ page -> isOnline ( true ) ) { $ this -> granted ( 'PUBLISH'... | Moves the pages in trash . |
20,237 | private function hardDelete ( Page $ page ) { if ( ! $ page -> isDeleted ( ) ) { throw new BadRequestHttpException ( 'Page is not in trash, cannot remove it.' ) ; } if ( true === $ page -> isRoot ( ) ) { throw new BadRequestHttpException ( 'Cannot remove root page of a site.' ) ; } $ this -> granted ( 'DELETE' , $ page... | Remove page from the database . |
20,238 | public function patchAction ( Page $ page , Request $ request ) { $ operations = $ request -> request -> all ( ) ; try { ( new OperationSyntaxValidator ( ) ) -> validate ( $ operations ) ; } catch ( InvalidOperationSyntaxException $ e ) { throw new BadRequestHttpException ( 'operation invalid syntax: ' . $ e -> getMess... | Patch page . |
20,239 | public function deleteAction ( Page $ page ) { if ( $ page -> isDeleted ( ) ) { $ this -> hardDelete ( $ page ) ; } else { $ this -> softDelete ( $ page ) ; } $ this -> getEntityManager ( ) -> flush ( ) ; return $ this -> createJsonResponse ( null , 204 ) ; } | Delete page . |
20,240 | public function deleteCollectionAction ( Request $ request ) { if ( null === $ uids = $ request -> get ( 'uids' , null ) ) { throw new BadRequestHttpException ( 'uid is missing.' ) ; } $ result = [ ] ; $ statusCode = 204 ; $ pages = $ this -> getPageRepository ( ) -> findBy ( [ '_uid' => $ uids ] ) ; foreach ( $ pages ... | Delete page collecton . |
20,241 | public function cloneAction ( Page $ source , Page $ parent = null , $ sibling = null , Request $ request ) { $ this -> granted ( 'VIEW' , $ source -> getLayout ( ) ) ; if ( null !== $ sibling ) { $ parent = $ sibling -> getParent ( ) ; } elseif ( null === $ parent ) { $ parent = $ source -> getParent ( ) ; } if ( null... | Clone a page . |
20,242 | private function doGetCollectionByContent ( $ contentType , $ contentUid ) { $ content = null ; $ classname = AbstractClassContent :: getClassnameByContentType ( $ contentType ) ; $ em = $ this -> getApplication ( ) -> getEntityManager ( ) ; try { $ content = $ em -> find ( $ classname , $ contentUid ) ; } catch ( Clas... | Returns every pages that contains provided classcontent . |
20,243 | private function getOrderCriteria ( array $ requestedOrder = null , $ qb = null ) { if ( ! empty ( $ requestedOrder ) ) { $ orderBy = [ ] ; foreach ( $ requestedOrder as $ key => $ value ) { if ( '_' !== $ key [ 0 ] ) { $ key = '_' . $ key ; } $ orderBy [ $ key ] = $ value ; } } else { $ orderBy [ '_position' ] = 'ASC'... | Computes order criteria for collection . |
20,244 | private function trySetPageWorkflowState ( Page $ page , State $ workflow = null ) { $ page -> setWorkflowState ( null ) ; if ( null !== $ workflow ) { if ( null === $ workflow -> getLayout ( ) || $ workflow -> getLayout ( ) -> getUid ( ) === $ page -> getLayout ( ) -> getUid ( ) ) { $ page -> setWorkflowState ( $ work... | Page workflow state setter . |
20,245 | private function patchStateOperation ( Page $ page , array & $ operations ) { $ stateOp = null ; $ isHiddenOp = null ; foreach ( $ operations as $ key => $ operation ) { $ op = [ 'key' => $ key , 'op' => $ operation ] ; if ( '/state' === $ operation [ 'path' ] ) { $ stateOp = $ op ; } elseif ( '/is_hidden' === $ operat... | Custom patch process for Page s state property . |
20,246 | private function patchSiblingAndParentOperation ( Page $ page , array & $ operations ) { $ sibling_operation = null ; $ parent_operation = null ; foreach ( $ operations as $ key => $ operation ) { $ op = array ( 'key' => $ key , 'op' => $ operation ) ; if ( '/sibling_uid' === $ operation [ 'path' ] ) { $ sibling_operat... | Custom patch process for Page s sibling or parent node . |
20,247 | private function getPageByUid ( $ uid ) { if ( null === $ page = $ this -> getApplication ( ) -> getEntityManager ( ) -> find ( 'BackBee\NestedNode\Page' , $ uid ) ) { throw new NotFoundHttpException ( "Unable to find page with uid `$uid`" ) ; } return $ page ; } | Retrieves page entity with provided uid . |
20,248 | public function getDomDocument ( ) { if ( null === $ this -> _domdocument ) { if ( true === $ this -> isValid ( ) ) { $ mainLayoutRow = new \ DOMDocument ( '1.0' , 'UTF-8' ) ; $ mainNode = $ mainLayoutRow -> createElement ( 'div' ) ; $ mainNode -> setAttribute ( 'class' , 'row' ) ; $ clearNode = $ mainLayoutRow -> crea... | Generates and returns a DOM document according to the unserialized data object . |
20,249 | public function isValid ( ) { if ( null === $ this -> _isValid ) { $ this -> _isValid = false ; if ( null !== $ data_object = $ this -> getDataObject ( ) ) { if ( true === property_exists ( $ data_object , 'templateLayouts' ) && true === is_array ( $ data_object -> templateLayouts ) && 0 < count ( $ data_object -> temp... | Checks for a valid structure of the unserialized data object . |
20,250 | public function setData ( $ data ) { if ( true === is_object ( $ data ) ) { return $ this -> setDataObject ( $ data ) ; } $ this -> _picpath = null ; $ this -> _isValid = null ; $ this -> _domdocument = null ; $ this -> _zones = null ; $ this -> _data = $ data ; return $ this ; } | Sets the data associated to the layout . No validation checks are performed at this step . |
20,251 | public function setDataObject ( $ data ) { if ( true === is_object ( $ data ) ) { $ data = json_encode ( $ data ) ; } return $ this -> setData ( $ data ) ; } | Sets the data associated to the layout . None validity checks are performed at this step . |
20,252 | public function setParam ( $ var = null , $ values = null ) { if ( null === $ var ) { $ this -> _parameters = $ values ; } else { $ this -> _parameters [ $ var ] = $ values ; } return $ this ; } | Sets one or all parameters . |
20,253 | private function getZoneOptions ( \ stdClass $ zone ) { $ options = array ( 'parameters' => array ( 'class' => array ( 'type' => 'scalar' , 'options' => array ( 'default' => 'row' ) , ) , ) , ) ; if ( true === property_exists ( $ zone , 'accept' ) && true === is_array ( $ zone -> accept ) && 0 < count ( $ zone -> accep... | Returns a contentset options according to the layout zone . |
20,254 | public function addAuthorizationMapping ( $ entity , $ mapping ) { $ classname = get_class ( $ entity ) ; if ( ! isset ( $ this -> rights [ $ classname ] ) ) { $ this -> buildRights ( $ classname ) ; } $ this -> rights [ $ classname ] = array_merge ( $ this -> rights [ $ classname ] , $ mapping ) ; return $ this ; } | Add authorization mapping for entity . |
20,255 | private function buildProperMethodName ( $ prefix , $ propertyName ) { $ methodName = explode ( '_' , $ propertyName ) ; $ methodName = array_map ( function ( $ str ) { return ucfirst ( $ str ) ; } , $ methodName ) ; return $ prefix . implode ( '' , $ methodName ) ; } | Builds a valid method name for property name ; Replaces every _ by and apply ucfirst to every words seperated by an underscore . |
20,256 | public function setPage ( Page $ page ) { $ this -> _page = $ page ; $ page -> setMainSection ( $ this ) ; return $ this ; } | Sets the associated page for this section . |
20,257 | public function getContainer ( ) { if ( null !== $ this -> container ) { throw new ContainerAlreadyExistsException ( $ this -> container ) ; } $ this -> container = new Container ( ) ; $ this -> hydrateContainerWithBootstrapParameters ( ) ; if ( false === $ this -> tryParseContainerDump ( ) ) { $ this -> hydrateContain... | Every time you invoke this method it will return a new BackBee \ DependencyInjection \ Container . |
20,258 | private function hydrateContainerWithBootstrapParameters ( ) { $ parameters = ( new BootstrapResolver ( $ this -> repository_directory , $ this -> context , $ this -> environment ) ) -> getBootstrapParameters ( ) ; $ missing_parameters = array ( ) ; $ this -> tryAddParameter ( 'debug' , $ parameters , $ missing_paramet... | Hydrate container with bootstrap . yml parameter . |
20,259 | private function tryParseContainerDump ( ) { $ success = false ; $ container_directory = $ this -> container -> getParameter ( 'container.dump_directory' ) ; $ container_filename = $ this -> getContainerDumpFilename ( $ this -> container -> getParameter ( 'bootstrap_filepath' ) ) ; $ container_filepath = $ container_di... | This method try to restore container from a dump if it is possible otherwise it will set container . class container . file and container . dir parameters into container . |
20,260 | private function loadApplicationServices ( ) { $ this -> container -> set ( 'bbapp' , $ this -> application ) ; $ this -> container -> set ( 'container.builder' , $ this ) ; $ services_directory = $ this -> application -> getBBDir ( ) . '/Config/services' ; foreach ( scandir ( $ services_directory ) as $ file ) { if ( ... | Load and override services into container ; the load order is from the most global to the most specific depends on context and environment . |
20,261 | private function loadLoggerDefinition ( ) { $ logger_class = $ this -> container -> getParameter ( 'bbapp.logger.class' ) ; if ( true === $ this -> container -> getParameter ( 'debug' ) ) { $ logger_class = $ this -> container -> getParameter ( 'bbapp.logger_debug.class' ) ; } $ this -> container -> setDefinition ( 'lo... | Load on the fly logging service definition depends on debug value . |
20,262 | public function getKeywordsFromElements ( & $ elements = array ( ) ) { if ( 0 === count ( $ elements ) ) { return array ( ) ; } $ uids = array ( ) ; $ assoc = array ( ) ; foreach ( $ elements as & $ element ) { if ( $ element instanceof Keyword ) { $ uids [ ] = $ element -> value ; $ assoc [ $ element -> value ] = & $ ... | Returns the nested keywords object according to the element keyword objects provided Also set the parameter objectKeyword from the element to the nested keyword . |
20,263 | public function updateKeywordLinks ( AbstractClassContent $ content , $ keywords , BBUserToken $ token = null ) { if ( ! is_array ( $ keywords ) ) { $ keywords = [ $ keywords ] ; } foreach ( $ keywords as $ keyword ) { if ( ! ( $ keyword instanceof Keyword ) ) { continue ; } if ( null !== $ token && null !== $ draft = ... | Updates keywords_contents join . |
20,264 | public function cleanKeywordLinks ( AbstractClassContent $ content , $ keywords ) { if ( ! is_array ( $ keywords ) ) { $ keywords = [ $ keywords ] ; } $ keywordUids = [ ] ; foreach ( $ keywords as $ keyword ) { if ( $ keyword instanceof Keyword && ! empty ( $ keyword -> value ) && ( null !== $ realKeyword = $ this -> _... | Deletes outdated keyword content joins . |
20,265 | public function toStdObject ( ) { $ object = new \ stdClass ( ) ; $ object -> uid = $ this -> getUid ( ) ; $ object -> level = $ this -> getLevel ( ) ; $ object -> keyword = $ this -> getKeyword ( ) ; $ object -> children = array ( ) ; return $ object ; } | Returns a stdObj representation of the node . |
20,266 | public function hasValidSourceFile ( ) { $ sourcefile = $ this -> getSourceFile ( ) ; return ( true === is_readable ( $ sourcefile ) && false === is_dir ( $ sourcefile ) ) ; } | Is the source file is a valid readable file ? |
20,267 | private function interpolateQuery ( $ query , array $ params ) { $ keys = array ( ) ; $ values = $ params ; foreach ( $ params as $ key => $ value ) { if ( is_string ( $ key ) ) { $ keys [ ] = '/:' . $ key . '/' ; } else { $ keys [ ] = '/[?]/' ; } if ( is_array ( $ value ) ) { $ values [ $ key ] = implode ( ',' , $ val... | Interpolate sql query tokens . |
20,268 | public function getScope ( $ key ) { $ scope = ( 'application' === $ key ) ? 'APPLICATION_CONFIG' : 'BUNDLE_CONFIG' ; if ( $ this -> application -> getContainer ( ) -> has ( 'config.configurator' ) ) { $ scope = $ this -> application -> getContainer ( ) -> get ( 'config.configurator' ) -> getRegistryScope ( $ scope , $... | Returns the registry scope . |
20,269 | public function setOption ( $ option , $ value ) { if ( false === is_int ( $ option ) ) { $ this -> log ( 'warning' , sprintf ( 'Unknown memcached option: `%s`.' , $ option ) ) ; return false ; } if ( false === $ this -> _cache -> setOption ( $ option , $ value ) ) { return $ this -> _onError ( 'setOption' ) ; } return... | Sets memcached option . |
20,270 | public function getOption ( $ option ) { if ( false === is_int ( $ option ) ) { $ this -> log ( 'warning' , sprintf ( 'Unknown memcached option: `%s`.' , $ option ) ) ; return false ; } if ( false === $ this -> _cache -> getOption ( $ option ) ) { return $ this -> _onError ( 'getOption' ) ; } return true ; } | Gets memcached option . |
20,271 | public function save ( $ id , $ data , $ lifetime = null , $ tag = null , $ bypass_control = false ) { $ lifetime = $ this -> getLifeTime ( $ lifetime ) ; if ( false === $ this -> _cache -> set ( $ id , ( is_array ( $ data ) ? $ data : '' . $ data ) , $ lifetime ) ) { return $ this -> _onError ( 'save' ) ; } if ( null ... | Saves some string datas into a cache record . |
20,272 | public function loadConfiguration ( ) { if ( empty ( $ this -> conf ) ) { $ this -> conf = $ this -> loadDefault ( ) ; } else { $ this -> conf = array_merge ( self :: loadDefault ( ) , $ this -> conf ) ; } return $ this -> conf ; } | Loads the default configuration if it s not present a custom one . |
20,273 | public function get ( $ value ) { if ( ! empty ( $ this -> conf ) ) { if ( array_key_exists ( $ value , $ this -> conf ) ) { return $ this -> conf [ $ value ] ; } } throw new ConfValueNotFoundException ( $ value ) ; } | Returns a configuration value . |
20,274 | private function drawRect ( & $ image , $ clip , $ background , $ nowpadding = true , $ nohpadding = true ) { imagefilledrectangle ( $ image , $ clip [ 0 ] , $ clip [ 1 ] , $ clip [ 0 ] + $ clip [ 2 ] - ( ! $ nowpadding * 1 ) , $ clip [ 1 ] + $ clip [ 3 ] - ( ! $ nohpadding * 1 ) , $ background ) ; } | Draw a filled rect on image . |
20,275 | private function drawThumbnailZone ( & $ thumbnail , $ node , $ clip , $ background , $ gridcolumn , $ lastChild = false ) { $ x = $ clip [ 0 ] ; $ y = $ clip [ 1 ] ; $ width = $ clip [ 2 ] ; $ height = $ clip [ 3 ] ; if ( null !== $ spansize = preg_replace ( '/[^0-9]+/' , '' , $ node -> getAttribute ( 'class' ) ) ) { ... | Draw a final layout zone on its thumbnail . |
20,276 | public function getModels ( ) { try { $ q = $ this -> createQueryBuilder ( 'l' ) -> where ( 'l._site IS NULL' ) -> orderBy ( 'l._label' , 'ASC' ) -> getQuery ( ) ; return $ q -> getResult ( ) ; } catch ( \ Doctrine \ ORM \ NoResultException $ e ) { return ; } catch ( Exception $ e ) { return ; } } | Returns layout models . |
20,277 | public static function create ( array $ options = array ( ) , LoggerInterface $ logger = null , EventManager $ evm = null , ContainerInterface $ container = null ) { if ( isset ( $ options [ 'entity_manager' ] ) ) { $ em = self :: getEntityManagerWithEntityManager ( $ options [ 'entity_manager' ] ) ; } else { $ config ... | Creates a new Doctrine entity manager . |
20,278 | private static function expandSqlite ( Connection $ connection ) { $ connection -> getWrappedConnection ( ) -> sqliteCreateFunction ( 'regexp' , function ( $ pattern , $ data , $ delimiter = '~' , $ modifiers = 'isuS' ) { if ( isset ( $ pattern , $ data ) ) { return ( preg_match ( sprintf ( '%1$s%2$s%1$s%3$s' , $ delim... | Custom SQLite logic . |
20,279 | private static function addCustomFunctions ( Configuration $ config , array $ options = array ( ) ) { if ( null !== $ strFcts = Collection :: get ( $ options , 'orm:entity_managers:default:dql:string_functions' ) ) { foreach ( $ strFcts as $ name => $ class ) { if ( class_exists ( $ class ) ) { $ config -> addCustomStr... | Adds userdefined functions . |
20,280 | private static function createEntityManagerWithConnection ( $ connection , Configuration $ config , EventManager $ evm = null ) { if ( $ connection instanceof Connection ) { try { return EntityManager :: create ( $ connection , $ config , $ evm ) ; } catch ( \ Exception $ e ) { throw new InvalidArgumentException ( 'Ena... | Returns a new EntityManager with the provided connection . |
20,281 | private static function createEntityManagerWithParameters ( array $ options , Configuration $ config , EventManager $ evm = null ) { try { return EntityManager :: create ( self :: randomizeServerPoolConnection ( $ options ) , $ config , $ evm ) ; } catch ( \ Exception $ e ) { throw new InvalidArgumentException ( 'Enabl... | Returns a new EntityManager with the provided parameters . |
20,282 | private static function randomizeServerPoolConnection ( $ options ) { if ( array_key_exists ( 'host' , $ options ) && is_array ( $ options [ 'host' ] ) ) { if ( 1 < count ( $ options [ 'host' ] ) ) { shuffle ( $ options [ 'host' ] ) ; } $ options [ 'host' ] = reset ( $ options [ 'host' ] ) ; } return $ options ; } | If an array og db hosts is provided randomize the selection of one of them |
20,283 | private static function setConnectionCharset ( Connection $ connection , array $ options = array ( ) ) { if ( isset ( $ options [ 'charset' ] ) ) { try { if ( 'pdo_mysql' === $ connection -> getDriver ( ) -> getName ( ) ) { $ connection -> executeQuery ( 'SET SESSION character_set_client = "' . addslashes ( $ options [... | Sets the character set for the provided connection . |
20,284 | private static function setConnectionCollation ( Connection $ connection , array $ options = array ( ) ) { if ( isset ( $ options [ 'collation' ] ) ) { try { if ( 'pdo_mysql' === $ connection -> getDriver ( ) -> getName ( ) ) { $ connection -> executeQuery ( 'SET SESSION collation_connection = "' . addslashes ( $ optio... | Sets the collation for the provided connection . |
20,285 | private function getClassContentCacheNodeParameter ( AbstractClassContent $ content ) { $ classnames = array ( ClassUtils :: getRealClass ( $ content ) ) ; $ content_uids = $ this -> em -> getRepository ( '\BackBee\ClassContent\Indexes\IdxContentContent' ) -> getDescendantsContentUids ( $ content ) ; if ( 0 < count ( $... | Try to extract cache node parameter from class content yaml files . |
20,286 | public static function onPreUpdate ( Event $ event ) { $ page = $ event -> getTarget ( ) ; $ eventArgs = $ event -> getEventArgs ( ) ; if ( $ eventArgs instanceof PreUpdateEventArgs ) { if ( $ eventArgs -> hasChangedField ( '_workflow_state' ) ) { $ old = $ eventArgs -> getOldValue ( '_workflow_state' ) ; $ new = $ eve... | Occur on nestednode . page . preupdate events . |
20,287 | private function doPersist ( Config $ config , array $ config_to_persist ) { foreach ( $ this -> persistors as $ persistor ) { if ( true === $ persistor -> persist ( $ config , $ config_to_persist ) ) { $ this -> application -> getContainer ( ) -> get ( 'container.builder' ) -> removeContainerDump ( ) ; break ; } } } | Tries to persist config by calling every declared persistors ; it will stop on first success . |
20,288 | private function loadPersistors ( ) { if ( null !== $ config = $ this -> application -> getConfig ( ) ) { $ config_config = $ config -> getConfigConfig ( ) ; if ( ! is_array ( $ config_config ) || ! array_key_exists ( 'persistor' , $ config_config ) ) { throw new PersistorListNotFoundException ( ) ; } $ persistPerConte... | Loads every declared persistors in application config . yml config section . |
20,289 | public function clearPermissionsPageAction ( Request $ request ) { $ page = $ request -> attributes -> get ( 'uid' ) ; $ group = $ request -> attributes -> get ( 'group' ) ; $ aclManager = $ this -> getContainer ( ) -> get ( 'security.acl_manager' ) ; $ securityIdentity = new UserSecurityIdentity ( $ group , 'BackBee\S... | Clear permissions for an page |
20,290 | protected function getPriorityName ( $ code ) { return isset ( $ this -> _priorities [ $ code ] ) ? $ this -> _priorities [ $ code ] : null ; } | Get priority name by its code . |
20,291 | public function uploadAction ( Request $ request ) { $ files = $ request -> files ; $ data = [ ] ; if ( $ files -> count ( ) === 1 ) { foreach ( $ files as $ file ) { $ data = $ this -> doRequestUpload ( $ file ) ; break ; } } else { if ( $ files -> count ( ) === 0 ) { $ src = $ request -> request -> get ( 'src' ) ; $ ... | Upload file action |
20,292 | private function doRequestUpload ( UploadedFile $ file ) { $ tmpDirectory = $ this -> getApplication ( ) -> getTemporaryDir ( ) ; $ data = [ ] ; if ( null !== $ file ) { if ( $ file -> isValid ( ) ) { if ( $ file -> getClientSize ( ) <= $ file -> getMaxFilesize ( ) ) { $ data = $ this -> buildData ( $ file -> getClient... | Upload file from the request |
20,293 | private function doUpload ( $ src , $ originalName ) { $ data = $ this -> buildData ( $ originalName , File :: getExtension ( $ originalName , false ) ) ; file_put_contents ( $ data [ 'path' ] , base64_decode ( $ src ) ) ; $ this -> application -> getEventDispatcher ( ) -> dispatch ( ValidateFileUploadEvent :: EVENT_NA... | Upload file from a base64 |
20,294 | private function buildData ( $ originalName , $ extension ) { $ tmpDirectory = $ this -> getApplication ( ) -> getTemporaryDir ( ) ; $ fileName = md5 ( $ originalName . uniqid ( '' , true ) ) . '.' . $ extension ; $ data = [ 'originalname' => $ originalName , 'path' => $ tmpDirectory . DIRECTORY_SEPARATOR . $ fileName ... | Build data for retrieve into the content of response |
20,295 | public function setContainer ( Container $ container = null ) { $ this -> container = $ container ; $ this -> parameters = array ( ) ; return $ this ; } | Set the service container to be able to parse parameter and service in config Resets the compiled parameters array . |
20,296 | public function getRawSection ( $ section = null ) { if ( null === $ section ) { return $ this -> raw_parameters ; } elseif ( array_key_exists ( $ section , $ this -> raw_parameters ) ) { return $ this -> raw_parameters [ $ section ] ; } return ; } | Returns if exists the raw parameter section null otherwise . |
20,297 | public function getSection ( $ section = null ) { if ( null === $ this -> container ) { return $ this -> getRawSection ( $ section ) ; } return $ this -> compileParameters ( $ section ) ; } | Returns if exists the parameter section . |
20,298 | public function sectionHasKey ( $ section , $ key ) { return ( isset ( $ this -> raw_parameters [ $ section ] ) && is_array ( $ this -> raw_parameters [ $ section ] ) && array_key_exists ( $ key , $ this -> raw_parameters [ $ section ] ) ) ; } | Checks if the key exists in the parameter section . |
20,299 | public function setSection ( $ section , array $ config , $ overwrite = false ) { if ( false === $ overwrite && array_key_exists ( $ section , $ this -> raw_parameters ) ) { $ this -> raw_parameters [ $ section ] = Collection :: array_merge_assoc_recursive ( $ this -> raw_parameters [ $ section ] , $ config ) ; } else ... | Sets a parameter section . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.