idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
20,300 | public function extend ( $ basedir = null , $ overwrite = false ) { if ( null === $ basedir ) { $ basedir = $ this -> basedir ; } $ basedir = File :: realpath ( $ basedir ) ; if ( false === $ this -> loadFromCache ( $ basedir ) ) { $ this -> loadFromBaseDir ( $ basedir , $ overwrite ) ; $ this -> saveToCache ( $ basedi... | Extends the current instance with a new base directory . |
20,301 | private function loadFromCache ( $ basedir ) { if ( true === $ this -> debug ) { return false ; } if ( null === $ this -> cache ) { return false ; } $ cached_parameters = $ this -> cache -> load ( $ this -> getCacheId ( $ basedir ) , false , $ this -> getCacheExpire ( $ basedir ) ) ; if ( false === $ cached_parameters ... | If a cache system is defined try to load a cache for the current basedir . |
20,302 | private function saveToCache ( $ basedir ) { if ( true === $ this -> debug ) { return false ; } if ( null !== $ this -> cache ) { return $ this -> cache -> save ( $ this -> getCacheId ( $ basedir ) , serialize ( $ this -> raw_parameters ) , null , null , true ) ; } return false ; } | Saves the parameters in cache system if defined . |
20,303 | private function getYmlFiles ( $ basedir ) { $ ymlFiles = File :: getFilesByExtension ( $ basedir , self :: EXTENSION ) ; $ defaultFile = $ basedir . DIRECTORY_SEPARATOR . self :: CONFIG_FILE . '.' . self :: EXTENSION ; if ( is_file ( $ defaultFile ) && 1 < count ( $ ymlFiles ) ) { $ ymlFiles = array_diff ( $ ymlFiles ... | Returns an array of YAML files in the directory . |
20,304 | private function loadFromBaseDir ( $ basedir , $ overwrite = false ) { foreach ( $ this -> getYmlFiles ( $ basedir ) as $ filename ) { $ this -> loadFromFile ( $ filename , $ overwrite ) ; } } | Loads the config files from the base directory . |
20,305 | private function loadFromFile ( $ filename , $ overwrite = false ) { try { $ yamlDatas = Yaml :: parse ( file_get_contents ( $ filename ) ) ; if ( is_array ( $ yamlDatas ) ) { if ( true === $ this -> debug ) { $ this -> debug_data [ $ filename ] = $ yamlDatas ; } if ( self :: CONFIG_FILE . '.' . self :: EXTENSION === b... | Try to parse a yaml config file . |
20,306 | private function compileAllParameters ( ) { foreach ( array_keys ( $ this -> raw_parameters ) as $ section ) { $ this -> parameters [ $ section ] = $ this -> compileParameters ( $ section ) ; } return $ this -> parameters ; } | Replace services and container parameters keys by their values for the whole config . |
20,307 | private function compileParameters ( $ section = null ) { if ( null === $ section ) { return $ this -> compileAllParameters ( ) ; } if ( ! array_key_exists ( $ section , $ this -> raw_parameters ) ) { return ; } if ( ! array_key_exists ( $ section , $ this -> parameters ) ) { $ value = $ this -> raw_parameters [ $ sect... | Replace services and container parameters keys by their values for the provided section . |
20,308 | public function authenticate ( TokenInterface $ token ) { if ( false === $ this -> supports ( $ token ) ) { throw new SecurityException ( 'Invalid token provided' , SecurityException :: UNSUPPORTED_TOKEN ) ; } try { $ user = $ this -> userProvider -> loadUserByUsername ( $ token -> getUsername ( ) ) ; $ secret = $ user... | Attempts to authenticates a TokenInterface object . |
20,309 | public function clearNonce ( TokenInterface $ token ) { if ( true === $ this -> supports ( $ token ) && null !== $ token -> getNonce ( ) ) { $ this -> removeNonce ( $ token -> getNonce ( ) ) ; } } | Clear nonce file for the current token . |
20,310 | protected function checkNonce ( BBUserToken $ token , $ secret ) { $ digest = $ token -> getDigest ( ) ; $ nonce = $ token -> getNonce ( ) ; $ created = $ token -> getCreated ( ) ; if ( time ( ) - strtotime ( $ created ) > 300 ) { throw new SecurityException ( 'Request expired' , SecurityException :: EXPIRED_TOKEN ) ; ... | Checks for a valid nonce file according to the WSE . |
20,311 | protected function readNonceValue ( $ nonce ) { $ value = null ; if ( null === $ this -> registryRepository ) { if ( true === is_readable ( $ this -> nonceDir . DIRECTORY_SEPARATOR . $ nonce ) ) { $ value = file_get_contents ( $ this -> nonceDir . DIRECTORY_SEPARATOR . $ nonce ) ; } } else { $ value = $ this -> getRegi... | Returns the nonce value if found NULL otherwise . |
20,312 | protected function writeNonceValue ( BBUserToken $ token ) { $ now = strtotime ( $ token -> getCreated ( ) ) ; $ nonce = $ token -> getNonce ( ) ; $ signature_generator = new RequestSignatureEncoder ( ) ; $ signature = $ signature_generator -> createSignature ( $ token ) ; if ( null === $ this -> registryRepository ) {... | Updates the nonce value . |
20,313 | protected function removeNonce ( $ nonce ) { if ( null === $ this -> registryRepository ) { @ unlink ( $ this -> nonceDir . DIRECTORY_SEPARATOR . $ nonce ) ; } else { $ registry = $ this -> getRegistry ( $ nonce ) ; $ this -> registryRepository -> remove ( $ registry ) ; } } | Removes the nonce . |
20,314 | private function initializeItemClasses ( ) : void { if ( $ this -> item [ 'class' ] ) { $ classes = StringUtil :: trimsplit ( ' ' , $ this -> item [ 'class' ] ) ; foreach ( $ classes as $ class ) { $ this -> itemClass [ ] = $ class ; } if ( in_array ( 'trail' , $ this -> itemClass ) ) { $ this -> itemClass [ ] = 'activ... | Initialize the item classes . |
20,315 | public static function create ( $ conf = null ) { self :: $ defaultConf = new FakerinoConf ( ) ; self :: $ defaultConf -> loadConfiguration ( ) ; if ( $ conf !== null ) { $ confArray = $ conf ; if ( ! is_array ( $ conf ) ) { $ confTypeFactory = new FileConfigurationLoaderFactory ( $ conf ) ; $ confParser = $ confTypeFa... | Bootstrap function for Fakerino setups the global configuration . |
20,316 | public function addLog ( $ key , $ message ) { if ( ! is_string ( $ message ) ) { throw new \ InvalidArgumentException ( sprintf ( '[%s]: "message" must be type of string, %s given.' , __METHOD__ , gettype ( $ message ) ) ) ; } if ( ! isset ( $ this -> logs [ $ key ] ) ) { $ this -> logs [ $ key ] = [ ] ; } $ this -> l... | Adds new message to logs . |
20,317 | public function getCategoryCollectionAction ( ) { $ application = $ this -> getApplication ( ) ; $ cache = $ application -> getContainer ( ) -> get ( 'cache.control' ) ; $ cacheId = md5 ( 'classcontent_categories_' . $ application -> getContext ( ) . '_' . $ application -> getEnvironment ( ) ) ; if ( ! $ application ->... | Returns every availables categories datas . |
20,318 | public function getCollectionAction ( $ start , $ count , Request $ request ) { $ contents = [ ] ; $ format = $ this -> getFormatParam ( ) ; $ response = $ this -> createJsonResponse ( ) ; $ categoryName = $ request -> query -> get ( 'category' , null ) ; $ usePagination = $ request -> query -> get ( 'usePagination' , ... | Returns collection of classcontent associated to category and according to provided criterias . |
20,319 | public function getAction ( $ type , $ uid , Request $ request ) { $ this -> granted ( 'VIEW' , $ content = $ this -> getClassContentByTypeAndUid ( $ type , $ uid , true ) ) ; $ response = null ; if ( in_array ( 'text/html' , $ request -> getAcceptableContentTypes ( ) ) ) { if ( false != $ pageUid = $ request -> query ... | Get classcontent . |
20,320 | public function postAction ( $ type , Request $ request ) { $ classname = AbstractClassContent :: getClassnameByContentType ( $ type ) ; $ content = new $ classname ( ) ; $ this -> granted ( 'CREATE' , $ content ) ; $ this -> getEntityManager ( ) -> persist ( $ content ) ; $ content -> setDraft ( $ this -> getClassCont... | Creates classcontent according to provided type . |
20,321 | public function putAction ( $ type , $ uid , Request $ request ) { $ this -> updateClassContent ( $ type , $ uid , $ request -> request -> all ( ) ) ; $ this -> getEntityManager ( ) -> flush ( ) ; return $ this -> createJsonResponse ( null , 204 ) ; } | Updates classcontent s elements and parameters . |
20,322 | public function putCollectionAction ( Request $ request ) { $ result = [ ] ; foreach ( $ request -> request -> all ( ) as $ data ) { if ( ! isset ( $ data [ 'type' ] ) || ! isset ( $ data [ 'uid' ] ) ) { throw new BadRequestHttpException ( "type and/or uid is missing." ) ; } try { $ content = $ this -> updateClassConte... | Updates collection of classcontent elements and parameters . |
20,323 | public function deleteAction ( $ type , $ uid ) { $ this -> granted ( 'DELETE' , $ content = $ this -> getClassContentByTypeAndUid ( $ type , $ uid ) ) ; try { $ this -> getEntityManager ( ) -> getRepository ( 'BackBee\ClassContent\AbstractClassContent' ) -> deleteContent ( $ content ) ; $ this -> getEntityManager ( ) ... | delete a classcontent . |
20,324 | public function getDraftAction ( $ type , $ uid ) { $ this -> granted ( 'VIEW' , $ content = $ this -> getClassContentByTypeAndUid ( $ type , $ uid ) ) ; return $ this -> createJsonResponse ( $ this -> getClassContentManager ( ) -> getDraft ( $ content ) ) ; } | ClassContent s draft getter . |
20,325 | public function getDraftCollectionAction ( ) { $ contents = $ this -> getEntityManager ( ) -> getRepository ( 'BackBee\ClassContent\Revision' ) -> getAllDrafts ( $ this -> getApplication ( ) -> getBBUserToken ( ) ) ; $ contents = $ this -> sortDraftCollection ( $ contents ) ; return $ this -> addContentRangeHeadersToRe... | Returns all drafts of current user . |
20,326 | public function putDraftAction ( $ type , $ uid , Request $ request ) { $ this -> updateClassContentDraft ( $ type , $ uid , $ request -> request -> all ( ) ) ; $ this -> getEntityManager ( ) -> flush ( ) ; return $ this -> createJsonResponse ( null , 204 ) ; } | Updates a classcontent s draft . |
20,327 | public function patchDraftAction ( $ type , $ uid , Request $ request ) { $ operations = $ request -> request -> all ( ) ; try { ( new OperationSyntaxValidator ( ) ) -> validate ( $ operations ) ; } catch ( InvalidOperationSyntaxException $ e ) { throw new BadRequestHttpException ( 'operation invalid syntax: ' . $ e ->... | Set draft of a content to a specific revision |
20,328 | public function putDraftCollectionAction ( Request $ request ) { $ result = [ ] ; foreach ( $ request -> request -> all ( ) as $ data ) { if ( ! isset ( $ data [ 'type' ] ) || ! isset ( $ data [ 'uid' ] ) ) { throw new BadRequestHttpException ( "type and/or uid is missing." ) ; } try { $ content = $ this -> updateClass... | Updates collection of classcontents drafts . |
20,329 | private function getClassContentManager ( ) { if ( null === $ this -> manager ) { $ this -> manager = $ this -> getApplication ( ) -> getContainer ( ) -> get ( 'classcontent.manager' ) -> setBBUserToken ( $ this -> getApplication ( ) -> getBBUserToken ( ) ) ; } return $ this -> manager ; } | Returns ClassContentManager . |
20,330 | private function sortDraftCollection ( array $ drafts ) { $ sortedDrafts = [ ] ; $ filteredDrafts = [ ] ; foreach ( $ drafts as $ draft ) { if ( null === $ draft -> getContent ( ) ) { continue ; } $ sortedDrafts [ $ draft -> getContent ( ) -> getUid ( ) ] = [ $ draft -> getContent ( ) -> getUid ( ) => $ draft ] ; } for... | Sorts the provided array that contains current logged user s drafts . |
20,331 | private function updateClassContent ( $ type , $ uid , $ data ) { $ this -> granted ( 'EDIT' , $ content = $ this -> getClassContentByTypeAndUid ( $ type , $ uid , true , true ) ) ; $ this -> getClassContentManager ( ) -> update ( $ content , $ data ) ; return $ content ; } | Updates and returns content and its draft according to provided data . |
20,332 | private function updateClassContentDraft ( $ type , $ uid , $ data ) { $ this -> granted ( 'VIEW' , $ content = $ this -> getClassContentByTypeAndUid ( $ type , $ uid ) ) ; $ this -> granted ( 'EDIT' , $ content ) ; $ operation = $ data [ 'operation' ] ; if ( ! in_array ( $ operation , [ 'commit' , 'revert' ] ) ) { thr... | Commits or reverts content s draft according to provided data . |
20,333 | private function getClassContentByCategory ( $ name , $ start , $ count ) { return $ this -> findContentsByCriteria ( $ this -> getClassContentClassnamesByCategory ( $ name ) , $ start , $ count ) ; } | Returns classcontent by category . |
20,334 | private function getClassContentClassnamesByCategory ( $ name ) { try { return $ this -> getCategoryManager ( ) -> getClassContentClassnamesByCategory ( $ name ) ; } catch ( \ InvalidArgumentException $ e ) { throw new NotFoundHttpException ( $ e -> getMessage ( ) ) ; } } | Returns all classcontents classnames that belong to provided category . |
20,335 | private function findContentsByCriteria ( array $ classnames , $ start , $ count ) { $ criterias = array_merge ( [ 'only_online' => false , 'site_uid' => $ this -> getApplication ( ) -> getSite ( ) -> getUid ( ) , ] , $ this -> getRequest ( ) -> query -> all ( ) ) ; $ criterias [ 'only_online' ] = ( boolean ) $ criteri... | Find classcontents by provided classnames criterias from request provided start and count . |
20,336 | public function getCurrentAction ( ) { if ( ! $ this -> isGranted ( 'IS_AUTHENTICATED_FULLY' ) ) { throw new InsufficientAuthenticationException ( 'You must be authenticated to access' ) ; } $ user = $ this -> getEntityManager ( ) -> find ( get_class ( $ this -> getUser ( ) ) , $ this -> getUser ( ) -> getId ( ) ) ; re... | GET current User . |
20,337 | public function getAction ( $ id ) { if ( ! $ this -> isGranted ( 'IS_AUTHENTICATED_FULLY' ) ) { throw new InsufficientAuthenticationException ( 'You must be authenticated to delete users' ) ; } $ user = $ this -> getEntityManager ( ) -> find ( get_class ( $ this -> getUser ( ) ) , $ id ) ; if ( ! $ user ) { return $ t... | GET User . |
20,338 | public function deleteAction ( $ id ) { if ( ! $ this -> isGranted ( 'IS_AUTHENTICATED_FULLY' ) ) { throw new InsufficientAuthenticationException ( 'You must be authenticated to delete users' ) ; } if ( intval ( $ id ) === $ this -> getUser ( ) -> getId ( ) ) { throw new InsufficientAuthenticationException ( 'You can r... | DELETE User . |
20,339 | public function putAction ( $ id , Request $ request ) { if ( ! $ this -> isGranted ( 'IS_AUTHENTICATED_FULLY' ) ) { throw new InsufficientAuthenticationException ( 'You must be authenticated to view users' ) ; } $ user = $ this -> getEntityManager ( ) -> find ( get_class ( $ this -> getUser ( ) ) , $ id ) ; if ( ! $ u... | UPDATE User . |
20,340 | public function postAction ( Request $ request ) { if ( ! $ this -> isGranted ( 'IS_AUTHENTICATED_FULLY' ) ) { throw new InsufficientAuthenticationException ( 'You must be authenticated to view users' ) ; } $ userExists = $ this -> getApplication ( ) -> getEntityManager ( ) -> getRepository ( get_class ( $ this -> getU... | Create User . |
20,341 | public function addMetadataDir ( $ dir , $ namespacePrefix = '' ) { if ( ! is_dir ( $ dir ) ) { throw new InvalidArgumentException ( sprintf ( 'The directory "%s" does not exist.' , $ dir ) ) ; } if ( isset ( $ this -> metadataDirs [ $ namespacePrefix ] ) ) { throw new InvalidArgumentException ( sprintf ( 'There is alr... | Adds a directory where the serializer will look for class metadata . |
20,342 | public function getLayoutsAction ( $ uid ) { if ( ! $ this -> isGranted ( "ROLE_API_USER" ) ) { throw new AccessDeniedHttpException ( "Your account's api access is disabled" ) ; } $ site = $ this -> getEntityManager ( ) -> getRepository ( 'BackBee\Site\Site' ) -> find ( $ uid ) ; if ( ! $ site ) { return $ this -> crea... | Get site layouts . |
20,343 | public function getCollectionAction ( ) { if ( ! $ this -> isGranted ( 'ROLE_API_USER' ) ) { throw new AccessDeniedHttpException ( 'Your account\'s api access is disabled' ) ; } $ sitesAvailable = [ ] ; $ sites = $ this -> getEntityManager ( ) -> getRepository ( 'BackBee\Site\Site' ) -> findAll ( ) ; foreach ( $ sites ... | retrieve all Site visible for the current user |
20,344 | public function addSiteFilter ( $ site ) { if ( $ site instanceof Site ) { $ site = $ site -> getUid ( ) ; } if ( ! empty ( $ site ) ) { $ this -> andWhere ( 'cc._uid IN (SELECT i.content_uid FROM BackBee\ClassContent\Indexes\IdxSiteContent i WHERE i.site_uid = :site_uid)' ) -> setParameter ( 'site_uid' , $ site ) ; } ... | Add site filter to the query . |
20,345 | public function limitToOnline ( ) { $ this -> leftJoin ( 'cc._mainnode' , 'mp' ) ; $ this -> andWhere ( 'mp._state IN (:states)' ) -> setParameter ( 'states' , array ( Page :: STATE_ONLINE , Page :: STATE_ONLINE | Page :: STATE_HIDDEN ) ) ; $ this -> andWhere ( 'mp._publishing < :today OR mp._publishing IS NULL' ) -> s... | Add limite to onlinne filter . |
20,346 | public function addPageFilter ( Page $ page ) { if ( $ page && ! $ page -> isRoot ( ) ) { $ this -> leftJoin ( 'cc._mainnode' , 'p' ) -> leftJoin ( 'p._section' , 'sp' ) -> andWhere ( 'sp._root = :selectedPageRoot' ) -> andWhere ( 'sp._leftnode >= :selectedPageLeftnode' ) -> andWhere ( 'sp._rightnode <= :selectedPageRi... | Set a page to filter the query on a nested portion . |
20,347 | public function addKeywordsFilter ( $ keywords ) { $ contentIds = $ this -> _em -> getRepository ( 'BackBee\NestedNode\KeyWord' ) -> getContentsIdByKeyWords ( $ keywords ) ; if ( is_array ( $ contentIds ) && ! empty ( $ contentIds ) ) { $ this -> andWhere ( 'cc._uid in(:keywords)' ) -> setParameter ( 'keywords' , $ con... | Filter the query by keywords . |
20,348 | public function addClassFilter ( $ classes ) { if ( is_array ( $ classes ) && count ( $ classes ) !== 0 ) { $ filters = array ( ) ; foreach ( $ classes as $ class ) { class_exists ( $ class ) ; $ filters [ ] = 'cc INSTANCE OF \'' . $ class . '\'' ; } $ filter = implode ( ' OR ' , $ filters ) ; $ this -> andWhere ( $ fi... | Filter by rhe classname descriminator . |
20,349 | public function orderByIndex ( $ label , $ sort = 'ASC' ) { $ this -> join ( 'cc._indexation' , 'idx' ) -> andWhere ( 'idx._field = :sort' ) -> setParameter ( 'sort' , $ label ) -> orderBy ( 'idx._value' , $ sort ) ; } | Order with the indexation table . |
20,350 | public function paginate ( $ start , $ limit , $ fetchJoinCollection = true ) { $ this -> setFirstResult ( $ start ) -> setMaxResults ( $ limit ) ; return new Paginator ( $ this , $ fetchJoinCollection ) ; } | Get Results paginated . |
20,351 | public function addTitleLike ( $ expression ) { if ( null !== $ expression ) { $ this -> andWhere ( $ this -> expr ( ) -> like ( 'cc._label' , $ this -> expr ( ) -> literal ( '%' . $ expression . '%' ) ) ) ; } } | Adds filter on title |
20,352 | public function getCollectionAction ( ) { $ application = $ this -> getApplication ( ) ; $ bundles = [ ] ; foreach ( $ this -> getApplication ( ) -> getBundles ( ) as $ bundle ) { if ( $ this -> isGranted ( 'EDIT' , $ bundle ) || ( $ bundle -> isEnabled ( ) && $ this -> isGranted ( 'VIEW' , $ bundle ) ) ) { $ bundles [... | Returns a collection of declared bundles . |
20,353 | public function patchAction ( $ id , Request $ request ) { $ bundle = $ this -> getBundleById ( $ id ) ; $ this -> granted ( 'EDIT' , $ bundle ) ; $ operations = $ request -> request -> all ( ) ; try { ( new OperationSyntaxValidator ( ) ) -> validate ( $ operations ) ; } catch ( InvalidOperationSyntaxException $ e ) { ... | Patch the bundle . |
20,354 | public function accessBundleExposedRoutesAction ( $ bundleName , $ controllerName , $ actionName , $ parameters ) { $ bundle = $ this -> getBundleById ( $ bundleName ) ; $ controller = ( new BundleControllerResolver ( $ this -> getApplication ( ) ) ) -> resolve ( $ bundleName , $ controllerName ) ; if ( $ controller in... | This method is the front controller of every bundles exposed actions . |
20,355 | private function getBundleById ( $ id ) { if ( null === $ bundle = $ this -> getApplication ( ) -> getBundle ( $ id ) ) { throw new NotFoundHttpException ( "No bundle exists with id `$id`" ) ; } return $ bundle ; } | Returns a bundle by id . |
20,356 | private function doApplicationConfigExtend ( Config $ config ) { $ config_directories = ConfigDirectory :: getDirectories ( null , $ this -> baseRepository , $ this -> context , $ this -> environment ) ; foreach ( $ config_directories as $ directory ) { if ( is_dir ( $ directory ) ) { $ config -> extend ( $ directory ,... | Do every extend according to application context and envrionment for application s Config . |
20,357 | private function overrideConfigByRegistry ( Config $ config , $ bundleId , $ scopePerContext , $ scopePerEnvironment ) { $ registry = $ this -> getRegistryConfig ( $ bundleId , $ scopePerContext , $ scopePerEnvironment ) ; if ( null !== $ registry ) { $ registryConfig = @ unserialize ( $ registry -> getValue ( ) ) ; if... | Overrides configuration of bundle from the registry . |
20,358 | private function getRegistryConfig ( $ bundleId , $ scopePerContext , $ scopePerEnvironment ) { $ registry = null ; try { if ( null !== $ em = $ this -> application -> getEntityManager ( ) ) { $ registry = $ em -> getRepository ( 'BackBee\Bundle\Registry' ) -> findOneBy ( array ( 'key' => $ bundleId , 'scope' => $ this... | Returns the registry entry for bundle s config storing . |
20,359 | public function getPage ( ) { if ( null === $ this -> site || null === $ this -> layout || null === $ this -> title ) { $ this -> reset ( ) ; throw new \ Exception ( "Required data missing" ) ; } $ page = new Page ( $ this -> uid ) ; $ page -> setTitle ( $ this -> title ) ; $ page -> setSite ( $ this -> site ) ; if ( n... | Returns the built page instance . |
20,360 | private function reset ( ) { $ this -> uid = null ; $ this -> title = null ; $ this -> altTitle = null ; $ this -> redirect = null ; $ this -> target = null ; $ this -> url = null ; $ this -> site = null ; $ this -> root = null ; $ this -> parent = null ; $ this -> layout = null ; $ this -> elements = array ( ) ; $ thi... | Resets the builder |
20,361 | public function setRoot ( Page $ root , $ isChild = false ) { $ this -> root = $ root ; if ( true === $ isChild ) { $ this -> setParent ( $ root ) ; } return $ this ; } | Sets the root page . |
20,362 | public function setLayout ( Layout $ layout , AbstractClassContent $ toPushInMainZone = null ) { $ this -> layout = $ layout ; $ this -> itemToPushInMainZone = $ toPushInMainZone ; return $ this ; } | Sets a layout instance . |
20,363 | public function pushElement ( AbstractClassContent $ element , $ setMainNode = false , $ contentSetPos = 0 ) { $ this -> elements [ ] = [ 'content' => $ element , 'set_main_node' => ( true === $ setMainNode ) , 'content_set_position' => $ contentSetPos , ] ; return $ this ; } | Push a content into a page . |
20,364 | public function addElement ( AbstractClassContent $ element , $ index = null , $ setMainNode = false , $ contentSetPos = 0 ) { if ( null !== $ index ) { $ index = intval ( $ index ) ; if ( ! array_key_exists ( $ index , $ this -> elements ) ) { throw new \ InvalidArgumentException ( ) ; } $ this -> elements [ $ index ]... | Add a content into a page . |
20,365 | public function getElement ( $ index ) { return ( array_key_exists ( ( int ) $ index , $ this -> elements ) ? $ this -> elements [ $ index ] : null ) ; } | Gets a content from the page . |
20,366 | private function updateContentRevision ( AbstractClassContent $ content , $ revision = 1 , $ state = AbstractClassContent :: STATE_NORMAL ) { $ content -> setRevision ( ( int ) $ revision ) ; $ content -> setState ( ( int ) $ state ) ; return $ this ; } | Updates states and revision number of the content . |
20,367 | private function doPersistIfValid ( Page $ page ) { if ( null === $ page -> getParent ( ) && ! empty ( $ this -> persist ) ) { $ this -> em -> persist ( $ page ) ; return ; } $ method = '' ; if ( self :: PERSIST_AS_FIRST_CHILD === $ this -> persist ) { $ method = 'insertNodeAsFirstChildOf' ; } elseif ( self :: PERSIST_... | Persists the page is need and valid |
20,368 | public function deserializeEntity ( array $ data , $ entityOrClass ) { $ context = null ; if ( is_object ( $ entityOrClass ) ) { $ context = DeserializationContext :: create ( ) ; $ context -> attributes -> set ( 'target' , $ entityOrClass ) ; $ context -> enableMaxDepthChecks ( true ) ; $ entityOrClass = get_class ( $... | Deserialize data into Doctrine entity . |
20,369 | protected function createResponse ( $ content = '' , $ statusCode = 200 , $ contentType = 'application/json' ) { if ( '' === $ content && 'application/json' === $ contentType ) { $ content = '{}' ; } $ response = new Response ( $ content , $ statusCode ) ; $ response -> headers -> set ( 'Content-Type' , $ contentType )... | Create a RESTful response . |
20,370 | protected function sortByUids ( $ uids , $ contents ) { $ uids = ( array ) $ uids ; $ orderedUids = [ ] ; foreach ( $ uids as $ key => $ uid ) { $ orderedUids [ $ uid ] = $ key ; } $ formattedResult = [ ] ; foreach ( $ contents as $ content ) { if ( isset ( $ orderedUids [ $ content -> getUid ( ) ] ) ) { $ formattedRes... | Keep the order of contents by the list of uids |
20,371 | public function addHelperDir ( $ dir ) { if ( true === file_exists ( $ dir ) && true === is_dir ( $ dir ) ) { $ this -> getApplication ( ) -> getAutoloader ( ) -> registerNamespace ( 'BackBee\Renderer\Helper' , $ dir ) ; } return $ this ; } | Add new helper directory in the choosen position . |
20,372 | public function addLayoutDir ( $ new_dir , $ position = 0 ) { if ( true === file_exists ( $ new_dir ) && true === is_dir ( $ new_dir ) ) { $ this -> insertInArrayOnPostion ( $ this -> _layoutdir , $ new_dir , $ position ) ; } return $ this ; } | Add new layout directory in the choosen position . |
20,373 | public function addScriptDir ( $ new_dir , $ position = 1 ) { if ( true === file_exists ( $ new_dir ) && true === is_dir ( $ new_dir ) ) { $ this -> insertInArrayOnPostion ( $ this -> _scriptdir , $ new_dir , $ position ) ; } return $ this ; } | Add new script directory in the choosen position . |
20,374 | public function assign ( $ var , $ value = null ) { if ( is_string ( $ var ) ) { $ this -> _vars [ $ var ] = $ value ; return $ this ; } if ( is_array ( $ var ) ) { foreach ( $ var as $ key => $ value ) { if ( $ value instanceof AbstractClassContent ) { $ subcontent = $ this -> getApplication ( ) -> getEntityManager ( ... | Assign one or more variables . |
20,375 | public function getCurrentRoot ( ) { if ( null !== $ this -> getCurrentPage ( ) ) { return $ this -> getCurrentPage ( ) -> getRoot ( ) ; } elseif ( null === $ this -> getCurrentSite ( ) ) { return ; } else { return $ this -> application -> getEntityManager ( ) -> getRepository ( 'BackBee\NestedNode\Page' ) -> getRoot (... | Return the current root of the page to be rendered . |
20,376 | public function setMode ( $ mode = null , $ ignoreIfRenderModeNotAvailable = true ) { $ this -> _mode = ( null === $ mode || '' === $ mode ? null : $ mode ) ; $ this -> _ignoreIfRenderModeNotAvailable = $ ignoreIfRenderModeNotAvailable ; return $ this ; } | Set the rendering mode . |
20,377 | public function setObject ( RenderableInterface $ object = null ) { $ this -> __currentelement = null ; $ this -> _object = $ object ; if ( is_array ( $ this -> __vars ) && 0 < count ( $ this -> __vars ) ) { foreach ( $ this -> __vars as $ key => $ var ) { if ( $ var === $ object ) { $ this -> __currentelement = $ key ... | Set the object to render . |
20,378 | public function setParam ( $ param , $ value = null ) { if ( is_string ( $ param ) ) { $ this -> _params [ $ param ] = $ value ; return $ this ; } if ( is_array ( $ param ) ) { foreach ( $ param as $ key => $ value ) { $ this -> _params [ $ key ] = $ value ; } } return $ this ; } | Set one or set of parameters . |
20,379 | public function updateLayout ( Layout $ layout ) { if ( null === $ layout -> getSite ( ) ) { return false ; } $ layoutfile = $ this -> getLayoutFile ( $ layout ) ; File :: resolveFilepath ( $ layoutfile , null , array ( 'include_path' => $ this -> _layoutdir ) ) ; if ( false === file_exists ( $ layoutfile ) ) { File ::... | Updates a file script of a layout . |
20,380 | public function removeLayout ( Layout $ layout ) { if ( null === $ layout -> getSite ( ) ) { return false ; } $ layoutfile = $ this -> getLayoutFile ( $ layout ) ; @ unlink ( $ layoutfile ) ; } | Unlink a file script of a layout . |
20,381 | public function getHelper ( $ method ) { $ helper = null ; if ( true === $ this -> helpers -> has ( $ method ) ) { $ helper = $ this -> helpers -> get ( $ method ) ; } return $ helper ; } | Returns helper if it exists or null . |
20,382 | public function createHelper ( $ method , $ argv ) { $ helper = null ; $ helperClass = 'BackBee\Renderer\Helper\\' . $ method ; if ( true === class_exists ( $ helperClass ) ) { $ this -> helpers -> set ( $ method , new $ helperClass ( $ this , $ argv ) ) ; $ helper = $ this -> helpers -> get ( $ method ) ; } return $ h... | Create a new helper if class exists . |
20,383 | public static function hasJoinCriteria ( array $ criteria = null ) { if ( null === $ criteria ) { return false ; } return ( 0 < count ( array_intersect ( self :: $ joinCriteria , array_keys ( $ criteria ) ) ) ) ; } | Are some criteria joined fields of section? |
20,384 | public function andSiteIs ( Site $ site ) { $ suffix = $ this -> getSuffix ( ) ; return $ this -> andWhere ( $ this -> getSectionAlias ( ) . '._site = :site' . $ suffix ) -> setParameter ( 'site' . $ suffix , $ site ) ; } | Add query part to select page by site . |
20,385 | public function andIsOnline ( ) { return $ this -> andWhere ( $ this -> getAlias ( ) . '._state IN (' . $ this -> expr ( ) -> literal ( Page :: STATE_ONLINE ) . ',' . $ this -> expr ( ) -> literal ( Page :: STATE_ONLINE + Page :: STATE_HIDDEN ) . ')' ) -> andWhere ( $ this -> getAlias ( ) . '._publishing IS NULL OR ' .... | Add query part to select online pages . |
20,386 | public function andIsNotDeleted ( ) { return $ this -> andWhere ( $ this -> getAlias ( ) . '._state < ' . $ this -> expr ( ) -> literal ( Page :: STATE_DELETED ) ) ; } | Add query part to select not deleted pages . |
20,387 | public function andRootIs ( Page $ root ) { if ( ! $ root -> isRoot ( ) ) { throw new \ InvalidArgumentException ( 'Provided page is not a tree root.' ) ; } $ suffix = $ this -> getSuffix ( ) ; return $ this -> andWhere ( $ this -> getSectionAlias ( ) . '._root = :root' . $ suffix ) -> setParameter ( 'root' . $ suffix ... | Add query part to select pages from their tree root . |
20,388 | public function andIsSiblingsOf ( Page $ page , $ strict = false , array $ order = null , $ limit = null , $ start = 0 ) { if ( null === $ page -> getParent ( ) ) { $ this -> andParentIs ( null ) ; } else { $ this -> andIsDescendantOf ( $ page -> getParent ( ) , false , $ page -> getLevel ( ) ) ; } if ( true === $ stri... | Add query part to select siblings of page . |
20,389 | public function andStateIsIn ( $ states ) { $ suffix = $ this -> getSuffix ( ) ; return $ this -> andWhere ( $ this -> getAlias ( ) . '._state IN (:states' . $ suffix . ')' ) -> setParameter ( 'states' . $ suffix , ( array ) $ states ) ; } | Add query part to select page having specific states . |
20,390 | public function andStateIsNotIn ( $ states ) { if ( false === is_array ( $ states ) ) { $ states = array ( $ states ) ; } $ suffix = $ this -> getSuffix ( ) ; return $ this -> andWhere ( $ this -> getAlias ( ) . '._state NOT IN (:states' . $ suffix . ')' ) -> setParameter ( 'states' . $ suffix , $ states ) ; } | Add query part to select page having not specific states . |
20,391 | public function andSearchCriteria ( $ restrictedStates = array ( ) , $ options = array ( ) ) { if ( true === is_array ( $ restrictedStates ) && 0 < count ( $ restrictedStates ) && false === in_array ( 'all' , $ restrictedStates ) ) { $ this -> andStateIsIn ( $ restrictedStates ) ; } if ( false === is_array ( $ options ... | Add query part to select page matching provided criteria . |
20,392 | public function addSearchCriteria ( array $ criteria ) { $ suffix = $ this -> getSuffix ( ) ; foreach ( $ criteria as $ crit => $ value ) { if ( false === strpos ( $ crit , '.' ) ) { $ crit = ( true === in_array ( $ crit , self :: $ joinCriteria ) ? $ this -> getSectionAlias ( ) : $ this -> getAlias ( ) ) . '.' . $ cri... | Add query part to math provided criteria . |
20,393 | public function addMultipleOrderBy ( array $ criteria = array ( '_position' => 'ASC' ) ) { if ( true === empty ( $ criteria ) ) { $ criteria = array ( '_position' => 'ASC' ) ; } foreach ( $ criteria as $ sort => $ order ) { $ this -> addOrderBy ( $ sort , $ order ) ; } return $ this ; } | Add several ordering criteria by array . |
20,394 | public function getSectionAlias ( ) { if ( null === $ this -> sectionAlias ) { $ this -> sectionAlias = $ this -> getAlias ( ) . '_s' ; $ this -> join ( $ this -> getAlias ( ) . '._section' , $ this -> sectionAlias ) ; } return $ this -> sectionAlias ; } | Returns the join alias to section . |
20,395 | public static function paramsReplaceRecursive ( array $ array1 , $ array2 , $ mutableField = false ) { if ( ! is_array ( $ array2 ) ) { return $ array1 ; } foreach ( $ array1 as $ key => $ value ) { $ mutableFields = ( is_array ( $ value ) && array_key_exists ( "_mutablefields" , $ value ) ) ? ( array ) $ value [ "_mut... | replaces the values of the first array with the same values from all the following arrays . If a key from the first array exists in the second array its value will be replaced by the value from the second array . If the key exists in the second array and not the first it will be deleted . Mutable specify the value of t... |
20,396 | protected function buildTopLevelArrayNestedForContext ( array $ context ) { $ nested = [ ] ; foreach ( $ this -> reservedTopLevelKeys as $ key ) { if ( array_key_exists ( $ key , $ context ) ) { $ nested [ $ key ] = $ context [ $ key ] ; unset ( $ context [ $ key ] ) ; } } if ( array_key_exists ( 'context' , $ context ... | Builds an array that can be used as a basis for top level JSON encoding . |
20,397 | protected function setSpecialProperties ( array & $ context ) { if ( $ this -> application ) { $ context [ 'application' ] = $ this -> application ; } if ( ! array_key_exists ( 'category' , $ context ) && $ this -> defaultCategory ) { $ context [ 'category' ] = $ this -> defaultCategory ; } } | Updates the array with special properties if required . |
20,398 | public function getExcludePaths ( $ path ) { $ excludePaths = [ ] ; $ iterator = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ path ) ) ; $ objects = new \ RegexIterator ( $ iterator , '/.*(.php)$/' , \ RecursiveRegexIterator :: GET_MATCH ) ; foreach ( $ objects as $ filename => $ object ) { if... | Get the paths that should be excluded . |
20,399 | public function insertNodeAsFirstChildOf ( AbstractNestedNode $ node , AbstractNestedNode $ parent ) { return $ this -> _insertNode ( $ node , $ parent , $ parent -> getLeftnode ( ) + 1 ) ; } | Inserts a leaf node in a tree as first child of the provided parent node . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.