idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
17,800 | public function addRole ( CNabuSiteMapRole $ nb_role ) { if ( $ nb_role -> isValueNumeric ( NABU_ROLE_FIELD_ID ) || $ nb_role -> isValueGUID ( NABU_ROLE_FIELD_ID ) ) { $ nb_role -> setSiteMap ( $ this ) ; $ this -> nb_site_map_role_list -> addItem ( $ nb_role ) ; } return $ nb_role ; } | Add a Role to this Site Map node . |
17,801 | public function equals ( Definition $ definition ) : bool { if ( get_class ( $ this ) !== get_class ( $ definition ) ) { return false ; } if ( null !== $ this -> type xor null !== $ definition -> type ) { return false ; } if ( null !== $ this -> type && null !== $ definition -> type && ! $ this -> type -> equals ( $ definition -> type ) ) { return false ; } if ( null !== $ this -> moreInfo xor null !== $ definition -> moreInfo ) { return false ; } if ( null !== $ this -> moreInfo && null !== $ definition -> moreInfo && ! $ this -> moreInfo -> equals ( $ definition -> moreInfo ) ) { return false ; } if ( null !== $ this -> extensions xor null !== $ definition -> extensions ) { return false ; } if ( null !== $ this -> name xor null !== $ definition -> name ) { return false ; } if ( null !== $ this -> description xor null !== $ definition -> description ) { return false ; } if ( null !== $ this -> name ) { if ( count ( $ this -> name ) !== count ( $ definition -> name ) ) { return false ; } foreach ( $ this -> name as $ language => $ value ) { if ( ! isset ( $ definition -> name [ $ language ] ) ) { return false ; } if ( $ value !== $ definition -> name [ $ language ] ) { return false ; } } } if ( null !== $ this -> description ) { if ( count ( $ this -> description ) !== count ( $ definition -> description ) ) { return false ; } foreach ( $ this -> description as $ language => $ value ) { if ( ! isset ( $ definition -> description [ $ language ] ) ) { return false ; } if ( $ value !== $ definition -> description [ $ language ] ) { return false ; } } } if ( null !== $ this -> extensions && null !== $ definition -> extensions && ! $ this -> extensions -> equals ( $ definition -> extensions ) ) { return false ; } return true ; } | Checks if another definition is equal . |
17,802 | protected function replaceResource ( $ modelName ) { $ this -> stub = str_replace ( '{{resource_lw}}' , strtolower ( $ modelName ) , $ this -> stub ) ; $ this -> stub = str_replace ( '{{resource}}' , $ modelName , $ this -> stub ) ; return $ this ; } | Replace the resource . |
17,803 | public function getTemplateWebPath ( $ file = '' , $ version = true ) { $ webPath = '/assets/' ; if ( ! empty ( $ file ) && $ version ) { $ webPath .= $ file . '?' . $ this -> get_static_version ( ) ; } else { $ webPath .= $ file ; } return $ webPath ; } | give the path of resources with the current static version |
17,804 | public function get ( $ key ) { return ( isset ( $ this -> tpl [ 'vars' ] [ $ key ] ) ) ? $ this -> tpl [ 'vars' ] [ $ key ] : null ; } | get the value of a variable assigned to the view |
17,805 | public function yields ( $ yield = self :: DEFAULT_YIELD ) { if ( ! empty ( $ this -> content_for [ $ yield ] ) ) echo $ this -> content_for [ $ yield ] ; if ( ! empty ( $ this -> tpl [ 'layout' ] [ 'yields' ] [ $ yield ] ) && file_exists ( $ this -> getTemplatePath ( $ this -> tpl [ 'layout' ] [ 'yields' ] [ $ yield ] ) ) ) include $ this -> getTemplatePath ( $ this -> tpl [ 'layout' ] [ 'yields' ] [ $ yield ] ) ; } | include a tpl file exactly where the yields method is called |
17,806 | public function isYieldable ( $ yield = self :: DEFAULT_YIELD ) { return ( ! empty ( $ this -> tpl [ 'layout' ] [ 'yields' ] [ $ yield ] ) && file_exists ( $ this -> getTemplatePath ( $ this -> tpl [ 'layout' ] [ 'yields' ] [ $ yield ] ) ) ) ; } | Test existence of a yield section |
17,807 | public function compute ( ) { if ( file_exists ( $ this -> getTemplatePath ( $ this -> tpl [ 'layout' ] [ 'path' ] ) ) ) { include $ this -> getTemplatePath ( $ this -> tpl [ 'layout' ] [ 'path' ] ) ; } else echo "Layout does not exists " . $ this -> tpl [ 'layout' ] [ 'path' ] ; } | render the whole layout and display it |
17,808 | public static function getFilteredClusterGroupServiceList ( $ q = null , $ fields = null , $ order = null , $ offset = 0 , $ num_items = 0 ) { $ fields_part = nb_prefixFieldList ( CNabuClusterGroupServiceBase :: getStorageName ( ) , $ fields , false , true , '`' ) ; $ order_part = nb_prefixFieldList ( CNabuClusterGroupServiceBase :: getStorageName ( ) , $ fields , false , false , '`' ) ; if ( $ num_items !== 0 ) { $ limit_part = ( $ offset > 0 ? $ offset . ', ' : '' ) . $ num_items ; } else { $ limit_part = false ; } $ nb_item_list = CNabuEngine :: getEngine ( ) -> getMainDB ( ) -> getQueryAsArray ( "select " . ( $ fields_part ? $ fields_part . ' ' : '* ' ) . 'from nb_cluster_group_service ' . ( $ order_part ? "order by $order_part " : '' ) . ( $ limit_part ? "limit $limit_part" : '' ) , array ( ) ) ; return $ nb_item_list ; } | Gets a filtered list of Cluster Group Service instances represented as an array . Params allows the capability of select a subset of fields order by concrete fields or truncate the list by a number of rows starting in an offset . |
17,809 | public function setUseSSL ( string $ use_ssl = "F" ) : CNabuDataObject { if ( $ use_ssl === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$use_ssl" ) ) ; } $ this -> setValue ( 'nb_cluster_group_service_use_ssl' , $ use_ssl ) ; return $ this ; } | Sets the Cluster Group Service Use SSL attribute value . |
17,810 | protected function registerServiceInterface ( INabuMessagingServiceInterface $ interface ) : bool { $ hash = $ interface -> getHash ( ) ; if ( is_array ( $ this -> service_interface_list ) && array_key_exists ( $ hash , $ this -> service_interface_list ) ) { throw new ENabuMessagingException ( ENabuMessagingException :: ERROR_SERVICE_INSTANCE_ALREADY_REGISTERED , array ( $ hash ) ) ; } if ( $ this -> service_interface_list === null ) { $ this -> service_interface_list = array ( $ hash => $ interface ) ; } else { $ this -> service_interface_list [ $ hash ] = $ interface ; } return $ interface -> init ( ) ; } | Register a new Messaging Interface instance . |
17,811 | public function createServiceInterface ( string $ class_name ) : INabuMessagingServiceInterface { $ nb_engine = CNabuEngine :: getEngine ( ) ; $ nb_descriptor = $ nb_engine -> getProviderInterfaceDescriptor ( $ this -> getVendorKey ( ) , $ this -> getModuleKey ( ) , CNabuProviderFactory :: INTERFACE_MESSAGING_SERVICE , $ class_name ) ; if ( $ nb_descriptor instanceof CNabuProviderInterfaceDescriptor ) { $ fullname = $ nb_descriptor -> getNamespace ( ) . "\\services\\$class_name" ; if ( $ nb_engine -> preloadClass ( $ fullname ) ) { $ interface = new $ fullname ( $ this ) ; if ( $ this -> registerServiceInterface ( $ interface ) ) { return $ interface ; } else { throw new ENabuMessagingException ( ENabuMessagingException :: ERROR_SERVICE_CANNOT_BE_INSTANTIATED , array ( $ class_name ) ) ; } } else { throw new ENabuMessagingException ( ENabuMessagingException :: ERROR_INVALID_SERVICE_CLASS_NAME , array ( $ class_name ) ) ; } } else { throw new ENabuProviderException ( ENabuProviderException :: ERROR_INTERFACE_DESCRIPTOR_NOT_FOUND , array ( $ class_name ) ) ; } } | Create a Service Interface to manage a Messaging service . This method is intended to speed up the creation of Service Interfaces in descendant Messaging modules . |
17,812 | protected function registerTemplateRenderInterface ( INabuMessagingTemplateRenderInterface $ interface ) : bool { $ hash = $ interface -> getHash ( ) ; if ( is_array ( $ this -> template_render_interface_list ) && array_key_exists ( $ hash , $ this -> template_render_interface_list ) ) { throw new ENabuMessagingException ( ENabuMessagingException :: ERROR_TEMPLATE_RENDER_INSTANCE_ALREADY_REGISTERED , array ( $ hash ) ) ; } if ( $ this -> template_render_interface_list === null ) { $ this -> template_render_interface_list = array ( $ hash => $ interface ) ; } else { $ this -> template_render_interface_list [ $ hash ] = $ interface ; } return $ interface -> init ( ) ; } | Register a new Messaging Template Render Interface instance . |
17,813 | public function createTemplateRenderInterface ( string $ class_name ) : INabuMessagingTemplateRenderInterface { $ nb_engine = CNabuEngine :: getEngine ( ) ; $ nb_descriptor = $ nb_engine -> getProviderInterfaceDescriptor ( $ this -> getVendorKey ( ) , $ this -> getModuleKey ( ) , CNabuProviderFactory :: INTERFACE_MESSAGING_TEMPLATE_RENDER , $ class_name ) ; if ( $ nb_descriptor instanceof CNabuProviderInterfaceDescriptor ) { $ fullname = $ nb_descriptor -> getNamespace ( ) . "\\templates\\renders\\$class_name" ; if ( $ nb_engine -> preloadClass ( $ fullname ) ) { $ interface = new $ fullname ( $ this ) ; if ( $ this -> registerTemplateRenderInterface ( $ interface ) ) { return $ interface ; } else { throw new ENabuMessagingException ( ENabuMessagingException :: ERROR_TEMPLATE_RENDER_CANNOT_BE_INSTANTIATED , array ( $ class_name ) ) ; } } else { throw new ENabuMessagingException ( ENabuMessagingException :: ERROR_INVALID_TEMPLATE_RENDER_CLASS_NAME , array ( $ class_name ) ) ; } } else { throw new ENabuProviderException ( ENabuProviderException :: ERROR_INTERFACE_DESCRIPTOR_NOT_FOUND , array ( $ class_name ) ) ; } } | Create a Template Render Interface to manage a Messaging Template Render . This method is intended to speed up the creation of Template Render Interfaces in descendant Messaging Modules . |
17,814 | public function getHTTPServerFactory ( CNabuHTTPServerInterfaceDescriptor $ nb_descriptor ) { if ( ! ( $ retval = $ this -> nb_http_server_factory_list -> getItem ( $ nb_descriptor -> getKey ( ) ) ) ) { $ retval = $ this -> nb_http_server_factory_list -> addItem ( new CNabuHTTPServerFactory ( $ nb_descriptor ) ) ; } return $ retval ; } | Gets a HTTP Server Factory instance for a Descriptor . If Factory instance already exists then returns it . |
17,815 | public static function hydrateCollection ( array $ sanitizers ) { $ hydrated = [ ] ; foreach ( $ sanitizers as $ sanitizer ) { $ hydrated [ ] = self :: hydrate ( $ sanitizer ) ; } return $ hydrated ; } | Hydrate a collection of sanitizer objects into a collection of SanitizerEntity objects |
17,816 | public static function hydrate ( stdClass $ sanitizer ) { $ hydrated = new SanitizerEntity ( ) ; if ( isset ( $ sanitizer -> id ) ) { $ hydrated -> setId ( $ sanitizer -> id ) ; } if ( isset ( $ sanitizer -> class ) ) { $ hydrated -> setClass ( $ sanitizer -> class ) ; } if ( isset ( $ sanitizer -> method ) ) { $ hydrated -> setMethod ( $ sanitizer -> method ) ; } if ( isset ( $ sanitizer -> parameter ) ) { $ hydrated -> setParameter ( $ sanitizer -> parameter ) ; } if ( isset ( $ sanitizer -> characters ) ) { $ hydrated -> setCharacters ( $ sanitizer -> characters ) ; } if ( isset ( $ sanitizer -> issueType ) ) { $ hydrated -> setIssueType ( TypeHydrator :: hydrate ( $ sanitizer -> issueType ) ) ; } return $ hydrated ; } | Hydrate a sanitizer object into a SanitizerEntity object |
17,817 | public function getAll ( $ appId , $ profileId , array $ queryParams ) { $ response = $ this -> api -> applications ( ) -> profiles ( ) -> sinks ( ) -> getAll ( $ appId , $ profileId , $ queryParams ) ; return new SinksResponse ( $ response ) ; } | Get all sinks for a profile profile |
17,818 | public function getById ( $ appId , $ profileId , $ sinkId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> profiles ( ) -> sinks ( ) -> getById ( $ appId , $ profileId , $ sinkId , $ queryParams ) ; return new SinkResponse ( $ response ) ; } | Get sink for profile profile by id |
17,819 | public function create ( $ appId , $ profileId , SinkBuilder $ input , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> profiles ( ) -> sinks ( ) -> create ( $ appId , $ profileId , $ input -> toArray ( ) , $ queryParams ) ; return new SinkResponse ( $ response ) ; } | Create sink for profile profile |
17,820 | public static function getAllCommerces ( CNabuCustomer $ nb_customer ) { $ nb_customer_id = nb_getMixedValue ( $ nb_customer , 'nb_customer_id' ) ; if ( is_numeric ( $ nb_customer_id ) ) { $ retval = forward_static_call ( array ( get_called_class ( ) , 'buildObjectListFromSQL' ) , 'nb_commerce_id' , 'select * ' . 'from nb_commerce ' . 'where nb_customer_id=%cust_id$d' , array ( 'cust_id' => $ nb_customer_id ) , $ nb_customer ) ; } else { $ retval = new CNabuCommerceList ( ) ; } return $ retval ; } | Get all items in the storage as an associative array where the field nb_commerce_id is the index and each value is an instance of class CNabuCommerceBase . |
17,821 | protected function setAttributes ( SimpleXMLElement $ element ) { $ element -> addAttribute ( 'GUID' , $ this -> nb_data_object -> grantHash ( true ) ) ; $ this -> putAttributesFromList ( $ element , array ( 'nb_site_target_key' => 'key' , 'nb_site_target_order' => 'order' , 'nb_site_target_begin_date' => 'beginDate' , 'nb_site_target_plugin_name' => 'plugin' , 'nb_site_target_php_trace' => 'trace' , 'nb_site_target_use_commerce' => 'useCommerce' ) , false ) ; } | Set default attributes of Site Target in XML Element . |
17,822 | protected function getChilds ( SimpleXMLElement $ element ) { parent :: getChilds ( $ element ) ; $ this -> getChildsAsCDATAFromList ( $ element , array ( 'nb_site_target_attributes' => 'attributes' ) , false ) ; } | Get default childs of Site Target from XML Element as Element > CDATA structure . |
17,823 | protected function setChilds ( SimpleXMLElement $ element ) { parent :: setChilds ( $ element ) ; $ this -> putChildsAsCDATAFromList ( $ element , array ( 'nb_site_target_attributes' => 'attributes' ) , false ) ; } | Set default childs of Site Target XML Element as Element > CDATA structure . |
17,824 | public static function hydrateCollection ( array $ issues ) { $ hydrated = [ ] ; foreach ( $ issues as $ issue ) { $ hydrated [ ] = self :: hydrate ( $ issue ) ; } return $ hydrated ; } | Hydrate a collection of issue objects into a collection of IssueEntity objects |
17,825 | public function setAllowedGrantTypes ( $ allowedGrantTypes ) { foreach ( $ allowedGrantTypes as $ allowedGrantType ) { if ( ! in_array ( $ allowedGrantType , $ this -> availableGrantTypes ) ) { throw new \ Exception ( 'Unknown grant type ' . $ allowedGrantType ) ; } } $ this -> allowedGrantTypes = $ allowedGrantTypes ; } | Set allowed grant types |
17,826 | protected function acquireItem ( $ key , $ index = false ) { $ retval = false ; $ nb_engine = CNabuEngine :: getEngine ( ) ; if ( $ nb_engine -> isMainDBAvailable ( ) ) { $ item = new CNabuModuleMorph ( $ key ) ; if ( $ item -> isFetched ( ) ) { $ retval = $ item ; } } return $ retval ; } | Acquires an instance of class CNabuModuleMorph from the database . |
17,827 | public function compile ( $ stub , $ modelName , $ modelData , stdClass $ scaffolderConfig , $ hash , ScaffolderThemeExtensionInterface $ themeExtension , array $ extensions , $ extra = null ) { $ this -> stub = $ stub ; $ this -> stub = $ themeExtension -> runAfterLoginViewIsCompiled ( $ this -> stub , $ scaffolderConfig ) ; foreach ( $ extensions as $ extension ) { $ this -> stub = $ extension -> runAfterLoginViewIsCompiled ( $ this -> stub , $ scaffolderConfig ) ; } return $ this -> store ( null , $ scaffolderConfig , $ this -> stub , new FileToCompile ( null , null ) ) ; } | Compiles the login view . |
17,828 | protected function parseIncomingRequest ( $ request ) { if ( ! $ request ) { $ request = LumenRequest :: capture ( ) ; } $ this -> instance ( Request :: class , $ this -> prepareRequest ( $ request ) ) ; return [ $ request -> getMethod ( ) , '/' . \ trim ( $ request -> getPathInfo ( ) , '/' ) ] ; } | Parse the incoming request and return the method and path info . |
17,829 | protected function callActionOnArrayBasedRoute ( $ routeInfo ) { $ action = $ routeInfo [ 1 ] ; if ( isset ( $ action [ 'uses' ] ) ) { return $ this -> prepareResponse ( $ this -> callControllerAction ( $ routeInfo ) ) ; } foreach ( $ action as $ value ) { if ( $ value instanceof Closure ) { $ closure = $ value -> bindTo ( new RoutingClosure ( ) ) ; break ; } } try { return $ this -> prepareResponse ( $ this -> call ( $ closure , $ routeInfo [ 2 ] ) ) ; } catch ( HttpResponseException $ e ) { return $ e -> getResponse ( ) ; } } | Call the Closure on the array based route . |
17,830 | public function prepareResponse ( $ response ) { $ request = \ app ( Request :: class ) ; if ( $ response instanceof Responsable ) { $ response = $ response -> toResponse ( $ request ) ; } if ( $ response instanceof PsrResponseInterface ) { $ response = ( new HttpFoundationFactory ( ) ) -> createResponse ( $ response ) ; } elseif ( ! $ response instanceof SymfonyResponse ) { $ response = new Response ( $ response ) ; } elseif ( $ response instanceof BinaryFileResponse ) { $ response = $ response -> prepare ( Request :: capture ( ) ) ; } return $ response -> prepare ( $ request ) ; } | Prepare the response for sending . |
17,831 | public function scan ( $ classes , $ namespaceTablenames = true , $ morphClassAbbreviations = true ) { $ this -> namespaceTablenames = $ namespaceTablenames ; $ this -> morphClassAbbreviations = $ morphClassAbbreviations ; $ metadata = [ ] ; foreach ( $ classes as $ class ) { $ entityMetadata = $ this -> parseClass ( $ class ) ; if ( $ entityMetadata ) { $ metadata [ $ class ] = $ entityMetadata ; } } $ this -> validator -> validatePivotTables ( $ metadata ) ; $ this -> generateMorphableClasses ( $ metadata ) ; return $ metadata ; } | Build metadata from all entity classes . |
17,832 | public function parseClass ( $ class ) { $ reflectionClass = new ReflectionClass ( $ class ) ; if ( $ this -> reader -> getClassAnnotation ( $ reflectionClass , '\ProAI\Datamapper\Annotations\Entity' ) ) { return $ this -> parseEntity ( $ class ) ; } else { return null ; } } | Parse a class . |
17,833 | protected function parseEmbeddedClass ( $ name , Annotation $ annotation , EntityDefinition & $ entityMetadata , $ primaryKeyOnly = false ) { $ annotation -> class = $ this -> getRealEntity ( $ annotation -> class , $ entityMetadata [ 'class' ] ) ; $ reflectionClass = new ReflectionClass ( $ annotation -> class ) ; $ classAnnotations = $ this -> reader -> getClassAnnotations ( $ reflectionClass ) ; $ this -> validator -> validateEmbeddedClass ( $ annotation -> class , $ classAnnotations ) ; $ embeddedColumnPrefix = ( $ annotation -> columnPrefix || $ annotation -> columnPrefix === false ) ? $ annotation -> columnPrefix : $ name ; $ embeddedClassMetadata = new EmbeddedClassDefinition ( [ 'name' => $ name , 'class' => $ annotation -> class , 'columnPrefix' => $ embeddedColumnPrefix , 'attributes' => [ ] , ] ) ; foreach ( $ reflectionClass -> getProperties ( ) as $ reflectionProperty ) { $ name = $ this -> getSanitizedName ( $ reflectionProperty -> getName ( ) , $ entityMetadata [ 'class' ] ) ; $ propertyAnnotations = $ this -> reader -> getPropertyAnnotations ( $ reflectionProperty ) ; foreach ( $ propertyAnnotations as $ annotation ) { if ( $ annotation instanceof \ ProAI \ Datamapper \ Annotations \ Column ) { $ this -> setAdditionalColumnProperties ( $ name , $ annotation , $ propertyAnnotations , true , $ embeddedColumnPrefix ) ; $ embeddedClassMetadata [ 'attributes' ] [ ] = $ this -> parseColumn ( $ name , $ annotation , $ entityMetadata , true , $ primaryKeyOnly ) ; } } } return $ embeddedClassMetadata ; } | Parse an embedded class . |
17,834 | protected function setAdditionalColumnProperties ( $ name , Annotation & $ annotation , array $ propertyAnnotations , $ embedded = false , $ columnPrefix = false ) { foreach ( $ propertyAnnotations as $ subAnnotation ) { if ( $ subAnnotation instanceof \ ProAI \ Datamapper \ Annotations \ Id ) { $ annotation -> primary = true ; } if ( $ subAnnotation instanceof \ ProAI \ Datamapper \ Annotations \ AutoIncrement ) { $ annotation -> autoIncrement = true ; } if ( $ subAnnotation instanceof \ ProAI \ Datamapper \ Annotations \ AutoUuid ) { $ annotation -> autoUuid = true ; } if ( $ subAnnotation instanceof \ ProAI \ Datamapper \ Annotations \ Versioned ) { $ annotation -> versioned = true ; } } $ annotation -> name = $ this -> getColumnName ( $ annotation -> name ? : $ name , $ columnPrefix ) ; } | Set properties of column annotation related annotations . |
17,835 | protected function parseColumn ( $ name , Annotation $ annotation , EntityDefinition & $ entityMetadata , $ embedded = false , $ primaryKeyOnly = false ) { if ( $ annotation -> primary == $ primaryKeyOnly ) { if ( ! empty ( $ entityMetadata [ 'versionTable' ] ) && $ annotation -> versioned ) { $ entityMetadata [ 'versionTable' ] [ 'columns' ] [ ] = $ this -> generateColumn ( $ name , $ annotation ) ; } else { $ entityMetadata [ 'table' ] [ 'columns' ] [ ] = $ this -> generateColumn ( $ name , $ annotation ) ; } if ( ! empty ( $ entityMetadata [ 'versionTable' ] ) && ! $ annotation -> versioned && $ annotation -> primary ) { $ this -> generateVersionTable ( $ name , $ annotation , $ entityMetadata ) ; } } return $ this -> generateAttribute ( $ name , $ annotation ) ; } | Parse a column . |
17,836 | protected function generateColumn ( $ name , $ annotation ) { $ this -> validator -> validateColumnType ( $ annotation -> type ) ; return new ColumnDefinition ( [ 'name' => $ annotation -> name , 'type' => $ annotation -> type , 'nullable' => $ annotation -> nullable , 'default' => $ annotation -> default , 'primary' => $ annotation -> primary , 'unique' => $ annotation -> unique , 'index' => $ annotation -> index , 'options' => $ this -> generateAttributeOptionsArray ( $ annotation ) ] ) ; } | Generate a column . |
17,837 | protected function generateVersionTable ( $ name , Annotation $ annotation , EntityDefinition & $ entityMetadata ) { $ annotation = clone $ annotation ; $ annotation -> name = 'ref_' . $ annotation -> name ; $ annotation -> autoIncrement = false ; $ entityMetadata [ 'versionTable' ] [ 'columns' ] [ ] = $ this -> generateColumn ( $ name , $ annotation ) ; } | Generate versioning table . |
17,838 | protected function generateAttributeOptionsArray ( Annotation $ annotation ) { $ options = [ ] ; if ( $ annotation -> type == 'string' || $ annotation -> type == 'char' || $ annotation -> type == 'binary' ) { $ options [ 'length' ] = $ annotation -> length ; } if ( $ annotation -> type == 'binary' && $ annotation -> length == 16 ) { $ options [ 'fixed' ] = $ annotation -> fixed ; $ options [ 'autoUuid' ] = $ annotation -> autoUuid ; } if ( $ annotation -> type == 'smallInteger' || $ annotation -> type == 'integer' || $ annotation -> type == 'bigInteger' ) { $ options [ 'unsigned' ] = $ annotation -> unsigned ; $ options [ 'autoIncrement' ] = $ annotation -> autoIncrement ; } if ( $ annotation -> type == 'decimal' ) { $ options [ 'scale' ] = $ annotation -> scale ; $ options [ 'precision' ] = $ annotation -> precision ; } return $ options ; } | Generate an options array for an attribute . |
17,839 | protected function parseRelation ( $ name , Annotation $ annotation , EntityDefinition & $ entityMetadata ) { $ this -> validator -> validateRelationType ( $ annotation -> type ) ; $ annotation -> relatedEntity = $ annotation -> relatedEntity ? $ this -> getRealEntity ( $ annotation -> relatedEntity , $ entityMetadata [ 'class' ] ) : null ; $ annotation -> throughEntity = $ annotation -> throughEntity ? $ this -> getRealEntity ( $ annotation -> throughEntity , $ entityMetadata [ 'class' ] ) : null ; if ( $ annotation -> type == 'morphedByMany' ) { $ annotation -> type = 'morphToMany' ; $ annotation -> inverse = true ; } if ( $ annotation -> type == 'belongsTo' ) { $ this -> generateBelongsToColumns ( $ name , $ annotation , $ entityMetadata ) ; } if ( $ annotation -> type == 'morphTo' ) { $ this -> generateMorphToColumns ( $ name , $ annotation , $ entityMetadata ) ; } $ pivotTable = null ; if ( $ annotation -> type == 'belongsToMany' ) { $ pivotTable = $ this -> generateBelongsToManyPivotTable ( $ name , $ annotation , $ entityMetadata ) ; } if ( $ annotation -> type == 'morphToMany' ) { $ pivotTable = $ this -> generateMorphToManyPivotTable ( $ name , $ annotation , $ entityMetadata ) ; } return new RelationDefinition ( [ 'name' => $ name , 'type' => $ annotation -> type , 'relatedEntity' => $ annotation -> relatedEntity , 'pivotTable' => $ pivotTable , 'options' => $ this -> generateRelationOptionsArray ( $ name , $ annotation , $ entityMetadata ) ] ) ; } | Parse a relationship . |
17,840 | protected function generateBelongsToColumns ( $ name , Annotation $ annotation , EntityDefinition & $ entityMetadata ) { $ relatedForeignKey = $ annotation -> relatedForeignKey ? : $ this -> generateKey ( $ annotation -> relatedEntity ) ; $ entityMetadata [ 'table' ] [ 'columns' ] [ ] = $ this -> getModifiedPrimaryKeyColumn ( $ entityMetadata [ 'table' ] , [ 'name' => $ relatedForeignKey , 'primary' => false , 'options' => [ 'autoIncrement' => false ] ] ) ; } | Generate extra columns for a belongsTo relation . |
17,841 | protected function generateMorphToColumns ( $ name , Annotation $ annotation , EntityDefinition & $ entityMetadata ) { $ morphName = ( ! empty ( $ annotation -> morphName ) ) ? $ annotation -> morphName : $ name ; $ morphId = ( ! empty ( $ annotation -> morphId ) ) ? $ annotation -> morphId : $ morphName . '_id' ; $ morphType = ( ! empty ( $ annotation -> morphType ) ) ? $ annotation -> morphType : $ morphName . '_type' ; $ entityMetadata [ 'table' ] [ 'columns' ] [ ] = $ this -> getModifiedPrimaryKeyColumn ( $ entityMetadata [ 'table' ] , [ 'name' => $ morphId , 'primary' => false , 'options' => [ 'autoIncrement' => false ] ] ) ; $ entityMetadata [ 'table' ] [ 'columns' ] [ ] = new ColumnDefinition ( [ 'name' => $ morphType , 'type' => 'string' , 'nullable' => false , 'default' => false , 'primary' => false , 'unique' => false , 'index' => false , 'options' => [ ] ] ) ; } | Generate extra columns for a morphTo relation . |
17,842 | protected function generateBelongsToManyPivotTable ( $ name , Annotation $ annotation , EntityDefinition & $ entityMetadata ) { $ tableName = ( $ annotation -> pivotTable ) ? $ annotation -> pivotTable : $ this -> generatePivotTablename ( $ entityMetadata [ 'class' ] , $ annotation -> relatedEntity , $ annotation -> inverse ) ; $ localPivotKey = $ annotation -> localForeignKey ? : $ this -> generateKey ( $ entityMetadata [ 'class' ] ) ; $ relatedPivotKey = $ annotation -> relatedForeignKey ? : $ this -> generateKey ( $ annotation -> relatedEntity ) ; return new TableDefinition ( [ 'name' => $ tableName , 'columns' => [ $ this -> getModifiedPrimaryKeyColumn ( $ entityMetadata [ 'table' ] , [ 'name' => $ localPivotKey , 'options' => [ 'autoIncrement' => false ] ] ) , $ this -> getModifiedPrimaryKeyColumn ( $ entityMetadata [ 'table' ] , [ 'name' => $ relatedPivotKey , 'options' => [ 'autoIncrement' => false ] ] ) , ] ] ) ; } | Generate pivot table for a belongsToMany relation . |
17,843 | protected function generateMorphToManyPivotTable ( $ name , Annotation $ annotation , EntityDefinition & $ entityMetadata ) { $ morphName = $ annotation -> morphName ; $ tableName = ( $ annotation -> pivotTable ) ? $ annotation -> pivotTable : $ this -> generatePivotTablename ( $ entityMetadata [ 'class' ] , $ annotation -> relatedEntity , $ annotation -> inverse , $ morphName ) ; if ( $ annotation -> inverse ) { $ pivotKey = $ annotation -> localPivotKey ? : $ this -> generateKey ( $ entityMetadata [ 'class' ] ) ; } else { $ pivotKey = $ annotation -> relatedPivotKey ? : $ this -> generateKey ( $ annotation -> relatedEntity ) ; } $ morphId = ( ! empty ( $ annotation -> localKey ) ) ? $ annotation -> localKey : $ morphName . '_id' ; $ morphType = $ morphName . '_type' ; return new TableDefinition ( [ 'name' => $ tableName , 'columns' => [ $ this -> getModifiedPrimaryKeyColumn ( $ entityMetadata [ 'table' ] , [ 'name' => $ pivotKey , 'options' => [ 'autoIncrement' => false ] ] ) , $ this -> getModifiedPrimaryKeyColumn ( $ entityMetadata [ 'table' ] , [ 'name' => $ morphId , 'options' => [ 'autoIncrement' => false ] ] ) , new ColumnDefinition ( [ 'name' => $ morphType , 'type' => 'string' , 'nullable' => false , 'default' => false , 'primary' => true , 'unique' => false , 'index' => false , 'options' => [ ] ] ) , ] ] ) ; } | Generate pivot table for a morphToMany relation . |
17,844 | protected function getModifiedPrimaryKeyColumn ( TableDefinition $ tableMetadata , array $ data ) { foreach ( $ tableMetadata [ 'columns' ] as $ columnMetadata ) { if ( $ columnMetadata [ 'primary' ] ) { $ modifiedColumnMetadata = clone $ columnMetadata ; foreach ( $ data as $ key => $ value ) { if ( $ key == 'options' ) { $ modifiedColumnMetadata [ $ key ] = array_merge ( $ modifiedColumnMetadata [ $ key ] , $ value ) ; } else { $ modifiedColumnMetadata [ $ key ] = $ value ; } } return $ modifiedColumnMetadata ; } } return false ; } | Get primary key column . |
17,845 | protected function generateMorphableClasses ( array & $ metadata ) { foreach ( $ metadata as $ key => $ entityMetadata ) { foreach ( $ entityMetadata [ 'relations' ] as $ relationKey => $ relationMetadata ) { if ( $ relationMetadata [ 'type' ] == 'morphTo' ) { $ metadata [ $ key ] [ 'relations' ] [ $ relationKey ] [ 'options' ] [ 'morphableClasses' ] = $ this -> getMorphableClasses ( $ entityMetadata [ 'class' ] , $ relationMetadata [ 'options' ] [ 'morphName' ] , $ metadata ) ; } if ( $ relationMetadata [ 'type' ] == 'morphToMany' && ! $ relationMetadata [ 'options' ] [ 'inverse' ] ) { $ metadata [ $ key ] [ 'relations' ] [ $ relationKey ] [ 'options' ] [ 'morphableClasses' ] = $ this -> getMorphableClasses ( $ entityMetadata [ 'class' ] , $ relationMetadata [ 'options' ] [ 'morphName' ] , $ metadata , true ) ; } } } } | Generate array of morphable classes for a morphTo or morphToMany relation . |
17,846 | protected function getMorphableClasses ( $ relatedEntity , $ morphName , array $ metadata , $ many = false ) { $ morphableClasses = [ ] ; foreach ( $ metadata as $ entityMetadata ) { foreach ( $ entityMetadata [ 'relations' ] as $ relationMetadata ) { if ( ! ( ( ! $ many && $ relationMetadata [ 'type' ] == 'morphOne' ) || ( ! $ many && $ relationMetadata [ 'type' ] == 'morphMany' ) || ( $ many && $ relationMetadata [ 'type' ] == 'morphToMany' && $ relationMetadata [ 'options' ] [ 'inverse' ] ) ) ) { continue ; } if ( $ relationMetadata [ 'relatedEntity' ] == $ relatedEntity && $ relationMetadata [ 'options' ] [ 'morphName' ] == $ morphName ) { $ morphableClasses [ $ entityMetadata [ 'morphClass' ] ] = $ entityMetadata [ 'class' ] ; } } } return $ morphableClasses ; } | Get array of morphable classes for a morphTo or morphToMany relation . |
17,847 | protected function generatePivotTablename ( $ class1 , $ class2 , $ inverse , $ morph = null ) { if ( $ this -> namespaceTablenames ) { $ base = ( $ inverse ) ? $ this -> generateTableName ( $ class1 , true ) : $ this -> generateTableName ( $ class2 , true ) ; $ related = ( ! empty ( $ morph ) ) ? $ morph : ( ! empty ( $ inverse ) ? snake_case ( class_basename ( $ class2 ) ) : snake_case ( class_basename ( $ class1 ) ) ) ; return $ base . '_' . $ related . '_pivot' ; } $ base = snake_case ( class_basename ( $ class1 ) ) ; $ related = snake_case ( class_basename ( $ class2 ) ) ; $ models = array ( $ related , $ base ) ; sort ( $ models ) ; return strtolower ( implode ( '_' , $ models ) ) ; } | Generate the database tablename of a pivot table . |
17,848 | protected function generateTableName ( $ class ) { if ( $ this -> namespaceTablenames ) { $ className = array_slice ( explode ( '/' , str_replace ( '\\' , '/' , $ class ) ) , 2 ) ; if ( count ( $ className ) >= 2 && end ( $ className ) == prev ( $ className ) ) { array_pop ( $ className ) ; } $ classBasename = array_pop ( $ className ) ; return strtolower ( implode ( '_' , array_merge ( $ className , preg_split ( '/(?<=\\w)(?=[A-Z])/' , $ classBasename ) ) ) ) ; } return str_replace ( '\\' , '' , snake_case ( str_plural ( class_basename ( $ class ) ) ) ) ; } | Generate the table associated with the model . |
17,849 | protected function getColumnName ( $ name , $ prefix = false ) { $ name = snake_case ( $ name ) ; if ( $ prefix ) { $ name = $ prefix . '_' . $ name ; } return $ name ; } | Get column name of a name . |
17,850 | public static function hydrateCollection ( array $ censuses ) { $ hydrated = [ ] ; foreach ( $ censuses as $ census ) { $ hydrated [ ] = self :: hydrate ( $ census ) ; } return $ hydrated ; } | Hydrate a collection of census objects into a collection of CensusEntity objects |
17,851 | public static function hydrate ( stdClass $ census ) { $ hydrated = new CensusEntity ( ) ; if ( isset ( $ census -> id ) ) { $ hydrated -> setId ( $ census -> id ) ; } if ( isset ( $ census -> scans ) ) { $ hydrated -> setScans ( $ census -> scans ) ; } if ( isset ( $ census -> issues ) ) { $ hydrated -> setIssues ( $ census -> issues ) ; } if ( isset ( $ census -> loc ) ) { $ hydrated -> setLoc ( $ census -> loc ) ; } return $ hydrated ; } | Hydrate a census object into a CensusEntity object |
17,852 | public static function getAllSites ( CNabuCustomer $ nb_customer ) { $ nb_customer_id = nb_getMixedValue ( $ nb_customer , 'nb_customer_id' ) ; if ( is_numeric ( $ nb_customer_id ) ) { $ retval = forward_static_call ( array ( get_called_class ( ) , 'buildObjectListFromSQL' ) , 'nb_site_id' , 'select * ' . 'from nb_site ' . 'where nb_customer_id=%cust_id$d' , array ( 'cust_id' => $ nb_customer_id ) , $ nb_customer ) ; } else { $ retval = new CNabuSiteList ( ) ; } return $ retval ; } | Get all items in the storage as an associative array where the field nb_site_id is the index and each value is an instance of class CNabuSiteBase . |
17,853 | public function setMountingOrder ( int $ mounting_order = 0 ) : CNabuDataObject { if ( $ mounting_order === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$mounting_order" ) ) ; } $ this -> setValue ( 'nb_site_mounting_order' , $ mounting_order ) ; return $ this ; } | Sets the Site Mounting Order attribute value . |
17,854 | public function setPublished ( string $ published = "F" ) : CNabuDataObject { if ( $ published === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$published" ) ) ; } $ this -> setValue ( 'nb_site_published' , $ published ) ; return $ this ; } | Sets the Site Published attribute value . |
17,855 | public function setPublicBasePathEnabled ( string $ public_base_path_enabled = "F" ) : CNabuDataObject { if ( $ public_base_path_enabled === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$public_base_path_enabled" ) ) ; } $ this -> setValue ( 'nb_site_public_base_path_enabled' , $ public_base_path_enabled ) ; return $ this ; } | Sets the Site Public Base Path Enabled attribute value . |
17,856 | public function setDefaultTargetUseURI ( string $ default_target_use_uri = "N" ) : CNabuDataObject { if ( $ default_target_use_uri === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$default_target_use_uri" ) ) ; } $ this -> setValue ( 'nb_site_default_target_use_uri' , $ default_target_use_uri ) ; return $ this ; } | Sets the Site Default Target Use URI attribute value . |
17,857 | public function setDefaultErrorCode ( int $ default_error_code = 301 ) : CNabuDataObject { if ( $ default_error_code === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$default_error_code" ) ) ; } $ this -> setValue ( 'nb_site_default_error_code' , $ default_error_code ) ; return $ this ; } | Sets the Site Default Error Code attribute value . |
17,858 | public function setPageNotFoundTargetUseURI ( string $ page_not_found_target_use_uri = "N" ) : CNabuDataObject { if ( $ page_not_found_target_use_uri === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$page_not_found_target_use_uri" ) ) ; } $ this -> setValue ( 'nb_site_page_not_found_target_use_uri' , $ page_not_found_target_use_uri ) ; return $ this ; } | Sets the Site Page Not Found Target Use URI attribute value . |
17,859 | public function setPageNotFoundErrorCode ( int $ page_not_found_error_code = 404 ) : CNabuDataObject { if ( $ page_not_found_error_code === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$page_not_found_error_code" ) ) ; } $ this -> setValue ( 'nb_site_page_not_found_error_code' , $ page_not_found_error_code ) ; return $ this ; } | Sets the Site Page Not Found Error Code attribute value . |
17,860 | public function setLoginMaxFailsTargetUseURI ( string $ login_max_fails_target_use_uri = "N" ) : CNabuDataObject { if ( $ login_max_fails_target_use_uri === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$login_max_fails_target_use_uri" ) ) ; } $ this -> setValue ( 'nb_site_login_max_fails_target_use_uri' , $ login_max_fails_target_use_uri ) ; return $ this ; } | Sets the Site Login Max Fails Target Use URI attribute value . |
17,861 | public function setAliasNotFoundTargetUseURI ( string $ alias_not_found_target_use_uri = "N" ) : CNabuDataObject { if ( $ alias_not_found_target_use_uri === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$alias_not_found_target_use_uri" ) ) ; } $ this -> setValue ( 'nb_site_alias_not_found_target_use_uri' , $ alias_not_found_target_use_uri ) ; return $ this ; } | Sets the Site Alias Not Found Target Use URI attribute value . |
17,862 | public function setAliasLockedTargetUseURI ( string $ alias_locked_target_use_uri = "N" ) : CNabuDataObject { if ( $ alias_locked_target_use_uri === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$alias_locked_target_use_uri" ) ) ; } $ this -> setValue ( 'nb_site_alias_locked_target_use_uri' , $ alias_locked_target_use_uri ) ; return $ this ; } | Sets the Site Alias Locked Target Use URI attribute value . |
17,863 | public function setRequirePoliciesAfterLogin ( string $ require_policies_after_login = "F" ) : CNabuDataObject { if ( $ require_policies_after_login === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$require_policies_after_login" ) ) ; } $ this -> setValue ( 'nb_site_require_policies_after_login' , $ require_policies_after_login ) ; return $ this ; } | Sets the Site Require Policies After Login attribute value . |
17,864 | public function setUseCache ( string $ use_cache = "F" ) : CNabuDataObject { if ( $ use_cache === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$use_cache" ) ) ; } $ this -> setValue ( 'nb_site_use_cache' , $ use_cache ) ; return $ this ; } | Sets the Site Use Cache attribute value . |
17,865 | public function setHTTPSupport ( string $ http_support = "F" ) : CNabuDataObject { if ( $ http_support === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$http_support" ) ) ; } $ this -> setValue ( 'nb_site_http_support' , $ http_support ) ; return $ this ; } | Sets the Site HTTP Support attribute value . |
17,866 | public function setHTTPSSupport ( string $ https_support = "F" ) : CNabuDataObject { if ( $ https_support === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$https_support" ) ) ; } $ this -> setValue ( 'nb_site_https_support' , $ https_support ) ; return $ this ; } | Sets the Site HTTPS Support attribute value . |
17,867 | public function setUseAWStats ( string $ use_awstats = "F" ) : CNabuDataObject { if ( $ use_awstats === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$use_awstats" ) ) ; } $ this -> setValue ( 'nb_site_use_awstats' , $ use_awstats ) ; return $ this ; } | Sets the Site Use AWStats attribute value . |
17,868 | public function setWSearchEnabled ( string $ wsearch_enabled = "F" ) : CNabuDataObject { if ( $ wsearch_enabled === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$wsearch_enabled" ) ) ; } $ this -> setValue ( 'nb_site_wsearch_enabled' , $ wsearch_enabled ) ; return $ this ; } | Sets the Site WSearch Enabled attribute value . |
17,869 | public function setUseFramework ( string $ use_framework = "F" ) : CNabuDataObject { if ( $ use_framework === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$use_framework" ) ) ; } $ this -> setValue ( 'nb_site_use_framework' , $ use_framework ) ; return $ this ; } | Sets the Site Use Framework attribute value . |
17,870 | public function setEnableVirtualHostFile ( string $ enable_vhost_file = "F" ) : CNabuDataObject { if ( $ enable_vhost_file === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$enable_vhost_file" ) ) ; } $ this -> setValue ( 'nb_site_enable_vhost_file' , $ enable_vhost_file ) ; return $ this ; } | Sets the Site Enable VirtualHost File attribute value . |
17,871 | public function setEnableSessionStrictPolicies ( string $ enable_session_strict_policies = "F" ) : CNabuDataObject { if ( $ enable_session_strict_policies === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$enable_session_strict_policies" ) ) ; } $ this -> setValue ( 'nb_site_enable_session_strict_policies' , $ enable_session_strict_policies ) ; return $ this ; } | Sets the Site Enable Session Strict Policies attribute value . |
17,872 | public function setStaticContentUseAlternative ( string $ static_content_use_alternative = "D" ) : CNabuDataObject { if ( $ static_content_use_alternative === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$static_content_use_alternative" ) ) ; } $ this -> setValue ( 'nb_site_static_content_use_alternative' , $ static_content_use_alternative ) ; return $ this ; } | Sets the Site Static Content Use Alternative attribute value . |
17,873 | public function setForceCookieAsSecure ( string $ force_cookie_as_secure = "F" ) : CNabuDataObject { if ( $ force_cookie_as_secure === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$force_cookie_as_secure" ) ) ; } $ this -> setValue ( 'nb_site_force_cookie_as_secure' , $ force_cookie_as_secure ) ; return $ this ; } | Sets the Site Force Cookie As Secure attribute value . |
17,874 | public function setMaxSignInRetries ( int $ max_signin_retries = 0 ) : CNabuDataObject { if ( $ max_signin_retries === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$max_signin_retries" ) ) ; } $ this -> setValue ( 'nb_site_max_signin_retries' , $ max_signin_retries ) ; return $ this ; } | Sets the Site Max SignIn Retries attribute value . |
17,875 | public function setSignInLockDelay ( int $ signin_lock_delay = 0 ) : CNabuDataObject { if ( $ signin_lock_delay === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$signin_lock_delay" ) ) ; } $ this -> setValue ( 'nb_site_signin_lock_delay' , $ signin_lock_delay ) ; return $ this ; } | Sets the Site SignIn Lock Delay attribute value . |
17,876 | public static function hydrate ( stdClass $ status ) { $ hydrated = new StatusEntity ( ) ; if ( isset ( $ status -> version ) ) { $ hydrated -> setVersion ( $ status -> version ) ; } if ( isset ( $ status -> cloud ) ) { $ hydrated -> setCloud ( $ status -> cloud ) ; } if ( isset ( $ status -> maintenance ) ) { $ hydrated -> setMaintenance ( $ status -> maintenance ) ; } if ( isset ( $ status -> hardware_id ) ) { $ hydrated -> setHardwareId ( $ status -> hardware_id ) ; } if ( isset ( $ status -> census ) ) { $ hydrated -> setCensus ( CensusHydrator :: hydrate ( $ status -> census ) ) ; } if ( isset ( $ status -> trial_issue_types ) && is_array ( $ status -> trial_issue_types ) ) { $ hydrated -> setTrialIssueTypes ( TypeHydrator :: hydrateCollection ( $ status -> trial_issue_types ) ) ; } if ( isset ( $ status -> user ) ) { $ hydrated -> setUser ( UserHydrator :: hydrate ( $ status -> user ) ) ; } if ( isset ( $ status -> organization ) ) { $ hydrated -> setOrganization ( OrgHydrator :: hydrate ( $ status -> organization ) ) ; } return $ hydrated ; } | Hydrate a status object into a StatusEntity |
17,877 | protected function locateDataObject ( SimpleXMLElement $ element , CNabuDataObject $ data_parent = null ) : bool { $ retval = false ; if ( isset ( $ element [ 'GUID' ] ) ) { $ guid = ( string ) $ element [ 'GUID' ] ; if ( ! ( $ this -> nb_data_object instanceof CNabuSiteTargetLanguageList ) ) { $ this -> nb_data_object = CNabuSiteTargetLanguageList :: findByHash ( $ guid ) ; } else { $ this -> nb_data_object = null ; } if ( ! ( $ this -> nb_data_object instanceof CNabuSiteTargetLanguageList ) ) { $ this -> nb_data_object = new CNabuSiteTargetLanguageList ( ) ; $ this -> nb_data_object -> setHash ( $ guid ) ; } $ retval = true ; } return $ retval ; } | Locate a Data Object . |
17,878 | public static function getOS ( ) { if ( self :: $ nb_os === null ) { self :: $ nb_os = new CNabuOS ( ) ; self :: $ nb_os -> init ( ) ; } return self :: $ nb_os ; } | Get the singleton instance of CNabuOS . |
17,879 | private function init ( ) { $ this -> os_name = php_uname ( 's' ) ; $ this -> os_version = php_uname ( 'r' ) ; $ this -> os_architecture = php_uname ( 'm' ) ; $ this -> php_version = preg_split ( '/\\./' , phpversion ( ) ) ; } | Initiates the singleton instance and gater the OS information . |
17,880 | public function getDefaultCountry ( $ store = null ) { if ( $ store === null && $ this -> country === null ) { $ country = $ this -> geoService -> getCountry ( ) ; $ this -> country = $ country !== null ? $ country : false ; } return $ this -> country ? $ this -> country : parent :: getDefaultCountry ( $ store ) ; } | We prefer not to use a preference for this but we re not allowed to create a plugin for Magento \ Directory \ Helper \ Data because it s a virtual type . |
17,881 | public function sync ( ) { $ this -> data = $ this -> parent -> driver -> getData ( $ this -> name ) ; return $ this ; } | Sync the data |
17,882 | function autoincrement ( ) { if ( ! isset ( $ this -> data [ '_NonDB_System_' ] [ '_AutoIncrement_' ] ) ) { $ this -> data [ '_NonDB_System_' ] [ '_AutoIncrement_' ] = 1 ; } $ number = ( $ this -> data [ '_NonDB_System_' ] [ '_AutoIncrement_' ] ++ ) ; $ this -> save ( ) ; return $ number ; } | Get Auto - Increment Number |
17,883 | private function init ( ) { $ this -> nb_response = new CNabuHTTPResponse ( $ this -> nb_plugins_manager , $ this ) ; $ this -> nb_site = null ; $ this -> nb_site_alias = null ; $ this -> nb_site_target = null ; $ this -> nb_language = null ; $ this -> user_remote_ip = null ; $ this -> user_agent = null ; $ this -> accept_mimetypes = null ; $ this -> accept_languages = null ; $ this -> method = null ; $ this -> secure = false ; $ this -> zone = null ; $ this -> page_uri = null ; $ this -> variables = array ( ) ; } | Initializes the instance . Reset all internal variables to init values . |
17,884 | private function locateURI ( ) : string { $ this -> page_uri = filter_input ( INPUT_GET , NABU_PATH_PARAM , FILTER_SANITIZE_STRING , FILTER_FLAG_EMPTY_STRING_NULL ) ; if ( ! is_string ( $ this -> page_uri ) || strlen ( $ this -> page_uri ) === 0 ) { $ this -> page_uri = $ this -> nb_application -> getHTTPServer ( ) -> getRequestURI ( ) ; } if ( ! is_string ( $ this -> page_uri ) || strlen ( $ this -> page_uri ) === 0 ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_PAGE_URI_NOT_FOUND ) ; } CNabuEngine :: getEngine ( ) -> traceLog ( "Page requested" , $ this -> page_uri ) ; return $ this -> page_uri ; } | Search requested URIs using different alternatives . |
17,885 | public function getCombinedPostIndexes ( array $ fields = null ) { if ( $ fields === null ) { $ fields = $ this -> getPOSTFieldNames ( ) ; } $ keys = array ( ) ; if ( count ( $ fields ) > 0 ) { if ( is_array ( $ this -> xdr_post ) ) { foreach ( $ fields as $ field ) { if ( array_key_exists ( $ field , $ this -> xdr_post ) && is_array ( $ this -> xdr_post [ $ field ] ) ) { $ keys = array_merge ( $ keys , array_keys ( $ this -> xdr_post [ $ field ] ) ) ; } } } elseif ( is_array ( $ _POST ) ) { foreach ( $ fields as $ field ) { if ( array_key_exists ( $ field , $ _POST ) && is_array ( $ _POST [ $ field ] ) ) { $ keys = array_merge ( $ keys , array_keys ( $ _POST [ $ field ] ) ) ; } } } $ keys = array_unique ( $ keys ) ; } return count ( $ keys ) > 0 ? $ keys : null ; } | Get all index key values of parameters containing arrays . |
17,886 | public function create ( array $ metadata ) { $ schema = $ this -> getSchemaFromMetadata ( $ metadata ) ; $ statements = $ schema -> toSql ( $ this -> platform ) ; $ this -> build ( $ statements ) ; return $ statements ; } | Create all tables . |
17,887 | public function update ( array $ metadata , $ saveMode = false ) { $ fromSchema = $ this -> schemaManager -> createSchema ( ) ; $ toSchema = $ this -> getSchemaFromMetadata ( $ metadata ) ; $ comparator = new Comparator ; $ schemaDiff = $ comparator -> compare ( $ fromSchema , $ toSchema ) ; if ( $ saveMode ) { $ statements = $ schemaDiff -> toSaveSql ( $ this -> platform ) ; } else { $ statements = $ schemaDiff -> toSql ( $ this -> platform ) ; } $ this -> build ( $ statements ) ; return $ statements ; } | Update all tables . |
17,888 | public function drop ( array $ metadata ) { $ visitor = new DropSchemaSqlCollector ( $ this -> platform ) ; $ schema = $ this -> getSchemaFromMetadata ( $ metadata ) ; $ fullSchema = $ this -> schemaManager -> createSchema ( ) ; foreach ( $ fullSchema -> getTables ( ) as $ table ) { if ( $ schema -> hasTable ( $ table -> getName ( ) ) ) { $ visitor -> acceptTable ( $ table ) ; } } $ statements = $ visitor -> getQueries ( ) ; $ this -> build ( $ statements ) ; return $ statements ; } | Drop all tables . |
17,889 | public function getSchemaFromMetadata ( array $ metadata ) { $ entityMetadataSchemaConfig = $ this -> schemaManager -> createSchemaConfig ( ) ; $ schema = new Schema ( [ ] , [ ] , $ entityMetadataSchemaConfig ) ; $ pivotTables = [ ] ; foreach ( $ metadata as $ entityMetadata ) { $ this -> generateTableFromMetadata ( $ schema , $ entityMetadata [ 'table' ] ) ; if ( ! empty ( $ entityMetadata [ 'versionTable' ] ) ) { $ this -> generateTableFromMetadata ( $ schema , $ entityMetadata [ 'versionTable' ] ) ; } foreach ( $ entityMetadata [ 'relations' ] as $ relationMetadata ) { if ( ! empty ( $ relationMetadata [ 'pivotTable' ] ) ) { if ( ! in_array ( $ relationMetadata [ 'pivotTable' ] [ 'name' ] , $ pivotTables ) ) { $ this -> generateTableFromMetadata ( $ schema , $ relationMetadata [ 'pivotTable' ] ) ; } $ pivotTables [ ] = $ relationMetadata [ 'pivotTable' ] [ 'name' ] ; } } } return $ schema ; } | Create schema instance from metadata |
17,890 | protected function generateTableFromMetadata ( $ schema , TableDefinition $ tableMetadata ) { $ primaryKeys = [ ] ; $ uniqueIndexes = [ ] ; $ indexes = [ ] ; $ table = $ schema -> createTable ( $ this -> connection -> getTablePrefix ( ) . $ tableMetadata [ 'name' ] ) ; foreach ( $ tableMetadata [ 'columns' ] as $ columnMetadata ) { $ columnMetadata = $ this -> getDoctrineColumnAliases ( $ columnMetadata ) ; $ options = $ this -> getDoctrineColumnOptions ( $ columnMetadata ) ; $ table -> addColumn ( $ columnMetadata [ 'name' ] , $ columnMetadata [ 'type' ] , $ options ) ; if ( ! empty ( $ columnMetadata [ 'primary' ] ) ) { $ primaryKeys [ ] = $ columnMetadata [ 'name' ] ; } if ( ! empty ( $ columnMetadata [ 'unique' ] ) ) { $ uniqueIndexes [ ] = $ columnMetadata [ 'name' ] ; } if ( ! empty ( $ columnMetadata [ 'index' ] ) ) { $ indexes [ ] = $ columnMetadata [ 'name' ] ; } } if ( ! empty ( $ primaryKeys ) ) { $ table -> setPrimaryKey ( $ primaryKeys ) ; } if ( ! empty ( $ uniqueIndexes ) ) { $ table -> addUniqueIndex ( $ uniqueIndexes ) ; } if ( ! empty ( $ indexes ) ) { $ table -> addIndex ( $ indexes ) ; } } | Generate a table from metadata . |
17,891 | protected function getDoctrineColumnOptions ( ColumnDefinition $ columnMetadata ) { $ options = $ columnMetadata [ 'options' ] ; if ( ! empty ( $ columnMetadata [ 'nullable' ] ) ) { $ options [ 'notnull' ] = ! $ columnMetadata [ 'nullable' ] ; } if ( ! empty ( $ columnMetadata [ 'default' ] ) ) { $ options [ 'default' ] = $ columnMetadata [ 'default' ] ; } if ( ! empty ( $ columnMetadata [ 'options' ] [ 'unsigned' ] ) ) { $ options [ 'unsigned' ] = $ columnMetadata [ 'options' ] [ 'unsigned' ] ; } if ( ! empty ( $ columnMetadata [ 'options' ] [ 'autoIncrement' ] ) ) { $ options [ 'autoincrement' ] = $ columnMetadata [ 'options' ] [ 'autoIncrement' ] ; } if ( ! empty ( $ columnMetadata [ 'options' ] [ 'fixed' ] ) ) { $ options [ 'fixed' ] = $ columnMetadata [ 'options' ] [ 'fixed' ] ; } return $ options ; } | Get the doctrine column options . |
17,892 | public static function getMembersOfGroup ( $ nb_user_group ) : CNabuUserGroupMemberList { if ( is_numeric ( $ nb_user_group_id = nb_getMixedValue ( $ nb_user_group , 'nb_user_group_id' ) ) ) { $ retval = CNabuUserGroupMember :: buildObjectListFromSQL ( 'nb_user_id' , "select ugm.* " . "from nb_user_group_member ugm, nb_user_group ug " . "where ugm.nb_user_group_id=ug.nb_user_group_id " . "and ugm.nb_user_group_id=%group_id\$d" , array ( 'group_id' => $ nb_user_group_id ) ) ; } else { $ retval = new CNabuUserGroupMemberList ( ) ; } return $ retval ; } | Gets all Members of a Group . |
17,893 | public function getAll ( $ appId , $ scanId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> sinks ( ) -> getAll ( $ appId , $ scanId , $ queryParams ) ; return new SinksResponse ( $ response ) ; } | Get all sinks for a scan |
17,894 | public function getById ( $ appId , $ scanId , $ sinkId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> sinks ( ) -> getById ( $ appId , $ scanId , $ sinkId , $ queryParams ) ; return new SinkResponse ( $ response ) ; } | Get sink for scan by id |
17,895 | public function getAll ( array $ queryParams = [ ] ) { $ response = $ this -> api -> teams ( ) -> getAll ( $ queryParams ) ; return new TeamsResponse ( $ response ) ; } | Get all teams |
17,896 | public function getById ( $ teamId , array $ queryParams = [ ] ) { $ response = $ this -> api -> teams ( ) -> getById ( $ teamId , $ queryParams ) ; return new TeamResponse ( $ response ) ; } | Get team by id |
17,897 | public function create ( TeamBuilder $ input , array $ queryParams = [ ] ) { $ response = $ this -> api -> teams ( ) -> create ( $ input -> toArray ( ) , $ queryParams ) ; return new TeamResponse ( $ response ) ; } | Create a new team |
17,898 | public function update ( $ teamId , TeamBuilder $ input , array $ queryParams = [ ] ) { $ response = $ this -> api -> teams ( ) -> update ( $ teamId , $ input -> toArray ( ) , $ queryParams ) ; return new TeamResponse ( $ response ) ; } | Update an existing team |
17,899 | public function deleteAll ( array $ queryParams = [ ] ) { $ response = $ this -> api -> teams ( ) -> deleteAll ( $ queryParams ) ; return new BaseResponse ( $ response ) ; } | Delete all teams |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.