/** * @param $track_artist * @return MLArray */ public static function deleteByArtist($track_artist) { $songs = SongDao::getList([TSongs::T_ARTIST => $track_artist, TSongs::USER_ID => self::$me->getId()]); $to_remove = $songs->map(Mapper::key(TSongs::ID)); if (count($to_remove) == 0) { return array(); } return (new DeleteQuery(TSongs::_NAME))->where(TSongs::ID, $to_remove->mkArray())->returning("*")->fetchAll(); }
public function doGet(JsonResponse $response, LoggedIn $me) { $playlists = PlaylistDao::getList([TPlaylists::USER_ID => $me->getId()]); $playlist_objects = $playlists->map(Mapper::call(Playlist::class, "new")); $response->write($playlist_objects); }