Skip to content

Commit

Permalink
Merge pull request #4 from davidvandemaele/master
Browse files Browse the repository at this point in the history
Filter get_all when in child context
  • Loading branch information
christopheg authored Jul 1, 2024
2 parents b4ceaab + da9421a commit ad96201
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Skeleton/Object/Get.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ public static function get_all($sort = null, $direction = null) {
$where = ' AND ' . $field_archived . ' IS NULL';
}

$reflection = new \ReflectionClass(get_called_class());
$traits = $reflection->getTraits();
if (isset($traits['Skeleton\Object\Child']) === true) {
$where .= ' AND classname = ' . $db->quote(get_called_class());
}

$query = 'SELECT ' . self::trait_get_table_field_id() . ' FROM ' . $db->quote_identifier($table) . ' WHERE 1=1' . $where;
if ($sort !== null) {
if ($direction === null) {
Expand Down

0 comments on commit ad96201

Please sign in to comment.