This commit is contained in:
@@ -493,6 +493,81 @@ final class ListingCatalog
|
||||
return $stmt->fetchAll(\PDO::FETCH_ASSOC) ?: [];
|
||||
}
|
||||
|
||||
public function listEventLocationOptions(int $limit = 80): array
|
||||
{
|
||||
$this->ensureSchema();
|
||||
$stmt = $this->pdo->prepare(
|
||||
'SELECT l.id,
|
||||
l.listing_type,
|
||||
l.title,
|
||||
l.status,
|
||||
lp.street,
|
||||
lp.zip,
|
||||
lp.city,
|
||||
lp.region,
|
||||
lp.lat,
|
||||
lp.lng,
|
||||
lp.place_kind,
|
||||
lo.starts_at,
|
||||
lo.recurrence_until,
|
||||
lc.slug AS category_slug,
|
||||
lc.title AS category_title
|
||||
FROM listings l
|
||||
LEFT JOIN listing_places lp ON lp.id = l.primary_place_id
|
||||
LEFT JOIN listing_occurrences lo ON lo.listing_id = l.id
|
||||
LEFT JOIN listing_category_map lcm ON lcm.listing_id = l.id
|
||||
LEFT JOIN listing_categories lc ON lc.id = lcm.category_id
|
||||
WHERE l.listing_type IN ("place","editorial_event")
|
||||
AND l.status IN ("draft","published")
|
||||
ORDER BY
|
||||
CASE l.listing_type
|
||||
WHEN "place" THEN 1
|
||||
WHEN "editorial_event" THEN 2
|
||||
ELSE 3
|
||||
END,
|
||||
l.title ASC,
|
||||
COALESCE(lo.starts_at, l.created_at) ASC
|
||||
LIMIT :limit'
|
||||
);
|
||||
$stmt->bindValue(':limit', max(1, min(250, $limit)), \PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
return $stmt->fetchAll(\PDO::FETCH_ASSOC) ?: [];
|
||||
}
|
||||
|
||||
public function getEventLocationSource(int $listingId): ?array
|
||||
{
|
||||
$this->ensureSchema();
|
||||
$stmt = $this->pdo->prepare(
|
||||
'SELECT l.id,
|
||||
l.listing_type,
|
||||
l.title,
|
||||
l.status,
|
||||
lp.street,
|
||||
lp.zip,
|
||||
lp.city,
|
||||
lp.region,
|
||||
lp.lat,
|
||||
lp.lng,
|
||||
lp.place_kind,
|
||||
lo.starts_at,
|
||||
lo.recurrence_until,
|
||||
lc.slug AS category_slug,
|
||||
lc.title AS category_title
|
||||
FROM listings l
|
||||
LEFT JOIN listing_places lp ON lp.id = l.primary_place_id
|
||||
LEFT JOIN listing_occurrences lo ON lo.listing_id = l.id
|
||||
LEFT JOIN listing_category_map lcm ON lcm.listing_id = l.id
|
||||
LEFT JOIN listing_categories lc ON lc.id = lcm.category_id
|
||||
WHERE l.id = :id
|
||||
AND l.listing_type IN ("place","editorial_event")
|
||||
AND l.status IN ("draft","published")
|
||||
LIMIT 1'
|
||||
);
|
||||
$stmt->execute(['id' => $listingId]);
|
||||
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
return $row ?: null;
|
||||
}
|
||||
|
||||
public function listUserOpenModerationRequestMap(int $userId): array
|
||||
{
|
||||
$this->ensureSchema();
|
||||
|
||||
Reference in New Issue
Block a user