Register the Jaxon classes.

@param array             $aOptions               The options to register the classes with

@return void
339286
public function register(array $aOptions = array())
    {
        $sentry = jaxon()->sentry();
        $sentry->addClassOptions($this->appConfig);
        $sentry->mergeClassOptions($aOptions);
        $sentry->register();
    }
1356018
public function setOptions(array $options = null): void
    {
        // store options by default
        $this->options = (array)$options;

        // apply options
        foreach ($this->options as $key => $value) {
            $this->setOption($key, $value);
        }
    }
1198432
public function registerConfiguredProviders()
	{
		$manifestPath = $this->basePath() . '/vendor/services.json';

		(new ProviderRepository($this, new Filesystem, $manifestPath))
		            ->load($this->config['app.providers']);
	}
879874
public function setOptions(array $options)
    {
        foreach ($options as $option => $value) {
            $methodName = 'set'.ucfirst($option);
            if (method_exists($this, $methodName)) {
                $this->$methodName($value);
            }
        }
    }
472708
public function setOptions(array $options)
    {
        foreach ($options as $k => $v) {
            $this->setOption($k, $v);
        }
    }
496780
protected function registerBindings()
    {
        $binding = config('binding')?: [];

        foreach($binding as $contract => $implementation) {
            $this->bind($contract, $implementation);
        }
    }
269172
public static void register(Class<? extends View>... classes) {
        for (Class<? extends View> classe : classes) {
            register(classe);
        }
    }
348341
private function registerAnnotations()
    {
        $annotations = [
            'Document',
            'Property',
            'Embedded',
            'ObjectType',
            'Nested',
            'Id',
            'ParentDocument',
            'Routing',
            'Version',
            'HashMap',
        ];

        foreach ($annotations as $annotation) {
            AnnotationRegistry::registerFile(__DIR__ . "/../Annotation/{$annotation}.php");
        }

        if (version_compare(PHP_VERSION, '7.2.0') < 0) {
            AnnotationRegistry::registerFile(__DIR__ . "/../Annotation/Object.php");
        }
    }
217341
public function registerComponents()
    {
        // Check objects
        if (empty($this->paths)) {
            return;
        }

        // Work on file paths
        foreach ($this->paths as $action => $actionPaths) {
            // Work on paths
            $actionPaths = !is_array($actionPaths) ? [$actionPaths] : $actionPaths;

            // Work on file name
            $filepath = OL_ZEUS_CACHE.$this->classname.'-'.$action.'-components.php';

            // Check cache file
            if (!file_exists($filepath)) {
                // Store all in cache file
                ClassMapGenerator::dump($actionPaths, $filepath);
            }

            $classmap = include_once $filepath;

            // Instanciate new ClassLoader to load and register components
            $loader = new MapClassLoader($classmap);
            $loader->register();

            // Get current hook
            $current = current_filter();
            $function = in_array($action, ['widgets_init']) ? 'registerWidgets' : 'registerObjects';

            // Register post type
            if ($action === $current) {
                // Already inside an `init` action
                $this->$function($classmap);
            } else {
                // Outside an `init` action
                add_action($action, function () use ($classmap, $function) {
                    $this->$function($classmap);
                });
            }
        }
    }
33282
private function registerProviders()
    {
        $this->providers = $this->defaultProviders;

        $providers = [];
        foreach($this->providers as $provider) {
            if ($provider === 'EasyWeChat\Foundation\ServiceProviders\OpenPlatformServiceProvider') {
                continue;
            }

            $providers[] = $provider;
        }

        $this->providers = $providers;

        if ($this['config']['auth_type'] === Config::AUTH_TYPE_COMPONENT) {
            $providers = [];
            foreach($this->providers as $provider) {
                if ($provider === 'EasyWeChat\Foundation\ServiceProviders\ServerServiceProvider'
                    || $provider === 'EasyWeChat\Foundation\ServiceProviders\OAuthServiceProvider') {
                    continue;
                }

                $providers[] = $provider;
            }

            $this->providers = $providers;

            array_push($this->providers, ServiceProviders\OAuthServiceProvider::class);
            array_push($this->providers, ServiceProviders\ServerServiceProvider::class);
        }

        foreach ($this->providers as $provider) {
            $this->register(new $provider());
        }
    }
984442
protected function _options(array $opts)
    {
        if (!empty($opts['targetForeignKey'])) {
            $this->setTargetForeignKey($opts['targetForeignKey']);
        }
        if (!empty($opts['joinTable'])) {
            $this->_junctionTableName($opts['joinTable']);
        }
        if (!empty($opts['through'])) {
            $this->setThrough($opts['through']);
        }
        if (!empty($opts['saveStrategy'])) {
            $this->setSaveStrategy($opts['saveStrategy']);
        }
        if (isset($opts['sort'])) {
            $this->setSort($opts['sort']);
        }
    }
