cc-4347: PDO. getAllFutureInstanceIds()
This commit is contained in:
parent
82f267310e
commit
5ee24ceb23
|
@ -663,8 +663,6 @@ SQL;
|
||||||
$stmt->bindParam(':showId', $showId);
|
$stmt->bindParam(':showId', $showId);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
//$query = $con->query($sql);
|
|
||||||
|
|
||||||
if (!$stmt) {
|
if (!$stmt) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -770,25 +768,20 @@ SQL;
|
||||||
*/
|
*/
|
||||||
public function getAllFutureInstanceIds()
|
public function getAllFutureInstanceIds()
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
$sql = <<<SQL
|
||||||
|
SELECT id
|
||||||
|
FROM cc_show_instances
|
||||||
|
WHERE show_id :showId
|
||||||
|
AND starts > :timestamp::TIMESTAMP
|
||||||
|
AND modified_instance != TRUE
|
||||||
|
SQL;
|
||||||
|
$rows = Application_Common_Database::prepareAndExecute($sql,
|
||||||
|
array( ':showId' => $this->getId(),
|
||||||
|
':timestamp' => gmdate("Y-m-d H:i:s")), "all");
|
||||||
|
|
||||||
$date = new Application_Common_DateHelper;
|
return array_map( function($i) {
|
||||||
$timestamp = $date->getTimestamp();
|
return $i['id'];
|
||||||
|
}, $rows);
|
||||||
$showId = $this->getId();
|
|
||||||
$sql = "SELECT id from cc_show_instances"
|
|
||||||
." WHERE show_id = $showId"
|
|
||||||
." AND starts > TIMESTAMP '$timestamp'"
|
|
||||||
." AND modified_instance != TRUE";
|
|
||||||
|
|
||||||
$rows = $con->query($sql)->fetchAll();
|
|
||||||
|
|
||||||
$instance_ids = array();
|
|
||||||
foreach ($rows as $row) {
|
|
||||||
$instance_ids[] = $row["id"];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $instance_ids;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called when a show's duration is changed (edited).
|
/* Called when a show's duration is changed (edited).
|
||||||
|
@ -2086,7 +2079,6 @@ SQL;
|
||||||
throw new Exception("Error: $msg");
|
throw new Exception("Error: $msg");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $rows;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue