/** * Returns an array of playlist objects that this file is a part of. * @return array */ public function getPlaylists() { $con = Propel::getConnection(); $sql = <<<SQL SELECT playlist_id FROM cc_playlist WHERE file_id = :file_id SQL; $stmt = $con->prepare($sql); $stmt->bindParam(':file_id', $this->id, PDO::PARAM_INT); if ($stmt->execute()) { $ids = $stmt->fetchAll(); } else { $msg = implode(',', $stmt->errorInfo()); throw new Exception("Error: {$msg}"); } if (is_array($ids) && count($ids) > 0) { return array_map(function ($id) { return Application_Model_Playlist::Recall($id); }, $ids); } else { return array(); } }