Fix doc update-by-ID problem

- Rework imports for pages
- Ready for final end-to-end test before merge
This commit is contained in:
2024-06-08 13:34:14 -04:00
parent efa69f2c1c
commit edc9a218b7
12 changed files with 67 additions and 104 deletions

View File

@@ -269,9 +269,7 @@ class Feed
*/
public static function retrieveById(int $feedId): static|false
{
define('PDO_DOC_DEBUG_SQL', true);
$doc = Find::byId(Table::FEED, $feedId, static::class);
echo "Feed $feedId: " . ($doc ? 'found it' : 'not found');
return $doc && $doc->user_id == $_SESSION[Key::USER_ID] ? $doc : false;
}
}

View File

@@ -53,7 +53,7 @@ class ItemList
$this->dbList = Custom::list(
ItemWithFeed::SELECT_WITH_FEED . ' WHERE '
. Query::whereByFields(array_filter($allFields, fn($it) => $it->paramName <> ':search'))
. $searchWhere,
. "$searchWhere ORDER BY coalesce(item.data->>'updated_on', item.data->>'published_on') DESC",
Parameters::addFields($allFields, []), new DocumentMapper(ItemWithFeed::class));
} catch (DocumentException $ex) {
$this->error = "$ex";