reimplemeting parsing return query
This commit is contained in:
@@ -80,7 +80,11 @@ class Parser implements ParserInterface
|
|||||||
|
|
||||||
$config = $this->container->get("model.config");
|
$config = $this->container->get("model.config");
|
||||||
|
|
||||||
var_dump($config->read("tlog_niveau","tutu"));
|
$results = $config->find(1);
|
||||||
|
|
||||||
|
var_dump($results->delete());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $this->content;
|
return $this->content;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,13 +203,15 @@ abstract class Base
|
|||||||
* Find record by primary key
|
* Find record by primary key
|
||||||
*
|
*
|
||||||
* @param int $pk
|
* @param int $pk
|
||||||
* @return \NotORM_Result
|
* @return Object
|
||||||
*/
|
*/
|
||||||
public function find($pk)
|
public function find($pk)
|
||||||
{
|
{
|
||||||
$table = $this->getTable();
|
$table = $this->getTable();
|
||||||
|
|
||||||
return $this->getConnection()->$table()->where("id", $pk);
|
$result = $this->getConnection()->$table()->where("id", $pk);
|
||||||
|
|
||||||
|
return $this->parseOneQuery($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -218,7 +220,7 @@ abstract class Base
|
|||||||
*
|
*
|
||||||
* @param mixed $column column name
|
* @param mixed $column column name
|
||||||
* @param mixed $search value searching
|
* @param mixed $search value searching
|
||||||
* @return \NotORM_Result
|
* @return array
|
||||||
* @throws \InvalidArgumentException column name cannot be empty
|
* @throws \InvalidArgumentException column name cannot be empty
|
||||||
*/
|
*/
|
||||||
public function findBy($column, $search)
|
public function findBy($column, $search)
|
||||||
@@ -241,7 +243,7 @@ abstract class Base
|
|||||||
*
|
*
|
||||||
* @param mixed $column column name
|
* @param mixed $column column name
|
||||||
* @param mixed $search value searching
|
* @param mixed $search value searching
|
||||||
* @return \NotORM_Result
|
* @return Object
|
||||||
* @throws \InvalidArgumentException column name cannot be empty
|
* @throws \InvalidArgumentException column name cannot be empty
|
||||||
*/
|
*/
|
||||||
public function findOneBy($column, $search)
|
public function findOneBy($column, $search)
|
||||||
@@ -255,9 +257,7 @@ abstract class Base
|
|||||||
|
|
||||||
$result = $this->getConnection()->$table()->where($column, $search)->limit(1);
|
$result = $this->getConnection()->$table()->where($column, $search)->limit(1);
|
||||||
|
|
||||||
$return = $this->parseQuery($result);
|
return $this->parseOneQuery($result);
|
||||||
|
|
||||||
return count($return) ? $return[0] : null ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete()
|
public function delete()
|
||||||
@@ -297,6 +297,13 @@ abstract class Base
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function parseOneQuery(\NotORM_Result $results)
|
||||||
|
{
|
||||||
|
$return = $this->parseQuery($results);
|
||||||
|
|
||||||
|
return count($return) ? $return[0] : null ;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* prepare an array for persisting data
|
* prepare an array for persisting data
|
||||||
|
|||||||
@@ -23,6 +23,6 @@ class Config extends Base
|
|||||||
{
|
{
|
||||||
$result = $this->findOneBy("name",$search);
|
$result = $this->findOneBy("name",$search);
|
||||||
|
|
||||||
return $result ? $result->value : $default;
|
return $result ? $result->getValue() : $default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user