本文整理汇总了PHP中R::isoDate方法的典型用法代码示例。如果您正苦于以下问题:PHP R::isoDate方法的具体用法?PHP R::isoDate怎么用?PHP R::isoDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类R
的用法示例。
在下文中一共展示了R::isoDate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update()
{
if (empty($this->bean->number)) {
throw new Exception('Phone number required!');
}
$this->bean->last_updated = R::isoDate();
}
示例2: function
})->setName("territory_buildings_add");
// Add building to territory
// POST territories/123/buildings
$this->post('/buildings', function ($request, $response, $args) {
$formdata = $request->getParsedBody();
$territory = R::load('territory', $args['id']);
$address = $formdata['address'];
$city = $formdata['city'];
$province = $formdata['province'];
if (!empty($address)) {
$address = filter_var($address, FILTER_SANITIZE_STRING);
$building = R::dispense('building');
$building->address = $address;
$building->city = $city;
$building->province = $province;
$building->last_updated = R::isoDate();
$territory->ownBuildingList[] = $building;
$id = R::store($territory);
if ($id == 0) {
$this->flash->addMessage('fail', 'Could not write to database.');
return $response->withRedirect($request->getUri());
} else {
$this->flash->addMessage('success', 'Added building: ' . $building->address);
$newItem = $this->router->pathFor('building', ['id' => $building->id]);
return $response->withRedirect($newItem);
}
} else {
$this->flash->addMessage('fail', 'Please enter a valid address.');
return $response->withRedirect($request->getUri());
}
});
示例3: update
public function update()
{
if (!$this->bean->id) {
$this->bean->start = R::isoDate();
}
if ($this->bean->done && is_null($this->bean->end)) {
$this->bean->end = R::isoDate();
}
if ($this->bean->name == '') {
$this->bean->name = 'Unknown task';
}
$this->bean->progress = max(0, min(100, $this->bean->progress));
}
示例4: testBeautifulColumnNames
/**
* Test beautification of column names.
*
* @return void
*/
public function testBeautifulColumnNames()
{
testpack('Beautiful column names');
$town = R::dispense('town');
$town->isCapital = FALSE;
$town->hasTrainStation = TRUE;
$town->name = 'BeautyVille';
$houses = R::dispense('house', 2);
$houses[0]->isForSale = TRUE;
$town->ownHouse = $houses;
R::store($town);
$town = R::load('town', $town->id);
asrt($town->isCapital == FALSE, TRUE);
asrt($town->hasTrainStation == TRUE, TRUE);
asrt($town->name == 'BeautyVille', TRUE);
testpack('Accept datetime objects.');
$cal = R::dispense('calendar');
$cal->when = new DateTime('2000-01-01', new DateTimeZone('Pacific/Nauru'));
asrt($cal->when, '2000-01-01 00:00:00');
testpack('Affected rows test');
$currentDriver = $this->currentlyActiveDriverID;
$toolbox = R::$toolbox;
$adapter = $toolbox->getDatabaseAdapter();
$writer = $toolbox->getWriter();
$redbean = $toolbox->getRedBean();
$pdo = $adapter->getDatabase();
$bean = $redbean->dispense('bean');
$bean->prop = 3;
//make test run with strict mode as well
$redbean->store($bean);
$adapter->exec('UPDATE bean SET prop = 2');
asrt($adapter->getAffectedRows(), 1);
testpack('Testing Logger');
R::$adapter->getDatabase()->setLogger(new RedBean_Logger_Default());
asrt(R::$adapter->getDatabase()->getLogger() instanceof RedBean_Logger, TRUE);
asrt(R::$adapter->getDatabase()->getLogger() instanceof RedBean_Logger_Default, TRUE);
$bean = R::dispense('bean');
$bean->property = 1;
$bean->unsetAll(array('property'));
asrt($bean->property, NULL);
asrt($bean->setAttr('property', 2) instanceof RedBean_OODBBean, TRUE);
asrt($bean->property, 2);
asrt(preg_match('/\\d\\d\\d\\d\\-\\d\\d\\-\\d\\d/', R::isoDate()), 1);
asrt(preg_match('/\\d\\d\\d\\d\\-\\d\\d\\-\\d\\d\\s\\d\\d:\\d\\d:\\d\\d/', R::isoDateTime()), 1);
$redbean = R::getRedBean();
$adapter = R::getDatabaseAdapter();
$writer = R::getWriter();
asrt($redbean instanceof RedBean_OODB, TRUE);
asrt($adapter instanceof RedBean_Adapter, TRUE);
asrt($writer instanceof RedBean_QueryWriter, TRUE);
R::setRedBean($redbean);
pass();
//cant really test this
R::setDatabaseAdapter($adapter);
pass();
//cant really test this
R::setWriter($writer);
pass();
//cant really test this
$u1 = R::dispense('user');
$u1->name = 'Gabor';
$u1->login = 'g';
$u2 = R::dispense('user');
$u2->name = 'Eric';
$u2->login = 'e';
R::store($u1);
R::store($u2);
$list = R::getAssoc('select login,' . R::$writer->esc('name') . ' from ' . R::$writer->esc('user') . ' ');
asrt($list['e'], 'Eric');
asrt($list['g'], 'Gabor');
$painting = R::dispense('painting');
$painting->name = 'Nighthawks';
$id = R::store($painting);
testpack('Testing Plugin Cooker');
$cooker = new RedBean_Plugin_Cooker();
$cooker->setToolbox($toolbox);
try {
asrt($cooker->graph('abc'), 'abc');
fail();
} catch (RedBean_Exception_Security $e) {
pass();
}
testpack('Testing SQL Error Types');
foreach ($writer->typeno_sqltype as $code => $text) {
asrt(is_integer($code), TRUE);
asrt(is_string($text), TRUE);
}
foreach ($writer->sqltype_typeno as $text => $code) {
asrt(is_integer($code), TRUE);
asrt(is_string($text), TRUE);
}
testpack('Testing Nowhere Pt. 1 (unfrozen)');
foreach (array('exec', 'getAll', 'getCell', 'getAssoc', 'getRow', 'getCol') as $method) {
R::$method('select * from nowhere');
pass();
//.........这里部分代码省略.........