initialize()

All models will automatically get Timestamp behavior attached
if created or modified exists.

@param array $config
@return void
14565
public function initialize(array $config) {
		// Shims
		if (isset($this->useTable)) {
			$this->setTable($this->useTable);
		}
		if (isset($this->primaryKey)) {
			$this->setPrimaryKey($this->primaryKey);
		}
		if (isset($this->displayField)) {
			$this->setDisplayField($this->displayField);
		}
		$this->_shimRelations();

		$this->_prefixOrderProperty();

		if (isset($this->actsAs)) {
			foreach ($this->actsAs as $name => $options) {
				if (is_numeric($name)) {
					$name = $options;
					$options = [];
				}
				$this->addBehavior($name, $options);
			}
		}

		if ($this->createdField || $this->modifiedField && !$this->hasBehavior('Timestamp')) {
			$this->addBehavior('Timestamp');
		}
	}
1024284
public function initialize(array $config)
    {
        Type::map('proffer.file', '\Proffer\Database\Type\FileType');
        $schema = $this->_table->getSchema();
        foreach (array_keys($this->getConfig()) as $field) {
            $schema->setColumnType($field, 'proffer.file');
        }
        $this->_table->setSchema($schema);
    }
786985
public function initialize(array $config)
    {
        $config = Hash::merge($this->_defaultConfig, $config);
        $this->setConfig($config);
    }
1287515
public function initialize(array $config)
    {
        $this->table('settings');

        $this->addBehavior('Wasabi/Core.KeyValue', [
            'scope' => 'Core'
        ]);

        $this->cacheDurations = [
            '1 hour' => __d('wasabi_core', '1 hour'),
            '2 hours' => __d('wasabi_core', '{0} hours', 2),
            '4 hours' => __d('wasabi_core', '{0} hours', 4),
            '8 hours' => __d('wasabi_core', '{0} hours', 8),
            '16 hours' => __d('wasabi_core', '{0} hours', 16),
            '1 day' => __d('wasabi_core', '1 day'),
            '2 days' => __d('wasabi_core', '{0} days', 2),
            '5 days' => __d('wasabi_core', '{0} days', 5),
            '7 days' => __d('wasabi_core', '{0} days', 7),
            '14 days' => __d('wasabi_core', '{0} days', 14),
            '30 days' => __d('wasabi_core', '{0} days', 30),
            '60 days' => __d('wasabi_core', '{0} days', 60),
            '90 days' => __d('wasabi_core', '{0} days', 90),
            '180 days' => __d('wasabi_core', '{0} days', 180),
            '365 days' => __d('wasabi_core', '{0} days', 365),
            '999 days' => __d('wasabi_core', '{0} days', 999)
        ];

        parent::initialize($config);
    }
921765
public function init( $config = NULL )
    {
        $this->config = $config;

        if ( isset( $config[ 'debug' ] ) )
        {
            $this->debug = $config[ 'debug' ];
        }

        $this->log = $this->filter( self::ON_SET_LOG_FILTER, NULL );

        $this->doAction( self::ON_COMPONENT_INIT_ACTION );
    }
235760
public function initialize(array $config)
    {
        $this->table('attachments');
        $this->displayField('filename');
        $this->primaryKey('id');
        $this->addBehavior('Timestamp');

        $this->schema()->columnType('tags', 'json');
    }
658474
public function initialize(array $config)
    {
        parent::initialize($config);

        if (Plugin::getCollection()->has('Assets')) {
            $this->Asset = $this->getView()->loadHelper('Assets.Asset');
        } else {
            $this->Asset = clone $this->Html;
        }
    }
841888
public function initialize(array $config)
    {
        $this->setTable($this->tablePrefix . $this->getTable());
        // HttpClient needs special header HTTP_X_UNIT_TEST_MODE => set in AppCakeTestCase::initHttpClient()
        if (isset($_SERVER['HTTP_X_UNIT_TEST_MODE'])
            || (php_sapi_name() == 'cli' && $_SERVER['argv'][0] && preg_match('/phpunit/', $_SERVER['argv'][0]))) {
            $this->setConnection(ConnectionManager::get('test'));
        }
        parent::initialize($config);
    }
