本文整理匯總了PHP中Summit::create方法的典型用法代碼示例。如果您正苦於以下問題:PHP Summit::create方法的具體用法?PHP Summit::create怎麽用?PHP Summit::create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Summit
的用法示例。
在下文中一共展示了Summit::create方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ensureLegacySummits
/**
* Guarantees that the old summits that pre-date the Summit object are represented
* @return void
*/
private function ensureLegacySummits()
{
$created = 0;
if (!Summit::get()->filterAny(['Title:PartialMatch' => 'San Diego'])->first()) {
$sanDiego = Summit::create(['Title' => 'San Diego', 'Location' => 'San Diego, CA', 'SummitBeginDate' => '2012-10-15 00:00:00', 'SummitEndDate' => '2012-10-18 00:00:00', 'SubmissionBeginDate' => '2012-08-15 00:00:00', 'SubmissionEndDate' => '2012-08-18 00:00:00', 'VotingBeginDate' => '2012-08-20 00:00:00', 'VotingEndDate' => '2012-08-25 00:00:00', 'SelectionBeginDate' => '2012-09-15 00:00:00', 'SelectionEndDate' => '2012-09-18 00:00:00', 'RegistrationBeginDate' => '2012-10-01 00:00:00', 'RegistrationEndDate' => '2012-10-10 00:00:00', 'StartShowingVenuesDate' => '2012-05-05 00:00:00', 'TimeZone' => '132']);
$sanDiego->write();
echo "Created San Diego summit!" . $this->br();
$created++;
}
if (!Summit::get()->filterAny(['Title:PartialMatch' => 'Portland'])->first()) {
$portland = Summit::create(['Title' => 'Portland', 'Location' => 'Portland, OR', 'SummitBeginDate' => '2013-04-15 00:00:00', 'SummitEndDate' => '2013-04-18 00:00:00', 'SubmissionBeginDate' => '2013-01-15 00:00:00', 'SubmissionEndDate' => '2013-01-18 00:00:00', 'VotingBeginDate' => '2013-02-20 00:00:00', 'VotingEndDate' => '2013-02-25 00:00:00', 'SelectionBeginDate' => '2013-03-15 00:00:00', 'SelectionEndDate' => '2013-03-18 00:00:00', 'RegistrationBeginDate' => '2013-04-01 00:00:00', 'RegistrationEndDate' => '2013-04-10 00:00:00', 'StartShowingVenuesDate' => '2013-01-01 00:00:00', 'TimeZone' => '132']);
$portland->write();
echo "Created Portland summit!" . $this->br();
$created++;
}
if (!Summit::get()->filter('Title:PartialMatch', 'Atlanta')->first()) {
$atlanta = Summit::create(['Title' => 'Atlanta', 'SummitBeginDate' => '2013-05-05 00:00:00', 'SummitEndDate' => '2013-05-08 00:00:00', 'SubmissionBeginDate' => '2013-01-15 00:00:00', 'SubmissionEndDate' => '2013-01-18 00:00:00', 'VotingBeginDate' => '2013-02-20 00:00:00', 'VotingEndDate' => '2013-02-25 00:00:00', 'SelectionBeginDate' => '2013-03-15 00:00:00', 'SelectionEndDate' => '2013-03-18 00:00:00', 'RegistrationBeginDate' => '2013-04-01 00:00:00', 'RegistrationEndDate' => '2013-04-10 00:00:00', 'StartShowingVenuesDate' => '2013-01-01 00:00:00', 'TimeZone' => '151']);
$atlanta->write();
echo "Created Atlanta summit!" . $this->br();
$created++;
}
// Hong Kong has no date
if ($hongKong = Summit::get()->filter('Title:PartialMatch', 'Hong Kong')->first()) {
if (!$hongKong->SummitBeginDate) {
$hongKong->SummitBeginDate = '2013-11-05 00:00:00';
$hongKong->SummitEndDate = '2013-11-08 00:00:00';
$hongKong->write();
echo "Fixed HongKong date!" . $this->br();
}
}
$this->stats['Summits created'] += $created;
// Clean up junk data from old summits
DB::query("UPDATE Summit SET SummitBeginDate = StartDate WHERE SummitBeginDate IS NULL");
DB::query("UPDATE Summit SET SummitEndDate = EndDate WHERE SummitEndDate IS NULL");
}
示例2: get_active
public static function get_active()
{
$summit = Summit::get()->filter(array('Active' => true))->first();
return $summit ?: Summit::create();
}