Exemple #1
0
 /**
  * Set code and config.
  *
  * @param string $code
  * @param array $config
  */
 public function __construct($code, array $config = [])
 {
     parent::__construct(['initialize' => false] + $config);
     $this->_code = $code;
     $this->_localeBundle = new LocaleBundle();
     $this->_messageBundle = new MessageBundle();
     // Add default resource paths
     if ($paths = Config::get('titon.path.resources')) {
         $this->addResourcePaths('core', $paths);
     }
 }
Exemple #2
0
 /**
  * Store the driver.
  *
  * @param \Titon\Db\Driver $driver
  */
 public function __construct(Driver $driver)
 {
     $this->setDriver($driver);
     $this->addStatements([Query::INSERT => new Statement('INSERT INTO {table} {fields} VALUES {values}'), Query::SELECT => new Statement('SELECT {fields} FROM {table} {joins} {where} {groupBy} {having} {compounds} {orderBy} {limit}'), Query::UPDATE => new Statement('UPDATE {table} {joins} SET {fields} {where} {orderBy} {limit}'), Query::DELETE => new Statement('DELETE FROM {table} {joins} {where} {orderBy} {limit}'), Query::TRUNCATE => new Statement('TRUNCATE {table}'), Query::CREATE_TABLE => new Statement("CREATE TABLE IF NOT EXISTS {table} (\n{columns}{keys}\n) {options}"), Query::CREATE_INDEX => new Statement('CREATE INDEX {index} ON {table} ({fields})'), Query::DROP_TABLE => new Statement('DROP TABLE IF EXISTS {table}'), Query::DROP_INDEX => new Statement('DROP INDEX {index} ON {table}')]);
     parent::__construct();
 }
Exemple #3
0
 /**
  * Initialize class and events.
  *
  * @param array $config
  */
 public function __construct(array $config = [])
 {
     parent::__construct($config);
     $this->on('db', $this);
     $this->addFinder('first', new FirstFinder());
     $this->addFinder('all', new AllFinder());
     $this->addFinder('list', new ListFinder());
 }
Exemple #4
0
 /**
  * Store the module key and path.
  *
  * @param string $path
  */
 public function __construct($path)
 {
     $this->_path = Path::ds($path, true);
     parent::__construct();
 }
Exemple #5
0
 /**
  * Store the alias and class name.
  *
  * @param string $alias
  * @param string $class
  * @param array $config
  */
 public function __construct($alias, $class, array $config = [])
 {
     parent::__construct($config);
     $this->setAlias($alias);
     $this->setRelatedClass($class);
     $this->_links = new ModelCollection();
     $this->_unlinks = new ModelCollection();
 }