- Added some new method to EntityCollection (replaceWith, mergeWith, randomize, sort)
- WIP on virtual fields - Some minor bugfixes
This commit is contained in:
1 parent
c8397484e6
commit
30a0a80cbe
9 files changed
+213
-47
No files matched your search
@@ -5,6 +5,7 @@ namespace Ulmus\Common;
|
||||
use Ulmus\Annotation\Annotation,
|
||||
Ulmus\Annotation\Classes\Table,
|
||||
Ulmus\Annotation\Property\Field,
|
||||
Ulmus\Annotation\Property\Virtual,
|
||||
Ulmus\Annotation\Property\Relation;
|
||||
|
||||
class EntityResolver {
|
||||
@@ -50,13 +51,17 @@ class EntityResolver {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function fieldList($fieldKey = self::KEY_ENTITY_NAME) : array
|
||||
public function fieldList($fieldKey = self::KEY_ENTITY_NAME, bool $skipVirtual = false) : array
|
||||
{
|
||||
$fieldList = [];
|
||||
|
||||
foreach($this->properties as $item) {
|
||||
foreach($item['tags'] ?? [] as $tag) {
|
||||
if ( $tag['object'] instanceof Field ) {
|
||||
if ( $skipVirtual && ($tag['object'] instanceof Virtual )) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch($fieldKey) {
|
||||
case static::KEY_ENTITY_NAME:
|
||||
$key = $item['name'];
|
||||
|
||||
@@ -6,9 +6,13 @@ use PDO,
|
||||
PDOStatement;
|
||||
|
||||
class PdoObject extends PDO {
|
||||
|
||||
public static ? string $dump = null;
|
||||
|
||||
public function select(string $sql, array $parameters = []): PDOStatement
|
||||
{
|
||||
static::$dump && call_user_func_array(static::$dump, [ $sql, $parameters ]);
|
||||
|
||||
try {
|
||||
if (false !== ( $statement = $this->prepare($sql) )) {
|
||||
$statement = $this->execute($statement, $parameters, false);
|
||||
@@ -24,6 +28,8 @@ class PdoObject extends PDO {
|
||||
|
||||
public function runQuery(string $sql, array $parameters = []): ? PDOStatement
|
||||
{
|
||||
static::$dump && call_user_func_array(static::$dump, [ $sql, $parameters ]);
|
||||
|
||||
try {
|
||||
if (false !== ( $statement = $this->prepare($sql) )) {
|
||||
return $this->execute($statement, $parameters, true);
|
||||
@@ -62,7 +68,9 @@ class PdoObject extends PDO {
|
||||
throw $e;
|
||||
}
|
||||
catch (\Throwable $e) {
|
||||
debogueur($statement, $parameters, $commit);
|
||||
if ( function_exists("debogueur") ) {
|
||||
debogueur($statement, $parameters, $commit);
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user