The "[attach]" field is replaced by the "post-media" table

This commit is contained in:
Michael 2020-11-06 04:14:29 +00:00
parent 6d9e170502
commit d383f49f1e
7 changed files with 58 additions and 104 deletions

View file

@ -263,11 +263,18 @@ class Media
* Retrieves the media attachments associated with the provided item ID.
*
* @param int $uri_id
* @param array $types
* @return array
* @throws \Exception
*/
public static function getByURIId(int $uri_id)
public static function getByURIId(int $uri_id, array $types = [])
{
return DBA::selectToArray('post-media', [], ['uri-id' => $uri_id]);
$condition = ['uri-id' => $uri_id];
if (!empty($types)) {
$condition = DBA::mergeConditions($condition, ['type' => $types]);
}
return DBA::selectToArray('post-media', [], $condition);
}
}