316406
public function initialize(array $config)
    {
        $corePath  = Plugin::path('Core') . Configure::read('App.webroot') . '/' . Configure::read('App.lessBaseUrl');
        $cachePath = WWW_ROOT . Configure::read('App.cssBaseUrl') . Configure::read('App.cacheDir');

        $this
            ->setConfig('root_path', APP_ROOT)
            ->setConfig('cache_path', $cachePath)
            ->setConfig('root_url', Router::fullBaseUrl())
            ->setConfig('debug', Configure::read('debug'))
            ->setConfig('import_paths', [realpath($corePath) => realpath($corePath)]);

        parent::initialize($config);
    }
72048
protected function _initialize(AnConfig $config)
    {
        $config->append(array(
            'cache' => true,
            'cache_key' => (string) $this->getIdentifier(),
        ));

        parent::_initialize($config);
    }
898316
public function initialize(array $config = [])
    {
        $this->config = $config;
        if (is_array($this->config)) {
            if (array_keys($this->config) !== range(0, count($this->config) - 1)) {
                if (isset($this->config['db']) && is_array($this->config['db'])) {
                    foreach ($this->config['db'] as $key => &$value) {
                        if (!isset($value['port'])) {
                            $value['port'] = 3306;
                        }

                        if (!isset($value['charset'])) {
                            $value['charset'] = 'utf8';
                        }
                    }
                }

                $this->config = array_merge($this->defaults, $this->config);
                if (is_array($this->get('app_name'))) {
                    $hostName = Container::get('request')->getHostName();
                    if (array_key_exists($hostName, $this->get('app_name'))) {
                        $appName = $this->get('app_name')[$hostName];
                    } else {
                        throw new ConfigException('Cannot find any app paths.');
                    }
                } else {
                    $appName = $this->get('app_name');
                }

                if (Container::get('request')->isCli()) {
                    $stack = debug_backtrace();
                    $firstFrame = $stack[count($stack) - 1];
                    $initialFile = $firstFrame['file'];
                    $appFullPath = realpath(dirname($initialFile) . '/../' . rtrim($appName, '/'));
                } else {
                    $appFullPath = realpath(realpath('.') . '/../' . rtrim($appName, '/'));
                }

                if (!$appFullPath && !defined('KOTORI_PHP_TEST_ENV')) {
                    throw new ConfigException('Cannot find your app directory (' . $appName . ').');
                }

                $this->config = array_merge([
                    'app_full_path' => $appFullPath,
                ], $this->config);
                $this->set('namespace_prefix', basename($this->get('app_full_path')) . '\\');
            }
        } else {
            throw new ConfigException('config is not an array');
        }

        return $this;
    }
447730
public function init( $config = [ ] )
    {
        $handlers = array_values( $config[ 'handlers' ] );

        foreach ( $handlers as $conf )
        {
            $class = $conf[ 'class' ];

            $handler = new $class( $conf );

            $this->addHandler( $handler );
        }
    }
824166
public function initialize(array $config)
    {
        if (!$this->_config['key']) {
            $this->setConfig('key', Security::getSalt());
        }

        $controller = $this->_registry->getController();

        if ($controller === null) {
            $this->request = ServerRequestFactory::fromGlobals();
        }

        if (empty($this->_config['path'])) {
            $this->setConfig('path', $this->getController()->getRequest()->getAttribute('webroot'));
        }
    }
592682
public function initialize(array $config)
    {
        parent::initialize($config);

        if (isset($config['emptyValues'])) {
            $this->setConfig('emptyValues', $config['emptyValues'], false);
        }

        $collectionClass = $this->getConfig('collectionClass');
        if ($collectionClass) {
            $this->_collectionClass = $collectionClass;

            return;
        }

        $defaultCollectionClass = sprintf(
            '%s\Model\Filter\%sCollection',
            Configure::read('App.namespace'),
            $this->getTable()->getAlias()
        );
        if (class_exists($defaultCollectionClass)) {
            $this->_collectionClass = $defaultCollectionClass;
        }
    }
1064747
protected function _initialize(ObjectConfig $config)
    {
        $config->append(array(
            'users' => array($this->getObject('user')),
        ));

        parent::_initialize($config);
    }
1339251
public function initialize(array $config)
    {
        $table = Configure::read('Muffin/Tokenize.table', self::DEFAULT_TABLE);

        $this->setTable($table);
        $this->setPrimaryKey('id');
        $this->setDisplayField('token');

        $this->addBehavior('Timestamp');
    }
287586
protected function initialize(array $config)
    {
        $this->swooleServer = $this->createSwooleServer($config);

        $this->configureDefaultServerSocket();

        $this->setOptions($config['options'] ?? []);

        $this->registerEventCallbacks($this->serverEvents);

        $this->events->dispatch(new Events\ServerCreated($this));
    }