753160
public static function registerHelpers( $classes ) {

		if( !is_array($classes) )
			$classes = [$classes];

		foreach( $classes as $class ) {

			$class   = new \ReflectionClass($class);
			$methods = $class->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_STATIC);

			foreach( $methods as $m ) {
				static::addHelperMethod($class->name, $m->name);
			}
			
		}

	}
1042380
public function runScaffolding(array $aOptions = array())
	{
        /**
         * option -v [if you want the script tell you - dump of sql]
         */

        if (isset($aOptions['v'])) { $bDumpSql = true;}
        else { $bDumpSql = false; }

		/**
		 * option -p [portail]
		 */

		if (isset($aOptions['p'])) { 
		    
		    $sPortal = $aOptions['p'];
		}
		else { 
		    
		    echo 'Error: you must indicated the Entity Path';
		    exit;
		}

		/**
		 * option -r [yes/no]
		 */

		if (isset($aOptions['r']) && $aOptions['r'] === 'yes') { $sRewrite = $aOptions['r']; }
		else { $sRewrite = 'no'; }

		/**
		 * option -c [create table]
		 */

		if (isset($aOptions['c'])) { $bCreate = true; }
		else { $bCreate = false; }

		/**
		 * option -e [create entity and models]
		 */

		if (isset($aOptions['e'])) { $bCreateEntity = true; }
		else { $bCreateEntity = false; }

		/**
		 * option -f [create models if not exists]
		 */

		if (isset($aOptions['f'])) { 
			
			$bCreateModelIfNotExists = true;
			$bCreateEntity = true;
		}
		else { 
			
			$bCreateModelIfNotExists = false;
		}

		/**
		 * option -a [indicated the sql json file]
		 */

	    if (isset($aOptions['a'])) { $sSqlJsonFile = $aOptions['a']; }
		else { $sSqlJsonFile = false; }

		/**
		 * option -b [indicated the sql json]
		 */

	    if (isset($aOptions['b'])) { $sSqlJson = $aOptions['b']; }
		else { $sSqlJson = false; $sSqlJsonFile = str_replace('Batch', '', __DIR__).'Db.conf'; }

		/**
		 * option -d [drop table]
		 */

		if (isset($aOptions['d'])) { $bDropTable = true; }
		else { $bDropTable = false; }

		/**
		 * option -g [indicate the Entities directory]
		 */

	    if (isset($aOptions['g'])) { $sEntitiesPath = $aOptions['g']; }
		else { $sEntitiesPath = ''; }

		/**
		 * option -h [indicate the Models directory]
		 */

	    if (isset($aOptions['h'])) { $sModelsPath = $aOptions['h']; }
		else { $sModelsPath = ''; }

		/**
		 * option -i [indicated the const json file to manage annotation in files]
		 */

	    if (isset($aOptions['i'])) { $oConstJson = json_decode(file_get_contents($aOptions['i']));}
		else { $oConstJson = '../Const.conf'; }
		
		if (is_object($oConstJson)) {
		    
		    foreach ($oConstJson as $sKey => $mValue) {
		        
		        if (is_string($mValue) || is_int($mValue) || is_float($mValue)) {
		            
		            if (!defined(strtoupper($sKey))) { define(strtoupper($sKey), $mValue); }
		        }
		    }
	    }

		if ($sSqlJsonFile !== false) { $oJson = json_decode(file_get_contents($sSqlJsonFile)); }
		else { $oJson = json_decode($sSqlJson); }
		
		$oConnection = $oJson->configuration;

		    if (!defined('SQL_FIELD_NAME_SEPARATOR')) {
		        
    		    if ($oConnection->type == 'mysql') {
    
    		        define('SQL_FIELD_NAME_SEPARATOR', '`');
    		    }
    		    else {
    		        
    		        define('SQL_FIELD_NAME_SEPARATOR', '');
    		    }
		    }
		    
			/**
			 * scaffolding of the database
			 */

			if ($bCreate === true) {

			    $oContainer = new DbContainer;

        		$oContainer->setDbName($oConnection->db)
        		           ->setHost($oConnection->host)
        		           ->setName($oConnection->db)
        		           ->setPassword($oConnection->password)
        		           ->setType($oConnection->type)
        		           ->setUser($oConnection->user);
			    
				$oPdo = Db::connect($oContainer);
				
				foreach ($oConnection->tables as $sTableName => $oOneTable) {

    				foreach ($oOneTable->fields as $sFieldName => $oOneField) {
    				
    				    if (isset($oOneField->many_to_many)) {
    				        
    				        if (!isset($oConnection->tables->{$sTableName.'_'.$oOneField->many_to_many})) {

    				            $oConnection->tables->{$sTableName.'_'.$oOneField->many_to_many} = new \stdClass();    				            
    				            $oConnection->tables->{$sTableName.'_'.$oOneField->many_to_many}->fields = new \stdClass();

    				            $oConnection->tables->{$sTableName.'_'.$oOneField->many_to_many}->fields->{'id_'.$sTableName} = new \stdClass();
    				            $oConnection->tables->{$sTableName.'_'.$oOneField->many_to_many}->fields->{'id_'.$sTableName}->type = $oOneField->type;
    				            $oConnection->tables->{$sTableName.'_'.$oOneField->many_to_many}->fields->{'id_'.$sTableName}->key = 'primary';

    				            if (isset($oOneField->null)) {
    				                
    				                $oConnection->tables->{$sTableName.'_'.$oOneField->many_to_many}->fields->{'id_'.$sTableName}->null = $oOneField->null;
    				            }
    				            
    				            if (isset($oOneField->unsigned)) {
    				            
    				                $oConnection->tables->{$sTableName.'_'.$oOneField->many_to_many}->fields->{'id_'.$sTableName}->unsigned = $oOneField->unsigned;
    				            }
    				            
    				            foreach ($oConnection->tables->{$oOneField->many_to_many}->fields as $sNameOfManyToManyField => $oField) {
    				            
    				                if (isset($oField->key) && $oField->key == 'primary') { $sFieldOfManyToMany = $oField; }
    				            }
    				            
    				            $oConnection->tables->{$sTableName.'_'.$oOneField->many_to_many}->fields->{'id_'.$oOneField->many_to_many} = new \stdClass();
    				            $oConnection->tables->{$sTableName.'_'.$oOneField->many_to_many}->fields->{'id_'.$oOneField->many_to_many}->type = $sFieldOfManyToMany->type;
    				            $oConnection->tables->{$sTableName.'_'.$oOneField->many_to_many}->fields->{'id_'.$oOneField->many_to_many}->key = 'primary';
    				            //@todo : attribute ne se rajoute pas en field donc erreur dans jointure
    				            $oConnection->tables->{$sTableName.'_'.$oOneField->many_to_many}->fields->{'id_'.$oOneField->many_to_many}->join = $oOneField->many_to_many;
    				            $oConnection->tables->{$sTableName.'_'.$oOneField->many_to_many}->fields->{'id_'.$oOneField->many_to_many}->join_by_field = 'id';
    				            $oConnection->tables->{$sTableName.'_'.$oOneField->many_to_many}->fields->{'id_'.$sTableName}->join = $sTableName;
    				            $oConnection->tables->{$sTableName.'_'.$oOneField->many_to_many}->fields->{'id_'.$sTableName}->join_by_field = 'id';
    				            
    				            $oConnection->tables->{$oOneField->many_to_many}->fields->{'id'}->join = array();
    				            $oConnection->tables->{$oOneField->many_to_many}->fields->{'id'}->join_by_field = array();
    				            $oConnection->tables->{$oOneField->many_to_many}->fields->{'id'}->join[] = $sTableName.'_'.$oOneField->many_to_many;
    				            $oConnection->tables->{$oOneField->many_to_many}->fields->{'id'}->join_by_field[] = 'id_'.$oOneField->many_to_many;
    				            $oConnection->tables->{$sTableName}->fields->{'id'}->join = array();
    				            $oConnection->tables->{$sTableName}->fields->{'id'}->join_by_field = array();
    				            $oConnection->tables->{$sTableName}->fields->{'id'}->join[] = $sTableName.'_'.$oOneField->many_to_many;
    				            $oConnection->tables->{$sTableName}->fields->{'id'}->join_by_field[] = 'id_'.$oOneField->many_to_many;
    				            
    				            if (isset($sFieldOfManyToMany->null)) {
    				                
    				                $oConnection->tables->{$sTableName.'_'.$oOneField->many_to_many}->fields->{'id_'.$oOneField->many_to_many}->null = $sFieldOfManyToMany->null;
    				            }
    				            
    				            if (isset($sFieldOfManyToMany->unsigned)) {
    				            
    				                $oConnection->tables->{$sTableName.'_'.$oOneField->many_to_many}->fields->{'id_'.$oOneField->many_to_many}->unsigned = $sFieldOfManyToMany->unsigned;
    				            }
    				        }
    				    }
    				    
    				    if (isset($oOneField->join)) {

    				        if (isset($oOneField->join_by_field)) { $sJoinByField = $oOneField->join_by_field; }
    				        else { $sJoinByField = $oOneField->join; }
    				        
    				        if (is_string($oOneField->join)) { $aOneFieldJoin = array($oOneField->join); }
    				        else { $aOneFieldJoin = $oOneField->join; }
    				        
    				        if (is_string($sJoinByField)) { $aJoinByField = array($sJoinByField); }
    				        else { $aJoinByField = $sJoinByField; }
    				        
    				        foreach ($aOneFieldJoin as $iKey => $sOneFieldJoin) {
    				            
    				            $sJoinByField = $aJoinByField[$iKey];
        				        
    				            if (isset($oConnection->tables->{$sOneFieldJoin}->fields->{$sJoinByField}->key)
    				                && $oConnection->tables->{$sOneFieldJoin}->fields->{$sJoinByField}->key == 'primary'
    				                && !isset($oConnection->tables->{$sOneFieldJoin}->fields->{$sJoinByField}->join)) {
    
    				                $oConnection->tables->{$sOneFieldJoin}->fields->{$sJoinByField}->join = array();
    				                $oConnection->tables->{$sOneFieldJoin}->fields->{$sJoinByField}->join[0] = $sTableName;
    				                $oConnection->tables->{$sOneFieldJoin}->fields->{$sJoinByField}->join_by_field[0] = $sFieldName;
    				            }
    				            else if (isset($oConnection->tables->{$sOneFieldJoin}->fields->{$sJoinByField}->key)
    				                && $oConnection->tables->{$sOneFieldJoin}->fields->{$sJoinByField}->key == 'primary'
    				                && isset($oConnection->tables->{$sOneFieldJoin}->fields->{$sJoinByField}->join)
    				                && is_array($oConnection->tables->{$sOneFieldJoin}->fields->{$sJoinByField}->join)
    				                && !in_array($sTableName, $oConnection->tables->{$sOneFieldJoin}->fields->{$sJoinByField}->join)) {
    				                
                                    $iIndex = count($oConnection->tables->{$sOneFieldJoin}->fields->{$sJoinByField}->join);
    				                $oConnection->tables->{$sOneFieldJoin}->fields->{$sJoinByField}->join[$iIndex] = $sTableName;
    				                $oConnection->tables->{$sOneFieldJoin}->fields->{$sJoinByField}->join_by_field[$iIndex] = $sFieldName;
    				            }
    				            else if (!isset($oConnection->tables->{$sOneFieldJoin}->fields->{$sJoinByField}->join)) {

    				                $oConnection->tables->{$sOneFieldJoin}->fields->{$sJoinByField}->join = $sTableName;
    				                $oConnection->tables->{$sOneFieldJoin}->fields->{$sJoinByField}->join_by_field = $sFieldName;
    				            }
    				        }
    				    }
    				}
    			}
    			
				foreach ($oConnection->tables as $sTableName => $oOneTable) {

					if ($bDropTable === true) {
						
						$sQuery = 'DROP TABLE IF EXISTS '.SQL_FIELD_NAME_SEPARATOR.$sTableName.SQL_FIELD_NAME_SEPARATOR;
						if ($bDumpSql) { echo $sQuery."\n"; } else { $oPdo->query($sQuery); }
					}
					
					$sQuery = 'CREATE TABLE IF NOT EXISTS '.SQL_FIELD_NAME_SEPARATOR.$sTableName.SQL_FIELD_NAME_SEPARATOR.' (';

					$aIndex = array();
					$aUnique = array();
					$aPrimaryKey = array();

					foreach ($oOneTable->fields as $sFieldName => $oOneField) {

						$sQuery .= SQL_FIELD_NAME_SEPARATOR.$sFieldName.SQL_FIELD_NAME_SEPARATOR.' '.$oOneField->type;

						if (isset($oOneField->values) && $oOneField->type === 'enum' && is_array($oOneField->values)) {

							$sQuery .= '("'.implode('","', $oOneField->values).'") ';
						}
						else if (isset($oOneField->value) && (is_int($oOneField->value) || preg_match('/^[0-9,]+$/', $oOneField->value))) {

							$sQuery .= '('.$oOneField->value.') ';
						}

						if (isset($oOneField->unsigned) && $oOneField->unsigned === true) {

							$sQuery .= ' UNSIGNED ';
						}

						if (isset($oOneField->null) && $oOneField->null === true) { $sQuery .= ' NULL '; }
						else if (isset($oOneField->null) && $oOneField->null === false) { $sQuery .= ' NOT NULL '; }

						if (isset($oOneField->default) && is_string($oOneField->default)) {

							$sQuery .= ' DEFAULT "'.$oOneField->default.'" ';
						}
						else if (isset($oOneField->default)) {

							$sQuery .= ' DEFAULT '.$oOneField->default.' ';
						}

						if (isset($oOneField->autoincrement) && $oOneField->autoincrement === true) {

							$sQuery .= ' AUTO_INCREMENT ';
						}

						$sQuery .= ', ';

						if (isset($oOneField->key) && $oOneField->key === 'primary') { $aPrimaryKey[] = $sFieldName; }
						else if (isset($oOneField->key) && $oOneField->key === 'index') { $aIndex[] = $sFieldName; }
						else if (isset($oOneField->key) && $oOneField->key === 'unique') { $aUnique[] = $sFieldName; }
					
    					if (isset($oOneField->join) && is_string($oOneField->join)) {

    					    if (isset($oOneField->constraint) && is_string($oOneField->constraint)) {
    					    
    					        $sQuery .= ' CONSTRAINT '.$oOneField->constraint.' ';
    					    }
    					    
    					    $sQuery .= 'FOREIGN KEY('.$sFieldName.') REFERENCES '.$oOneField->join.'('.$oOneField->join_by_field.') ';
    					    
    					    if (isset($oOneField->join_delete) && is_string($oOneField->join_delete)) {
    					        
    					        $sQuery .= ' ON DELETE '.$oOneField->join_delete.' ';
    					    }

    					    if (isset($oOneField->join_update) && is_string($oOneField->join_update)) {
    					        	
    					        $sQuery .= ' ON UPDATE '.$oOneField->join_update.' ';
    					    }
    					    
    					    $sQuery .= ',';
    					}
					}

					if (count($aPrimaryKey) > 0) { $sQuery .= 'PRIMARY KEY('.implode(',', $aPrimaryKey).') , '; }
					
					if (count($aIndex) > 0) { $sQuery .= 'KEY('.implode(',', $aIndex).') , '; }
					
					if (count($aUnique) > 0) { $sQuery .= 'UNIQUE KEY '.$aUnique[0].' ('.implode(',', $aUnique).') , '; }

					if (isset($oOneTable->index)) {

						foreach ($oOneTable->index as $sIndexName => $aFields) {

							$sQuery .= 'KEY '.$sIndexName.' ('.implode(',', $aFields).') , ';
						}
					}

					if (isset($oOneTable->unique)) {

						foreach ($oOneTable->unique as $sIndexName => $aFields) {

							$sQuery .= 'KEY '.$sIndexName.' ('.implode(',', $aFields).') , ';
						}
					}

					$sQuery = substr($sQuery, 0, -2);
					$sQuery .= ')';
					
					if (isset($oOneTable->engine)) {  $sQuery .= ' ENGINE='.$oOneTable->engine.' '; }
					if (isset($oOneTable->auto_increment)) {  $sQuery .= ' AUTO_INCREMENT='.$oOneTable->auto_increment.' '; }
					if (isset($oOneTable->default_charset)) {  $sQuery .= ' DEFAULT CHARSET='.$oOneTable->default_charset.' '; }

                    if ($bDumpSql) {
                        echo $sQuery."\n";
                    } else  if ($oPdo->query($sQuery) === false) {
					    
					   echo "\n[ERROR SQL] ".$oPdo->errorInfo()[2]." for the table ".$sTableName."\n"; 
					   echo "\n".$sQuery."\n"; 
					}
				}
			}

			/**
			 * scaffolding of the entities
			 */

			if ($bCreateEntity) {
					
				foreach ($oConnection->tables as $sTableName => $oOneTable) {
	
					$sContentFile = '<?php
	
/**
 * Entity to '.$sTableName.'
 *
 * @category  	\\'.CATEGORY.'
 * @package   	'.ENTITY_NAMESPACE.'
 * @author    	'.AUTHOR.'
 * @copyright 	'.COPYRIGHT.'
 * @license   	'.LICENCE.'
 * @version   	Release: '.VERSION.'
 * @filesource	'.FILESOURCE.'
 * @link      	'.LINK.'
 * @since     	1.0
 */
namespace '.preg_replace('/^\\\\/', '', ENTITY_NAMESPACE).';

use \Attila\core\Entity as Entity;
use \Attila\Orm as Orm;

/**
 * Entity to '.$sTableName.'
 *
 * @category  	\\'.CATEGORY.'
 * @package   	'.ENTITY_NAMESPACE.'
 * @author    	'.AUTHOR.'
 * @copyright 	'.COPYRIGHT.'
 * @license   	'.LICENCE.'
 * @version   	Release: '.VERSION.'
 * @filesource	'.FILESOURCE.'
 * @link      	'.LINK.'
 * @since     	1.0
 */
class '.$sTableName.' extends Entity 
{';
	
					foreach ($oOneTable->fields as $sFieldName => $oField) {
	
						if ($oField->type == 'enum' || $oField->type == 'char' || $oField->type == 'varchar' || $oField->type == 'text'
							|| $oField->type == 'date' || $oField->type == 'datetime' || $oField->type == 'time' || $oField->type == 'binary'
							|| $oField->type == 'varbinary' || $oField->type == 'blob' || $oField->type == 'tinyblob'
							|| $oField->type == 'tinytext' || $oField->type == 'mediumblob' || $oField->type == 'mediumtext'
							|| $oField->type == 'longblob' || $oField->type == 'longtext' || $oField->type == 'char varying'
							|| $oField->type == 'long varbinary' || $oField->type == 'long varchar' || $oField->type == 'long') {
	
							$sType = 'string';
						}
						else if ($oField->type == 'int' || $oField->type == 'smallint' || $oField->type == 'tinyint'
							|| $oField->type == 'bigint' || $oField->type == 'mediumint' || $oField->type == 'timestamp'
							|| $oField->type == 'year' || $oField->type == 'integer' || $oField->type == 'int1' || $oField->type == 'int2'
							|| $oField->type == 'int3' || $oField->type == 'int4' || $oField->type == 'int8' || $oField->type == 'middleint') {
	
							$sType = 'int';
						}
						else if ($oField->type == 'bit' || $oField->type == 'bool' || $oField->type == 'boolean') {
	
							$sType = 'bool';
						}
						else if ($oField->type == 'float' || $oField->type == 'decimal' || $oField->type == 'double'
							|| $oField->type == 'precision' || $oField->type == 'real' || $oField->type == 'float4'
							|| $oField->type == 'float8' || $oField->type == 'numeric') {
	
							$sType = 'float';
						}
						else if ($oField->type == 'set') {
	
							$sType = 'array';
						}
	
						$sContentFile .= '
	/**
	 * '.$sFieldName.'
	 *
	 * @access private
	 * @var    '.$sType.'
	 *
';
	
						if (isset($oField->key) && $oField->key == 'primary') {
	
							$sContentFile .= '	 * @primary_key'."\n";
						}
	
						if (isset($oField->property)) {
	
							$sContentFile .= '	 * @map '.$oField->property.''."\n";
						}
	
						$sContentFile .= '	 */
    private $'.$sFieldName.' = null;
	';
						if (isset($oField->join)) {
	
						    if (!is_array($oField->join)) {
						        
						        $oField->join = array($oField->join);
						        if (isset($oField->join_alias)) { $oField->join_alias = array($oField->join_alias); }
						        if (isset($oField->join_by_field)) { $oField->join_by_field = array($oField->join_by_field); }
						    }
						    
						    for ($i = 0 ; $i < count($oField->join) ; $i++) {
						    
						        if (isset($oField->join_alias[$i])) { $sJoinUsedName = $oField->join_alias[$i]; }
							    else { $sJoinUsedName = $oField->join[$i]; }
	
								$sContentFile .= '
	/**
	 * '.$sJoinUsedName.' Entity
	 *
	 * @access private
	 * @var    '.$oField->join[$i].'
	 * @join
	 *
	 */
    private $'.$sJoinUsedName.' = null;
	
	
	';
						    }
						}
					}
	
					foreach ($oOneTable->fields as $sFieldName => $oField) {
	
						if ($oField->type == 'enum' || $oField->type == 'char' || $oField->type == 'varchar' || $oField->type == 'text'
							|| $oField->type == 'date' || $oField->type == 'datetime' || $oField->type == 'time' || $oField->type == 'binary'
							|| $oField->type == 'varbinary' || $oField->type == 'blob' || $oField->type == 'tinyblob'
							|| $oField->type == 'tinytext' || $oField->type == 'mediumblob' || $oField->type == 'mediumtext'
							|| $oField->type == 'longblob' || $oField->type == 'longtext' || $oField->type == 'char varying'
							|| $oField->type == 'long varbinary' || $oField->type == 'long varchar' || $oField->type == 'long') {
	
							$sType = 'string';
						}
						else if ($oField->type == 'int' || $oField->type == 'smallint' || $oField->type == 'tinyint'
						    || $oField->type == 'bigint' || $oField->type == 'mediumint' || $oField->type == 'timestamp'
						    || $oField->type == 'year' || $oField->type == 'integer' || $oField->type == 'int1' || $oField->type == 'int2'
						    || $oField->type == 'int3' || $oField->type == 'int4' || $oField->type == 'int8' 
							|| $oField->type == 'middleint') {
	
							$sType = 'int';
						}
						else if ($oField->type == 'bit' || $oField->type == 'bool' || $oField->type == 'boolean') {
	
							$sType = 'bool';
						}
						else if ($oField->type == 'float' || $oField->type == 'decimal' || $oField->type == 'double'
							|| $oField->type == 'precision' || $oField->type == 'real' || $oField->type == 'float4'
							|| $oField->type == 'float8' || $oField->type == 'numeric') {
	
							$sType = 'float';
						}
						else if ($oField->type == 'set') {
	
							$sType = 'array';
						}
	
						$sContentFile .= '
	/**
	 * get '.$sFieldName.' of '.$sTableName.'
	 *
	 * @access public
	 * @return '.$sType.'
	 */
	public function get_'.$sFieldName.'()
	{
		return $this->'.$sFieldName.';
	}

	/**
	 * set '.$sFieldName.' of '.$sTableName.'
	 *
	 * @access public
	 * @param  '.$sType.' $'.$sFieldName.' '.$sFieldName.' of '.$sTableName.'
	 * @return '.ENTITY_NAMESPACE.'\\'.$sTableName.'
	 */
	public function set_'.$sFieldName.'($'.$sFieldName.') 
	{
		$this->'.$sFieldName.' = $'.$sFieldName.';
		return $this;
	}
	';
						if (isset($oField->join)) {
	
							/**
							 * you could add join_by_field when you have a field name different in the join
							 * @example		ON menu1.id = menu2.parent_id
							 *
							 * if the left field and the right field have the same name, you could ignore this param.
							 */
	
						    if (!is_array($oField->join)) {
						        
						        $oField->join = array($oField->join);
						        if (isset($oField->join_alias)) { $oField->join_alias = array($oField->join_alias); }
						        if (isset($oField->join_by_field)) { $oField->join_by_field = array($oField->join_by_field); }
						    }
						    
						    for ($i = 0 ; $i < count($oField->join) ; $i++) {
	
    							if (isset($oField->join_by_field[$i])) { $sJoinByField = $oField->join_by_field[$i]; }
    							else { $sJoinByField = $sFieldName; }
    	
    							if (isset($oField->join_alias[$i])) { $sJoinUsedName = $oField->join_alias[$i]; }
    							else { $sJoinUsedName = $oField->join[$i]; }
    	
    							$sContentFile .= '
	/**
	 * get '.$sJoinUsedName.' entity join by '.$sFieldName.' of '.$sTableName.'
	 *
	 * @access public
	 * @param  array $aWhere
	 * @join
	 * @return ';
								
    							$sKey2 = '';
    							$iPrimaryKey = 0;
    							
                                if (count($oField->join) == 1) {
                                    
                                    if (isset($oConnection->tables->{$oField->join[0]}->fields->{$oField->join_by_field[0]}->key)) {
                                        
                                        $sKey2 = $oConnection->tables->{$oField->join[0]}->fields->{$oField->join_by_field[0]}->key;
                                        $iPrimaryKey = 0;
                                        
                                        foreach ($oConnection->tables->{$oField->join[0]}->fields as $iKey2 => $oField2) {
                                            
                                            if (isset($oField2->key) && $oField2->key == 'primary') {
                                                
                                                $iPrimaryKey++;
                                            }
                                        }
                                    }
                                }
                                
                                if ($sKey2 == 'primary' && $iPrimaryKey == 1) {
                                    
                                    $sContentFile .= ENTITY_NAMESPACE.'\\'.$sTableName;
                                }
    							else if (isset($oField->key) && ($oField->key == 'primary' || in_array('primary', $oField->key))) { 
    
    							    $sContentFile .= 'array';
    							}
    							else {
    								    
    							    $sContentFile .= ENTITY_NAMESPACE.'\\'.$sTableName;
    							}
    			                     
    							$sContentFile .= '
	 */
	public function get_'.$sJoinUsedName.'($aWhere = array())
	{
		if ($this->'.$sJoinUsedName.' === null) {

			$oOrm = new Orm;

			$oOrm->select(array(\'*\'))
				 ->from(\''.$oField->join[$i].'\');
												   
	        $aWhere[\''.$sJoinByField.'\'] = $this->get_'.$sFieldName.'();
											
													  ';
								
							    $sContentFile .= '
            ';
							    if ($sKey2 == 'primary' && $iPrimaryKey == 1) {
							    
							        $sContentFile .= '$aResult';
							    }
							    else if (isset($oField->key) && ($oField->key == 'primary' || in_array('primary', $oField->key))) { 
    
    							    $sContentFile .= '$this->'.$oField->join[$i].'';
    							}
    							else {
    								    
    							    $sContentFile .= '$aResult';
    							}
    			                     
    							$sContentFile .= ' = $oOrm->where($aWhere)
						           ->load(false, \''.ENTITY_NAMESPACE.'\\\\\');';

    							if ((!isset($oField->key) || (isset($oField->key) && $oField->key != 'primary' 
    							 && (is_array($oField->key) && !in_array('primary', $oField->key))))
						         || ($sKey2 == 'primary' && $iPrimaryKey == 1)) { 
    								    
    							    $sContentFile .= "\n\n".'          if (count($aResult) > 0) { $this->'.$sJoinUsedName.' = $aResult[0]; }
          else { $this->'.$sJoinUsedName.' = array(); }';
    							}
    			                     
    							$sContentFile .= '
        }

		return $this->'.$sJoinUsedName.';
	}
	
	/**
	 * set '.$sJoinUsedName.' entity join by '.$sFieldName.' of '.$sTableName.'
	 *
	 * @access public
	 * @param  '.ENTITY_NAMESPACE.'\\'.$oField->join[$i].'  $'.$sJoinUsedName.' '.$oField->join[$i].' entity
	 * @join
	 * @return ';
		 
    							if (isset($oField->key) && ($oField->key == 'primary' || (is_array($oField->key) && in_array('primary', $oField->key)))) { 
    
    							    $sContentFile .= 'array';
    							}
    							else {
    								    
    							    $sContentFile .= ENTITY_NAMESPACE.'\\'.$sTableName;
    							}
    			                     
    							$sContentFile .= '
	 */
	public function set_'.$sJoinUsedName.'(';
		 
    							if (isset($oField->key) && ($oField->key == 'primary' || (is_array($oField->key) && in_array('primary', $oField->key)))) { 
    
    							    $sContentFile .= 'array';
    							}
    							else {
    								    
    							    $sContentFile .= ENTITY_NAMESPACE.'\\'.$oField->join[$i];
    							}
			                     
							    $sContentFile .= ' $'.$sJoinUsedName.')
	{
		$this->'.$sJoinUsedName.' = $'.$sJoinUsedName.';
		return $this;
	}
';
						    }
						}	
					}
	
					$sContentFile .= '}';
	
					file_put_contents($sEntitiesPath.$sTableName.'.php', $sContentFile);
	
					if ($bCreateModelIfNotExists === false || ($bCreateModelIfNotExists === true 
						&& !file_exists($sModelsPath.$sTableName.'.php'))) {
					
						$sContentFile = '<?php
	
/**
 * Model to '.$sTableName.'
 *
 * @category  	\\'.CATEGORY.'
 * @package   	'.MODEL_NAMESPACE.'
 * @author    	'.AUTHOR.'
 * @copyright 	'.COPYRIGHT.'
 * @license   	'.LICENCE.'
 * @version   	Release: '.VERSION.'
 * @filesource	'.FILESOURCE.'
 * @link      	'.LINK.'
 * @since     	1.0
 */
namespace Venus\src\\'.$sPortal.'\Model;

use \Venus\core\Model as Model;
	
/**
 * Model to '.$sTableName.'
 *
 * @category  	\\'.CATEGORY.'
 * @package   	'.MODEL_NAMESPACE.'
 * @author    	'.AUTHOR.'
 * @copyright 	'.COPYRIGHT.'
 * @license   	'.LICENCE.'
 * @version   	Release: '.VERSION.'
 * @filesource	'.FILESOURCE.'
 * @link      	'.LINK.'
 * @since     	1.0
 */
class '.$sTableName.' extends Model 
{
}'."\n";
	
						file_put_contents($sModelsPath.$sTableName.'.php', $sContentFile);
					}
				}
			}

        echo "\n\n";
        echo Bash::setBackground("                                                                            ", 'green');
        echo Bash::setBackground("          [OK] Success                                                      ", 'green');
        echo Bash::setBackground("                                                                            ", 'green');
        echo "\n\n";
	}
1223042
public static function register(array $permissions): void
    {
        $permissions = self::format($permissions);

        self::$permissions = array_merge(self::$permissions, $permissions);
    }
855828
protected function registerBindings(): void
    {
        $this->app->bind('algolia.connection', function (Container $app) {
            $manager = $app['algolia'];

            return $manager->connection();
        });

        $this->app->alias('algolia.connection', SearchClient::class);
    }
182760
public function registerParsers(array $parsers)
	{
		foreach ($parsers as $extension => $parser)
		{
			$this->registerParser($extension, $parser);
		}
	}
479529
public static function registerResponseClass(
		string $responseClassName,
		string...$accept
	):void {
		if(empty($accept)) {
			$accept = [self::DEFAULT_ACCEPT];
		}

		foreach($accept as $a) {
			static::$responseClassLookup [$a] = $responseClassName;
		}
	}