idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
20,500 | private function getCurrentSite ( Site $ site = null ) { if ( null !== $ site ) { return $ site ; } if ( null !== $ this -> application ) { return $ this -> application -> getSite ( ) ; } return null ; } | Returns the current site if defined . |
20,501 | public function getProperties ( $ filter = \ ReflectionProperty :: IS_PUBLIC ) { $ properties = array ( ) ; $ reflectionProperties = $ this -> reflectionEntity -> getProperties ( $ filter ) ; foreach ( $ reflectionProperties as $ property ) { $ properties [ ] = new Property ( $ property -> name , $ property -> isStatic... | Gets the properties of the object provided . |
20,502 | public function getSetters ( $ filter = \ ReflectionProperty :: IS_PUBLIC ) { $ setters = array ( ) ; $ methods = $ this -> getMethods ( $ filter ) ; foreach ( $ methods as $ method ) { if ( substr ( $ method -> getName ( ) , 0 , 3 ) === 'set' ) { $ setters [ ] = $ method ; } } return $ setters ; } | Returns the public setters methods . |
20,503 | public function getMethods ( $ filter = \ ReflectionProperty :: IS_PUBLIC ) { $ methods = array ( ) ; $ reflectionMethods = $ this -> reflectionEntity -> getMethods ( $ filter ) ; foreach ( $ reflectionMethods as $ method ) { $ methods [ ] = new Method ( $ method -> name , $ method -> isStatic ( ) ) ; } return $ method... | Gets the methods of the object provided . |
20,504 | private function checksSectionTable ( ) { $ qb = $ this -> repo -> createQueryBuilder ( 's' ) ; $ this -> output -> write ( ' - BackBee database version: - ' ) ; try { $ qb -> where ( 's._has_children = :true' ) -> orWhere ( 's._has_children = :false' ) -> setMaxResults ( 1 ) -> setParameters ( [ ':true' => true , ':f... | Checks for existing has_children attribut in table section throw exception if has_children doesn t exists |
20,505 | private function updateSections ( ) { $ sections = $ this -> repo -> findAll ( ) ; foreach ( $ sections as $ section ) { PageListener :: setSectionHasChildren ( $ this -> em , $ section ) ; } $ this -> em -> flush ( ) ; return $ this ; } | Updates has_section data from existing section |
20,506 | public function getParentContentUidByUid ( $ contentUid ) { $ q = $ this -> _em -> getConnection ( ) -> createQueryBuilder ( ) -> select ( 'c.parent_uid' ) -> from ( 'content_has_subcontent' , 'c' ) -> where ( 'c.content_uid = :uid' ) -> setParameter ( 'uid' , $ contentUid ) ; return $ q -> execute ( ) -> fetchAll ( \ ... | Get all content uids owning the provided content . |
20,507 | public function getParentContents ( AbstractClassContent $ content ) { $ result = $ this -> _em -> getConnection ( ) -> createQueryBuilder ( ) -> select ( 'p.parent_uid' , 'c.classname' ) -> from ( 'content_has_subcontent' , 'p' ) -> leftJoin ( 'p' , 'content' , 'c' , 'p.parent_uid = c.uid' ) -> where ( 'p.content_uid ... | Returns provided content direct parents entity . |
20,508 | public function updateRootContentSetByPage ( Page $ page , ContentSet $ oldContentSet , ContentSet $ newContentSet , BBUserToken $ userToken ) { $ em = $ this -> _em ; $ q = $ this -> createQueryBuilder ( 'c' ) ; $ results = $ q -> leftJoin ( 'c._pages' , 'p' ) -> leftJoin ( 'p._section' , 'sp' ) -> leftJoin ( 'c._subc... | Replace root contentset for a page and its descendants . |
20,509 | public function findContentsByClassname ( $ classnameArr = array ( ) , $ orderInfos = array ( ) , $ limitInfos = array ( ) ) { $ result = array ( ) ; if ( ! is_array ( $ classnameArr ) ) { return $ result ; } $ db = $ this -> _em -> getConnection ( ) ; $ start = ( is_array ( $ limitInfos ) && array_key_exists ( 'start'... | Returns a set of content by classname . |
20,510 | public function findContentByUid ( $ uid ) { $ results = $ this -> findContentsByUids ( array ( $ uid ) ) ; if ( 0 < count ( $ results ) ) { return reset ( $ results ) ; } return ; } | Returns the hydrated content by its uid . |
20,511 | private function getDistinctClassnamesFromUids ( array $ uids ) { $ classnames = array ( ) ; try { if ( 0 < count ( $ uids ) ) { array_walk ( $ uids , function ( & $ item ) { $ item = addslashes ( $ item ) ; } ) ; $ classnames = $ this -> _em -> getConnection ( ) -> createQueryBuilder ( ) -> select ( 'classname' ) -> f... | Return the classnames from content uids . |
20,512 | public function findContentsByUids ( array $ uids ) { $ result = array ( ) ; try { if ( 0 < count ( $ uids ) ) { $ classnames = $ this -> getDistinctClassnamesFromUids ( $ uids ) ; $ query = $ this -> createQueryBuilder ( 'c' ) ; foreach ( array_unique ( $ classnames ) as $ classname ) { $ query = $ query -> orWhere ( ... | Returns the hydrated contents from their uids . |
20,513 | public function load ( AbstractClassContent $ content , BBUserToken $ token = null , $ checkoutOnMissing = false ) { $ revision = null ; if ( null !== $ token ) { $ revision = $ this -> _em -> getRepository ( 'BackBee\ClassContent\Revision' ) -> getDraft ( $ content , $ token , $ checkoutOnMissing ) ; } if ( false === ... | Load content if need the user s revision is also set . |
20,514 | public function findPagesByContent ( $ content ) { $ contentUids = array_merge ( $ this -> getContentsParentUids ( $ content -> getUid ( ) ) , [ $ content -> getUid ( ) ] ) ; $ contentUids = implode ( ', ' , array_unique ( array_map ( function ( $ uid ) { return '"' . $ uid . '"' ; } , $ contentUids ) ) ) ; $ pageUids ... | Find pages by Class content |
20,515 | public function getContentsParentUids ( $ contentUids ) { $ contentUids = ( array ) $ contentUids ; if ( 0 === count ( $ contentUids ) ) { return [ ] ; } $ contentUids = implode ( ', ' , array_unique ( array_map ( function ( $ uid ) { return '"' . $ uid . '"' ; } , $ contentUids ) ) ) ; $ parentUids = $ this -> _em -> ... | Returns all parents uid of provided contents . |
20,516 | public function getParentByClassName ( $ childUid , $ classname ) { $ q = $ this -> _em -> getConnection ( ) -> createQueryBuilder ( ) -> select ( 'j.parent_uid, c.classname' ) -> from ( 'content_has_subcontent' , 'j' ) -> from ( 'content' , 'c' ) -> andWhere ( 'c.uid = j.parent_uid' ) -> andWhere ( 'j.content_uid = :u... | Returns an uid if parent with this classname found false otherwise . |
20,517 | public function deleteContent ( AbstractClassContent $ content , $ mainContent = true ) { if ( ! $ this -> getEntityManager ( ) -> contains ( $ content ) ) { $ content = $ this -> getEntityManager ( ) -> getRepository ( AbstractClassContent :: getFullClassname ( $ content ) ) -> find ( $ content -> getUid ( ) ) ; } if ... | Delete a Class Content |
20,518 | protected function cleanUpContentHardDelete ( AbstractClassContent $ content ) { $ this -> _em -> getConnection ( ) -> executeUpdate ( 'DELETE FROM indexation WHERE owner_uid = :uid' , [ 'uid' => $ content -> getUid ( ) , ] ) ; $ revisions = $ this -> _em -> getRepository ( 'BackBee\ClassContent\Revision' ) -> findBy (... | Performs custom process on hard delete of content . |
20,519 | public function getClassnames ( array $ contentUids ) { $ contentUids = array_map ( function ( $ uid ) { return '"' . $ uid . '"' ; } , array_filter ( $ contentUids ) ) ; if ( 0 === count ( $ contentUids ) ) { return [ ] ; } $ qb = $ this -> _em -> getConnection ( ) -> createQueryBuilder ( ) ; return $ qb -> select ( '... | Returns distinct classnames for provided classcontent uids . |
20,520 | private function setInstanceOptions ( array $ options = array ( ) ) { foreach ( $ options as $ key => $ value ) { if ( true === array_key_exists ( $ key , $ this -> _instance_options ) ) { $ this -> _instance_options [ $ key ] = $ value ; } else { throw new CacheException ( sprintf ( 'Unknown option %s for cache adapte... | Sets the cache adapter instance options . |
20,521 | public function getControledLifetime ( $ lifetime ) { if ( null !== $ this -> _instance_options [ 'min_lifetime' ] && $ this -> _instance_options [ 'min_lifetime' ] > $ lifetime ) { $ lifetime = $ this -> _instance_options [ 'min_lifetime' ] ; } elseif ( null !== $ this -> _instance_options [ 'max_lifetime' ] && $ this... | Control the lifetime against min and max lifetime if provided . |
20,522 | private function getControledExpireTime ( $ expire ) { $ lifetime = $ this -> getControledLifetime ( $ expire - time ( ) ) ; if ( 0 < $ lifetime ) { return time ( ) + $ lifetime ; } return $ expire ; } | Control the expiration time against min and max lifetime if provided . |
20,523 | public function loadUserByPublicKey ( $ publicApiKey ) { if ( null === $ user = $ this -> findOneBy ( array ( '_api_key_public' => $ publicApiKey ) ) ) { throw new UsernameNotFoundException ( sprintf ( 'Unknown public API key `%s`.' , $ publicApiKey ) ) ; } return $ this -> checkActivatedStatus ( $ user ) ; } | Loads the user for the given public API key . |
20,524 | private function checkActivatedStatus ( User $ user ) { if ( ! $ user -> isActivated ( ) ) { throw new DisabledException ( sprintf ( 'Account `%s`is disabled.' , $ user -> getUsername ( ) ) ) ; } return $ user ; } | Checks that the user is activated |
20,525 | public function setContent ( AbstractClassContent $ content = null ) { $ this -> _content = $ content ; if ( null !== $ this -> _content ) { $ this -> setClassname ( ClassUtils :: getRealClass ( $ this -> _content ) ) ; } return $ this -> getContentInstance ( ) ; } | Sets the attached revisionned content . |
20,526 | public function setOwner ( UserInterface $ user ) { $ this -> _owner = UserSecurityIdentity :: fromAccount ( $ user ) ; return $ this -> getContentInstance ( ) ; } | Sets the owner of the revision . |
20,527 | private function getSerializedRevisionData ( ) { return [ 'type' => $ this -> getShortClassname ( $ this -> getContent ( ) ) , 'content_uid' => $ this -> getContent ( ) -> getUid ( ) , 'owner' => $ this -> getOwner ( ) , 'comment' => $ this -> getComment ( ) ] ; } | Returns an array of information to be returned on JSON_REVISON_FORMAT serialization . |
20,528 | private function getSerializedDraftData ( ) { $ currentDraft = $ this -> getContent ( ) -> getDraft ( ) ; $ this -> getContent ( ) -> setDraft ( null ) ; $ sourceData = $ this -> getContent ( ) -> jsonSerialize ( self :: JSON_CONCISE_FORMAT ) ; $ this -> getContent ( ) -> setDraft ( $ currentDraft ) ; $ draftData = par... | Returns an array of information to be returned on not JSON_REVISON_FORMAT serialization . |
20,529 | public function commit ( ) { if ( self :: STATE_ADDED === $ this -> getState ( ) || self :: STATE_MODIFIED === $ this -> getState ( ) ) { $ this -> setRevision ( $ this -> getRevision ( ) + 1 ) ; $ this -> setState ( self :: STATE_COMMITTED ) ; } elseif ( self :: STATE_CONFLICTED === $ this -> getState ( ) ) { throw ne... | Updates current revision state and revision to be ready for commit . |
20,530 | protected function setOptions ( $ options = null ) { if ( $ options instanceof TokenInterface ) { $ this -> _owner = UserSecurityIdentity :: fromToken ( $ options ) ; } return $ this ; } | Sets options at the construction of a new revision . |
20,531 | protected function getContentByDataValue ( $ type , $ value ) { $ element = new $ type ( $ value ) ; if ( null !== $ this -> em ) { $ element = $ this -> em -> getRepository ( $ type ) -> load ( $ element , $ this -> token ) ; } return $ element ; } | Return a subcontent instance by its type and value FALSE if not found . |
20,532 | private function computeElements ( array $ sourceElements , array $ draftElements ) { $ elements = [ ] ; if ( $ this -> getContent ( ) instanceof ContentSet ) { $ elements = [ 'current' => $ sourceElements , 'draft' => $ draftElements , ] ; } else { foreach ( $ sourceElements as $ key => $ element ) { if ( $ element !=... | Computes and returns elements data . |
20,533 | public function getWorkflowStatesForLayout ( Layout $ layout ) { $ states = array ( ) ; foreach ( $ this -> findBy ( array ( '_layout' => null ) ) as $ state ) { $ states [ $ state -> getCode ( ) ] = $ state ; } foreach ( $ this -> findBy ( array ( '_layout' => $ layout ) ) as $ state ) { $ states [ $ state -> getCode ... | Returns an array of available workflow states for the provided layout . |
20,534 | private function buildEntity ( ) { $ classname = $ this -> classname ; if ( class_exists ( $ classname ) && $ this -> isRegistryEntity ( new $ classname ( ) ) ) { $ this -> entity = new $ classname ( ) ; $ this -> buildEntityClass ( ) ; } else { $ this -> entity = new \ stdClass ( ) ; $ this -> buildStdClass ( ) ; } } | build the entity from the registry . |
20,535 | public function setRegistries ( array $ registries , $ classname ) { $ this -> classname = $ classname ; $ this -> registries = $ registries ; return $ this ; } | Add registries elements . |
20,536 | private function buildEntityClass ( ) { foreach ( $ this -> registries as $ registry ) { if ( $ registry -> getKey ( ) === 'identifier' ) { $ this -> entity -> setObjectIdentifier ( $ registry -> getValue ( ) ) ; } else { $ this -> entity -> setObjectProperty ( $ registry -> getKey ( ) , $ registry -> getValue ( ) ) ; ... | Automatique entity builder from the registries elements . |
20,537 | private function buildStdClass ( ) { foreach ( $ this -> registries as $ registry ) { $ this -> entity -> { $ registry -> getKey ( ) } = $ registry -> getValue ( ) ; } } | Automatique stdClass builder from the registries elements . |
20,538 | private function buildRegistries ( ) { if ( is_object ( $ this -> entity ) && $ this -> isRegistryEntity ( $ this -> entity ) ) { $ this -> buildRegistryFromObject ( ) ; } else { throw new \ InvalidArgumentException ( sprintf ( 'Cannot build registries: current entity must be an instance of %s, current `%s`.' , 'BackBe... | Automatique registry builder from the current entity . |
20,539 | private function buildRegistryFromObject ( ) { if ( ! ( $ this -> entity instanceof DomainObjectInterface ) ) { throw new \ Exception ( 'EntityRegistry have to implement DomainObjectInterface' , 1 ) ; } $ this -> classname = get_class ( $ this -> entity ) ; $ identifier = new Registry ( ) ; $ this -> registries [ ] = $... | Automatique registry builder from the current entity object . |
20,540 | public function load ( array $ config ) { foreach ( $ config as $ id => $ classname ) { $ serviceId = $ this -> generateBundleServiceId ( $ id ) ; if ( false === $ this -> container -> hasDefinition ( $ serviceId ) ) { $ baseDir = $ this -> buildBundleBaseDirectoryFromClassname ( $ classname ) ; $ this -> bundlesBaseDi... | Loads bundles into application . |
20,541 | public function getBundleIdByBaseDir ( $ path ) { $ bundleId = null ; foreach ( $ this -> bundleInfos as $ id => $ data ) { if ( 0 === strpos ( $ path , $ data [ 'base_dir' ] ) ) { $ bundleId = $ id ; break ; } } return $ bundleId ; } | Returns bundle id if provided path is matched with any bundle base directory . |
20,542 | public function buildBundleBaseDirectoryFromClassname ( $ classname ) { if ( false === array_key_exists ( $ classname , $ this -> reflectionClasses ) ) { $ this -> reflectionClasses [ $ classname ] = new \ ReflectionClass ( $ classname ) ; } $ baseDir = dirname ( $ this -> reflectionClasses [ $ classname ] -> getFileNa... | Computes and returns bundle base directory . |
20,543 | public function loadConfigDefinition ( $ configId , $ baseDir ) { if ( false === $ this -> container -> hasDefinition ( $ configId ) ) { $ this -> container -> setDefinition ( $ configId , $ this -> buildConfigDefinition ( $ baseDir ) ) ; } } | Sets bundle s Config definition into dependency injection container . |
20,544 | public function loadBundlesRoutes ( ) { $ loadedBundles = array_keys ( $ this -> container -> findTaggedServiceIds ( 'bundle.config' ) ) ; foreach ( $ loadedBundles as $ serviceId ) { $ config = $ this -> container -> get ( $ serviceId ) ; $ recipes = $ this -> getLoaderRecipesByConfig ( $ config ) ; $ this -> loadRout... | Loads bundles routes into application s router . |
20,545 | private function createEntitiesSchema ( BundleInterface $ bundle , $ force = false ) { if ( ! is_dir ( $ entityDir = $ this -> getBundleEntityDir ( $ bundle ) ) ) { return [ ] ; } $ bundleEntityManager = $ bundle -> getEntityManager ( ) ; $ bundleEntityManager -> getConfiguration ( ) -> getMetadataDriverImpl ( ) -> add... | Creates SQL requests to create your bundle entities and executes them against application database if force is equal to true . |
20,546 | private function updateEntitiesSchema ( BundleInterface $ bundle , $ force = false ) { if ( ! is_dir ( $ entityDir = $ this -> getBundleEntityDir ( $ bundle ) ) ) { return [ ] ; } $ bundleEntityManager = $ bundle -> getEntityManager ( ) ; $ bundleEntityManager -> getConfiguration ( ) -> getMetadataDriverImpl ( ) -> add... | Creates SQL requests to update your bundle entities and executes them against application database if force is equal to true . |
20,547 | private function buildBundleDefinition ( $ classname , $ bundleId , $ baseDir ) { if ( false === is_subclass_of ( $ classname , 'BackBee\Bundle\BundleInterface' ) ) { throw new InvalidArgumentException ( "Bundles must implement `BackBee\Bundle\BundleInterface`, `$classname` does not." ) ; } $ definition = new Definitio... | Builds and return bundle definition . |
20,548 | private function loadFullBundles ( ) { $ data = [ ] ; foreach ( $ this -> bundlesBaseDir as $ serviceId => $ baseDir ) { $ config = $ this -> loadAndGetBundleConfigByBaseDir ( $ serviceId , $ baseDir ) ; $ bundleConfig = $ config -> getSection ( 'bundle' ) ; if ( isset ( $ bundleConfig [ 'enable' ] ) && ! ( ( boolean )... | Executes full bundle s loading process into application s dependency injection container . |
20,549 | private function loadAndGetBundleConfigByBaseDir ( $ serviceId , $ baseDir ) { $ configId = str_replace ( '%bundle_service_id%' , $ serviceId , BundleInterface :: CONFIG_SERVICE_ID_PATTERN ) ; $ this -> loadConfigDefinition ( $ configId , $ baseDir ) ; $ bundleConfig = $ this -> container -> get ( $ configId ) -> getBu... | Loads and returns bundle s Config . |
20,550 | private function buildConfigDefinition ( $ baseDir ) { $ definition = new Definition ( 'BackBee\Config\Config' , array ( $ this -> getConfigDirByBundleBaseDir ( $ baseDir ) , new Reference ( 'cache.bootstrap' ) , null , '%debug%' , '%config.yml_files_to_ignore%' , ) ) ; if ( true === $ this -> application -> getContain... | Builds bundle Config definition . |
20,551 | private function getConfigDirByBundleBaseDir ( $ baseDir ) { $ directory = $ baseDir . DIRECTORY_SEPARATOR . BundleInterface :: CONFIG_DIRECTORY_NAME ; if ( ! is_dir ( $ directory ) ) { $ directory = $ baseDir . DIRECTORY_SEPARATOR . BundleInterface :: OLD_CONFIG_DIRECTORY_NAME ; } return $ directory ; } | Computes and returns Config base diretory . |
20,552 | private function getLoaderRecipesByConfig ( Config $ config ) { $ recipes = null ; $ bundleConfig = $ config -> getBundleConfig ( ) ; if ( null !== $ bundleConfig && isset ( $ bundleConfig [ 'bundle_loader_recipes' ] ) ) { $ recipes = $ bundleConfig [ 'bundle_loader_recipes' ] ; } return $ recipes ; } | Extracts and returns bundle loader recipes from Config . |
20,553 | private function getCallbackFromRecipes ( $ key , array $ recipes = null ) { $ recipe = null ; if ( isset ( $ recipes [ $ key ] ) && is_callable ( $ recipes [ $ key ] ) ) { $ recipe = $ recipes [ $ key ] ; } return $ recipe ; } | Extracts and returns callback from recipes if there is one which matchs with provided key . |
20,554 | private function loadServices ( Config $ config , $ serviceId , callable $ recipe = null ) { if ( false === $ this -> runRecipe ( $ config , $ recipe ) ) { $ directories = array_unique ( array_merge ( BundleConfigDirectory :: getDirectories ( $ this -> application -> getBaseRepository ( ) , $ this -> application -> get... | Loads bundle services into application s dependency injection container . |
20,555 | private function loadEvents ( Config $ config , callable $ recipe = null ) { if ( false === $ this -> runRecipe ( $ config , $ recipe ) ) { $ events = $ config -> getRawSection ( 'events' ) ; if ( true === is_array ( $ events ) && 0 < count ( $ events ) ) { $ this -> application -> getEventDispatcher ( ) -> addListener... | Loads bundle s events into application s event dispatcher . |
20,556 | private function addClassContentDir ( Config $ config , callable $ recipe = null ) { if ( null !== $ recipe ) { $ this -> runRecipe ( $ config , $ recipe ) ; } else { $ directory = realpath ( dirname ( $ config -> getBaseDir ( ) ) . DIRECTORY_SEPARATOR . 'ClassContent' ) ; if ( false !== $ directory ) { $ this -> appli... | Adds bundle s classcontent directory into application . |
20,557 | private function addTemplatesDir ( Config $ config , callable $ recipe = null ) { if ( false === $ this -> runRecipe ( $ config , $ recipe ) ) { $ directory = realpath ( dirname ( $ config -> getBaseDir ( ) ) . DIRECTORY_SEPARATOR . 'Templates' . DIRECTORY_SEPARATOR . 'scripts' ) ; if ( false !== $ directory ) { $ this... | Adds bundle s templates base directory into application s renderer . |
20,558 | private function addHelpersDir ( Config $ config , callable $ recipe = null ) { if ( false === $ this -> runRecipe ( $ config , $ recipe ) ) { $ directory = realpath ( dirname ( $ config -> getBaseDir ( ) ) . DIRECTORY_SEPARATOR . 'Templates' . DIRECTORY_SEPARATOR . 'helpers' ) ; if ( false !== $ directory ) { $ this -... | Adds bundle s helpers directory into application s renderer . |
20,559 | private function loadRoutes ( Config $ config , callable $ recipe = null ) { if ( false === $ this -> runRecipe ( $ config , $ recipe ) ) { $ route = $ config -> getRouteConfig ( ) ; if ( true === is_array ( $ route ) && 0 < count ( $ route ) ) { $ this -> application -> getController ( ) -> registerRoutes ( $ this -> ... | Executes loading of bundle s routes into application s front controller . |
20,560 | private function addResourcesDir ( Config $ config , callable $ recipe = null ) { if ( false === $ this -> runRecipe ( $ config , $ recipe ) ) { $ baseDir = dirname ( $ config -> getBaseDir ( ) ) . DIRECTORY_SEPARATOR ; $ directory = realpath ( $ baseDir . DIRECTORY_SEPARATOR . 'Resources' ) ; if ( false === $ director... | Adds bundle s resources directory into application . |
20,561 | public function prepareCommitDraft ( ) { if ( null === $ revision = $ this -> getDraft ( ) ) { throw new Exception \ RevisionMissingException ( 'Enable to commit: missing draft' ) ; } switch ( $ revision -> getState ( ) ) { case Revision :: STATE_ADDED : case Revision :: STATE_MODIFIED : $ revision -> setRevision ( $ r... | Prepares to commit an user s draft data for current content . |
20,562 | public function postLoad ( ) { $ tmpModified = $ this -> _modified ; $ this -> isloaded = true ; $ this -> initData ( ) ; $ this -> _modified = $ tmpModified ; } | Initialized datas on postLoad doctrine event . |
20,563 | protected function defineData ( $ var , $ type = 'scalar' , $ options = null , $ updateAccept = true ) { if ( true === $ updateAccept ) { $ this -> _addAcceptedType ( $ type , $ var ) ; } if ( ! empty ( $ options ) ) { $ this -> defaultOptions [ $ var ] = $ options ; } if ( ! array_key_exists ( $ var , $ this -> _data ... | Dynamically adds and sets new element to this content . |
20,564 | protected function defineParam ( $ var , $ default = null ) { $ values = [ 'value' => null ] ; if ( ! is_array ( $ default ) || ! array_key_exists ( 'value' , $ default ) ) { $ values [ 'value' ] = $ default ; } else { $ values = $ default ; } if ( isset ( $ this -> defaultParams [ $ var ] ) ) { $ values = array_merge ... | Dynamically add and set new parameter to this content . |
20,565 | protected function _addSubcontent ( AbstractClassContent $ value ) { if ( ! $ this -> _subcontent -> indexOf ( $ value ) ) { $ this -> _subcontent -> add ( $ value ) ; } $ this -> subcontentmap [ $ value -> getUid ( ) ] = $ this -> _subcontent -> indexOf ( $ value ) ; return $ value -> getUid ( ) ; } | Adds a subcontent to the collection . |
20,566 | private function updateSubcontentMap ( ) { $ this -> subcontentmap = array ( ) ; $ index = 0 ; foreach ( $ this -> _subcontent as $ subcontent ) { $ this -> subcontentmap [ $ subcontent -> getUid ( ) ] = $ index ++ ; } } | Updates the associationing map between subcontent and uid . |
20,567 | public function getData ( $ var = null , $ forceArray = false ) { return null !== $ this -> getDraft ( ) ? $ this -> getDraft ( ) -> getData ( $ var , $ forceArray ) : parent :: getData ( $ var , $ forceArray ) ; } | Return the data of this content . |
20,568 | public function setParam ( $ key , $ value = null ) { return null !== $ this -> getDraft ( ) ? $ this -> getDraft ( ) -> setParam ( $ key , $ value ) : parent :: setParam ( $ key , $ value ) ; } | Parameters setter . |
20,569 | public function unsetSubContent ( AbstractClassContent $ subContent ) { foreach ( $ this -> _data as $ key => $ value ) { if ( is_array ( $ value ) ) { $ totalContent = count ( $ value ) ; foreach ( $ value as $ cKey => $ cValue ) { $ contentUid = $ cValue ; if ( is_array ( $ cValue ) ) { $ contentUid = array_values ( ... | Unsets a subcontent to the current collection . |
20,570 | protected function getContentByDataValue ( $ type , $ value ) { if ( class_exists ( $ type ) && null !== $ value ) { $ index = 0 ; foreach ( $ this -> _subcontent as $ subcontent ) { $ this -> subcontentmap [ $ subcontent -> getUid ( ) ] = $ index ++ ; if ( $ subcontent -> getUid ( ) === $ value ) { return $ subcontent... | Returns a subcontent instance by its type and value FALSE if not found . |
20,571 | public function getAcceptedType ( $ var ) { $ accepts = ( $ this -> getAccept ( ) ) ; if ( isset ( $ accepts [ $ var ] ) && ! empty ( $ accepts [ $ var ] ) ) { return reset ( $ accepts [ $ var ] ) ; } else { throw new ClassContentException ( sprintf ( 'Unknown element %s in %s.' , $ var , get_class ( $ this ) ) , Class... | Check if a variable is part of accepted types |
20,572 | public function setExpire ( \ DateTime $ expire = null ) { $ this -> _expire = ( $ expire ) ? $ expire : null ; return $ this ; } | Sets the expire date time . |
20,573 | public function __isset ( $ var ) { if ( $ this -> getContentInstance ( ) instanceof ContentSet ) { throw new UnknownPropertyException ( sprintf ( 'Unknown property %s in %s.' , $ var , ClassUtils :: getRealClass ( $ this -> getContentInstance ( ) ) ) ) ; } return array_key_exists ( $ var , $ this -> _data ) && 0 < cou... | Magical function to check the setting of an element . |
20,574 | public function setParam ( $ key , $ value = null ) { if ( ! $ this -> hasParam ( $ key ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Cannot set %s as parameter cause this key does not exist.' , $ key ) ) ; } if ( is_object ( $ value ) ) { throw new \ InvalidArgumentException ( 'Parameter\'s value cannot be t... | Sets one parameter . |
20,575 | public function setAllParams ( array $ params ) { foreach ( $ params as $ key => $ value ) { $ this -> setParam ( $ key , $ value ) ; } return $ this ; } | Sets all parameters . |
20,576 | public function setCreated ( \ DateTime $ created = null ) { $ this -> _created = null === $ created ? new \ DateTime ( ) : $ created ; return $ this -> getContentInstance ( ) ; } | Sets creation date . |
20,577 | public function setModified ( \ DateTime $ modified = null ) { $ this -> _modified = null === $ modified ? new \ DateTime ( ) : $ modified ; return $ this -> getContentInstance ( ) ; } | Sets the last modification date . |
20,578 | public function acceptSubcontent ( $ var ) { if ( ! array_key_exists ( $ var , $ this -> _accept ) ) { return false ; } foreach ( $ this -> _accept [ $ var ] as $ type ) { if ( ! in_array ( $ type , [ 'scalar' , 'array' ] ) ) { return true ; } } return false ; } | Checks if the element accept subcontent . |
20,579 | public function isAccepted ( $ value , $ var = null ) { if ( $ this -> getContentInstance ( ) instanceof ContentSet ) { if ( ! ( $ value instanceof AbstractClassContent ) ) { return false ; } if ( in_array ( '!' . $ this -> _getType ( $ value ) , $ this -> _accept ) ) { return false ; } $ acceptArray = array_filter ( $... | Checks for an accepted type . |
20,580 | protected function _getType ( $ value ) { if ( is_object ( $ value ) ) { try { return self :: getShortClassname ( $ value ) ; } catch ( \ InvalidArgumentException $ e ) { return null ; } } if ( is_array ( $ value ) ) { return 'array' ; } return 'scalar' ; } | Returns the type of a given value either classname array or scalar . |
20,581 | public function equals ( ObjectIdentifiableInterface $ identity ) { return ( $ this -> getType ( ) === $ identity -> getType ( ) && $ this -> getIdentifier ( ) === $ identity -> getIdentifier ( ) ) ; } | Checks for an explicit objects equality . |
20,582 | public function getData ( $ var = null , $ forceArray = false ) { if ( null === $ var ) { $ datas = array ( ) ; foreach ( array_keys ( $ this -> _data ) as $ key ) { $ datas [ $ key ] = $ this -> getData ( $ key ) ; } return $ datas ; } if ( ! array_key_exists ( $ var , $ this -> _data ) ) { if ( $ this -> getContentIn... | Returns the set of data . |
20,583 | public function getFirstElementOfType ( $ classnames ) { if ( ! is_array ( $ classnames ) ) { $ classnames = array ( $ classnames ) ; } foreach ( array_keys ( $ this -> _data ) as $ key ) { $ element = $ this -> getData ( $ key ) ; if ( ! is_object ( $ element ) ) { continue ; } foreach ( $ classnames as $ classname ) ... | Returns the first element of one of the provided class is exists . |
20,584 | public function getParam ( $ key ) { if ( ! $ this -> hasParam ( $ key ) ) { return null ; } $ param = $ this -> getDefaultParams ( ) [ $ key ] ; $ value = null ; if ( isset ( $ this -> _parameters [ $ key ] ) ) { $ value = $ this -> _parameters [ $ key ] ; if ( ! is_array ( $ value ) || ! array_key_exists ( 'value' , ... | Returns parameters if requested key exist . |
20,585 | public function getParamValue ( $ key ) { $ value = null ; if ( is_array ( $ param = $ this -> getParam ( $ key ) ) ) { $ value = $ param [ 'value' ] ; } return $ value ; } | Returns the parameter s value . |
20,586 | public function getAllParams ( ) { $ params = [ ] ; foreach ( $ this -> getDefaultParams ( ) as $ key => $ value ) { $ params [ $ key ] = $ value ; if ( isset ( $ this -> _parameters [ $ key ] [ 'value' ] ) ) { $ params [ $ key ] [ 'value' ] = $ this -> _parameters [ $ key ] [ 'value' ] ; } } return $ params ; } | Returns all parameters . |
20,587 | public function getProperty ( $ var = null ) { if ( null === $ var ) { return $ this -> properties ; } if ( isset ( $ this -> properties [ $ var ] ) ) { return $ this -> properties [ $ var ] ; } return ; } | Returns defined property of the content or all the properties . |
20,588 | protected function defineProperty ( $ var , $ value ) { if ( ! array_key_exists ( $ var , $ this -> properties ) ) { $ this -> properties [ $ var ] = $ value ; } return $ this -> setOptions ( $ this -> properties ) ; } | Dynamically adds and sets new property to this content . |
20,589 | public function jsonSerialize ( $ format = self :: JSON_DEFAULT_FORMAT ) { $ data = [ 'uid' => $ this -> _uid , 'label' => $ this -> _label , 'type' => $ this -> getContentType ( ) , 'state' => $ this -> _state , 'created' => $ this -> _created -> getTimestamp ( ) , 'modified' => $ this -> _modified -> getTimestamp ( )... | Computes an array that contains current content data ; it can also lighten result according to requested format . |
20,590 | private function formatJsonData ( array $ data , $ format ) { if ( self :: JSON_DEFINITION_FORMAT === $ format || self :: JSON_CONCISE_FORMAT === $ format ) { unset ( $ data [ 'state' ] , $ data [ 'created' ] , $ data [ 'modified' ] , $ data [ 'revision' ] ) ; } if ( self :: JSON_INFO_FORMAT === $ format || self :: JSO... | This method will lighten provided data into requested format if format is equal to 0 this method won t transform anything . |
20,591 | private function getApiUserRole ( ) { $ apiUserRole = null ; $ container = $ this -> _context -> getApplication ( ) -> getContainer ( ) ; if ( $ container -> hasParameter ( 'bbapp.securitycontext.role.apiuser' ) ) { $ apiUserRole = $ container -> getParameter ( 'bbapp.securitycontext.role.apiuser' ) ; if ( $ container ... | Gets the API user role from container |
20,592 | private function loadLogoutListener ( AuthenticationProviderInterface $ bbProvider ) { if ( null === $ this -> _context -> getLogoutListener ( ) ) { $ httpUtils = new HttpUtils ( ) ; $ this -> _context -> setLogoutListener ( new LogoutListener ( $ this -> _context , $ httpUtils , new BBLogoutSuccessHandler ( $ httpUtil... | Load LogoutListener into security context . |
20,593 | private function getRegistryRepository ( ) { $ repository = null ; if ( null !== $ em = $ this -> _context -> getApplication ( ) -> getEntityManager ( ) ) { $ repository = $ em -> getRepository ( 'BackBee\Bundle\Registry' ) ; } return $ repository ; } | Returns the repository to Registry entities . |
20,594 | protected function doChangeDir ( $ dir ) { $ connection = $ this -> connection ; return $ this -> retry ( function ( ) use ( $ connection , $ dir ) { $ res = @ ftp_chdir ( $ connection , $ dir ) ; if ( false === $ res ) { throw new \ RuntimeException ( "Changing directory failed: " . $ dir ) ; } } ) ; } | Change current working directory . |
20,595 | protected function isDir ( $ dir ) { try { $ this -> doChangeDir ( $ dir ) ; $ this -> doCdUp ( ) ; return true ; } catch ( \ Exception $ ex ) { return false ; } return false ; } | Check if is dir . |
20,596 | public function disconnect ( ) { for ( $ i = 0 ; $ i < $ this -> getParam ( 'retryAttempts' ) + 1 ; $ i ++ ) { $ res = @ ftp_close ( $ this -> connection ) ; if ( false !== $ res ) { $ this -> connection = null ; break ; } } return $ this ; } | Close ftp connection . |
20,597 | public static function loadServicesFromYamlFile ( Container $ container , $ dir , $ service_filename = null ) { if ( null === $ service_filename ) { $ service_filename = ContainerBuilder :: SERVICE_FILENAME ; } ( new YamlFileLoader ( $ container , new FileLocator ( ( array ) $ dir ) ) ) -> load ( $ service_filename . '... | Load services from yaml file into your container . |
20,598 | public static function loadServicesFromXmlFile ( Container $ container , $ dir , $ service_filename = null ) { if ( null === $ service_filename ) { $ service_filename = ContainerBuilder :: SERVICE_FILENAME ; } ( new XmlFileLoader ( $ container , new FileLocator ( ( array ) $ dir ) ) ) -> load ( $ service_filename . '.x... | Load services from xml file into your container . |
20,599 | public function findBy ( array $ criteria , array $ orderBy = null , $ limit = null , $ offset = null ) { if ( false === PageQueryBuilder :: hasJoinCriteria ( $ criteria ) && false === PageQueryBuilder :: hasJoinCriteria ( $ orderBy ) ) { return parent :: findBy ( $ criteria , $ orderBy , $ limit , $ offset ) ; } $ que... | Finds entities by a set of criteria with automatic join on section if need due to retro - compatibility . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.