public function init(NamedArguments $arguments) { $arguments->setDefaultValueForArgumentName('filename', BASE_DIR . '/admin/configuration.ini'); $config = parse_ini_file($arguments->filename, true); foreach ($config as $section => $entries) { $this->{$section} = Utility::objectFromArray($entries); } }
public function init(NamedArguments $arguments) { $arguments->setDefaultValueForArgumentName('filename', BASE_DIR . 'admin/configuration.ini'); if (file_exists($arguments->filename) and is_readable($arguments->filename)) { $config = parse_ini_file($arguments->filename, true); } else { die(BASE_DIR . 'admin/configuration.ini is missing or unreadable.'); } foreach ($config as $section => $entries) { $this->{$section} = Utility::objectFromArray($entries); } }
protected function init(NamedArguments $arguments) { $arguments->setDefaultValueForArgumentName('tableName', get_class($this)); $this->tableName = $arguments->tableName; $defaultCollectiveName = lcfirst($arguments->tableName) . 's'; $arguments->setDefaultValueForArgumentName('collectiveName', $defaultCollectiveName); $this->collectiveName = $arguments->collectiveName; $defaultPrimaryKeyName = lcfirst($arguments->tableName) . 'Id'; $arguments->setDefaultValueForArgumentName('primaryKeyName', $defaultPrimaryKeyName); $this->primaryKeyName = $arguments->primaryKeyName; $this->primaryKey = $arguments->primaryKey; $this->db = new DBService(); $this->defineAttributes(); $this->overridePrimaryKeyName(); $this->load(); }
protected function init(NamedArguments $arguments) { $arguments->setDefaultValueForArgumentName('tableName', get_class($this)); $this->tableName = $arguments->tableName; $defaultCollectiveName = lcfirst($arguments->tableName) . 's'; $arguments->setDefaultValueForArgumentName('collectiveName', $defaultCollectiveName); $this->collectiveName = $arguments->collectiveName; $defaultPrimaryKeyName = lcfirst($arguments->tableName) . 'ID'; $arguments->setDefaultValueForArgumentName('primaryKeyName', $defaultPrimaryKeyName); $this->primaryKeyName = $arguments->primaryKeyName; $this->primaryKey = $arguments->primaryKey; $this->db = new DBService(); $arguments->setDefaultValueForArgumentName('db', false); $this->db = $arguments->db ? $arguments->db : new DBService(); $this->defineRelationships(); //$this->defineAttributes(); //now performed in load $this->overridePrimaryKeyName(); $this->load(); }