- Some bugfixes were made, added a new diff before saving results. Also, a new method was added for insert, update and delete respectively for other drivers to override as needed

This commit is contained in:
Dave Mc Nicoll committed 2021-10-19 12:41:04 +00:00
1 parent 58afe841e7
commit dc5e088551
7 files changed
+111 -29

No files matched your search

+8 -6
View File
@@ -125,18 +125,20 @@ class EntityResolver {
return null;
}
public function searchFieldAnnotation(string $field, Annotation $annotationType) : ? Annotation
public function searchFieldAnnotation(string $field, Annotation $annotationType, bool $caseSensitive = true) : ? Annotation
{
$found = $this->searchFieldAnnotationList($field, $annotationType);
$found = $this->searchFieldAnnotationList($field, $annotationType, $caseSensitive);
return $found ? $found[0] : null;
}
public function searchFieldAnnotationList(string $field, Annotation $annotationType) : array
public function searchFieldAnnotationList(string $field, Annotation $annotationType, bool $caseSensitive = true) : array
{
$list = [];
if ( null !== ( $this->properties[$field] ?? null ) ) {
foreach($this->properties[$field]['tags'] ?? [] as $tag) {
$search = $caseSensitive ? $this->properties : array_change_key_case($this->properties, \CASE_LOWER);
if ( null !== ( $search[$field] ?? null ) ) {
foreach($search[$field]['tags'] ?? [] as $tag) {
if ( $tag['object'] instanceof $annotationType ) {
$list[] = $tag['object'];
}
+16 -1
View File
@@ -29,7 +29,7 @@ class PdoObject extends PDO {
public function runQuery(string $sql, array $parameters = []): ? PDOStatement
{
static::$dump && call_user_func_array(static::$dump, [ $sql, $parameters ]);
# \debogueur([ $sql, $parameters ]);
try {
if (false !== ( $statement = $this->prepare($sql) )) {
return $this->execute($statement, $parameters, true);
@@ -42,6 +42,21 @@ class PdoObject extends PDO {
return null;
}
public function runInsertQuery(array $filter, array $dataset)
{
return $this->runQuery($filter, $dataset);
}
public function runUpdateQuery(array $filter, array $dataset)
{
return $this->runQuery($filter, $dataset);
}
public function runDeleteQuery(string $sql, array $parameters = []): ? PDOStatement
{
return $this->runQuery($sql, $parameters);
}
public function execute(PDOStatement $statement, array $parameters = [], bool $commit = true): ? PDOStatement
{
try {