fix formatting/debugging

This commit is contained in:
Dennis Eichhorn 2021-02-20 21:18:12 +01:00
parent 333741d1ef
commit 9272af316b
2 changed files with 16 additions and 5 deletions

View File

@ -2563,6 +2563,7 @@ class DataMapperAbstract implements DataMapperInterface
* @param string $order Order of the elements * @param string $order Order of the elements
* @param int $relations Load relations * @param int $relations Load relations
* @param int $depth Relation depth * @param int $depth Relation depth
* @param Builder $query Query
* *
* @return array * @return array
* *
@ -2574,10 +2575,11 @@ class DataMapperAbstract implements DataMapperInterface
int $limit = 50, int $limit = 50,
string $order = 'ASC', string $order = 'ASC',
int $relations = RelationType::ALL, int $relations = RelationType::ALL,
int $depth = 3 int $depth = 3,
Builder $query = null
) : array ) : array
{ {
$query = self::getQuery(depth: $depth); $query ??= self::getQuery(depth: $depth);
$query->where(static::$table . '_' . $depth . '.' . ($column !== null ? self::getColumnByMember($column) : static::$primaryField), '>', $pivot) $query->where(static::$table . '_' . $depth . '.' . ($column !== null ? self::getColumnByMember($column) : static::$primaryField), '>', $pivot)
->orderBy(static::$table . '_' . $depth . '.' . ($column !== null ? self::getColumnByMember($column) : static::$primaryField), $order) ->orderBy(static::$table . '_' . $depth . '.' . ($column !== null ? self::getColumnByMember($column) : static::$primaryField), $order)
->limit($limit); ->limit($limit);
@ -2594,6 +2596,7 @@ class DataMapperAbstract implements DataMapperInterface
* @param string $order Order of the elements * @param string $order Order of the elements
* @param int $relations Load relations * @param int $relations Load relations
* @param int $depth Relation depth * @param int $depth Relation depth
* @param Builder $query Query
* *
* @return array * @return array
* *
@ -2609,10 +2612,11 @@ class DataMapperAbstract implements DataMapperInterface
int $limit = 50, int $limit = 50,
string $order = 'ASC', string $order = 'ASC',
int $relations = RelationType::ALL, int $relations = RelationType::ALL,
int $depth = 3 int $depth = 3,
Builder $query = null
) : array ) : array
{ {
$query = self::getQuery(); $query ??= self::getQuery(depth: $depth);
$query->where(static::$table . '_' . $depth . '.' . ($column !== null ? self::getColumnByMember($column) : static::$primaryField), '<', $pivot) $query->where(static::$table . '_' . $depth . '.' . ($column !== null ? self::getColumnByMember($column) : static::$primaryField), '<', $pivot)
->orderBy(static::$table . '_' . $depth . '.' . ($column !== null ? self::getColumnByMember($column) : static::$primaryField), $order) ->orderBy(static::$table . '_' . $depth . '.' . ($column !== null ? self::getColumnByMember($column) : static::$primaryField), $order)
->limit($limit); ->limit($limit);
@ -2633,7 +2637,13 @@ class DataMapperAbstract implements DataMapperInterface
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public static function get(mixed $primaryKey, int $relations = RelationType::ALL, int $depth = 3, string $ref = null, Builder $query = null) : mixed public static function get(
mixed $primaryKey,
int $relations = RelationType::ALL,
int $depth = 3,
string $ref = null,
Builder $query = null
) : mixed
{ {
if ($depth < 1) { if ($depth < 1) {
return self::createNullModel($primaryKey); return self::createNullModel($primaryKey);

View File

@ -1413,6 +1413,7 @@ class Builder extends BuilderAbstract
$sth->execute(); $sth->execute();
} catch (\Throwable $t) { } catch (\Throwable $t) {
\var_dump($t->getMessage());
\var_dump($this->toSql()); \var_dump($this->toSql());
} }