3 Commits

3 changed files with 20 additions and 6 deletions

20
Config.php Normal file → Executable file
View File

@ -13,13 +13,27 @@ class Config extends Registry
{ {
private static $_class_name = 'Config'; private static $_class_name = 'Config';
static public function set($name, $value) /**
* Метод устанавливает параметры конфигурации
* @param mixed $param
* Имя параметра или параметры в массиве
* @param mixed $value
* Значение параметра. Не требуется, если передаются параметры в массиве
*/
static public function set($param, $value = null)
{ {
// Разбираю массив, если параметры переданы в массиве
if (is_array($param)) {
foreach ($param as $paramItem => $value) {
self::set($paramItem, $value);
}
return;
}
if (is_array($value)) { if (is_array($value)) {
$value = new ConfigArray($value); $value = new ConfigArray($value);
} }
self::getInstance()->offsetSet($name, $value); self::getInstance()->offsetSet($param, $value);
} }
} }

View File

@ -21,7 +21,7 @@ class MySQLiStatement extends DbStatement
if ($this->map === null) { if ($this->map === null) {
$this->mapPlaceholders(); $this->mapPlaceholders();
} }
if (count($this->map) > 0) { if (is_array($this->map) && count($this->map) > 0) {
if (!is_string($param) && !is_int($param)) { if (!is_string($param) && !is_int($param)) {
throw new \Majestic\Exception\GeneralException('Placeholder must be an integer or string'); throw new \Majestic\Exception\GeneralException('Placeholder must be an integer or string');
} }

View File

@ -1,8 +1,8 @@
<?php namespace Majestic\Model; <?php namespace Majestic\Model;
use Illuminate\Support\Contracts\ArrayableInterface; use Illuminate\Contracts\Support\Arrayable;
class SqlResultCollection extends \ArrayIterator implements iSqlResultItems, ArrayableInterface class SqlResultCollection extends \ArrayIterator implements iSqlResultItems, Arrayable
{ {
private $items; private $items;