fix some CS
This commit is contained in:
@@ -25,50 +25,50 @@ namespace Thelia\Database;
|
||||
use Thelia\Log\TlogInterface;
|
||||
use Thelia\Database\NotORM\Result;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Class Thelia\Database\NotORM extending \NotORM library http://www.notorm.com/
|
||||
*
|
||||
* This class create or redifine some setters
|
||||
*
|
||||
*
|
||||
* This class create or redifine some setters
|
||||
*
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class NotORM extends \NotORM
|
||||
{
|
||||
|
||||
|
||||
public $logger = false;
|
||||
|
||||
|
||||
public function setCache(\NotORM_Cache $cache)
|
||||
{
|
||||
$this->cache = $cache;
|
||||
}
|
||||
|
||||
|
||||
public function setLogger(TlogInterface $logger)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
|
||||
public function setDebug($debug)
|
||||
{
|
||||
if(is_callable($debug))
|
||||
{
|
||||
if (is_callable($debug)) {
|
||||
$this->debug = $debug;
|
||||
} else {
|
||||
$this->debug = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Get table data
|
||||
* @param string
|
||||
* @param array (["condition"[, array("value")]]) passed to NotORM_Result::where()
|
||||
* @return NotORM_Result
|
||||
*/
|
||||
function __call($table, array $where) {
|
||||
public function __call($table, array $where)
|
||||
{
|
||||
$return = new Result($this->structure->getReferencingTable($table, ''), $this);
|
||||
if ($where) {
|
||||
call_user_func_array(array($return, 'where'), $where);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@ namespace Thelia\Database\NotORM;
|
||||
|
||||
class Result extends \NotORM_Result
|
||||
{
|
||||
protected function query($query, $parameters) {
|
||||
protected function query($query, $parameters)
|
||||
{
|
||||
if ($this->notORM->debug) {
|
||||
if (!is_callable($this->notORM->debug)) {
|
||||
$debug = "$query;";
|
||||
@@ -22,9 +23,8 @@ class Result extends \NotORM_Result
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if($this->notORM->logger !== false)
|
||||
{
|
||||
|
||||
if ($this->notORM->logger !== false) {
|
||||
$this->notORM->logger->debug($query);
|
||||
$this->notORM->logger->debug($parameters);
|
||||
}
|
||||
@@ -34,8 +34,10 @@ class Result extends \NotORM_Result
|
||||
$this->notORM->logger->fatal($this->notORM->errorCode());
|
||||
$this->notORM->logger->fatal(print_r($this->notORM->errorInfo(), true));
|
||||
$this->notORM->logger->fatal(print_r($return->errorInfo(), true));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user