/** * Deletes all show instances of current show after a * certain date. Note that although not enforced, $p_date * should never be in the past, as we never want to allow * deletion of shows that have already occured. * * @param string $p_date * The date which to delete after, if null deletes from the current timestamp. */ public function removeAllInstancesFromDate($p_date = null) { $con = Propel::getConnection(); $timestamp = gmdate("Y-m-d H:i:s"); if (is_null($p_date)) { $date = new Application_Common_DateHelper(); $p_date = $date->getDate(); } $showId = $this->getId(); $sql = "DELETE FROM cc_show_instances " . " WHERE date(starts) >= DATE '{$p_date}'" . " AND starts > TIMESTAMP '{$timestamp}'" . " AND show_id = {$showId}"; $con->exec($sql); }