本文整理汇总了PHP中Bar::NewArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Bar::NewArray方法的具体用法?PHP Bar::NewArray怎么用?PHP Bar::NewArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bar
的用法示例。
在下文中一共展示了Bar::NewArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Bar constructor.
* @param Session $session
* @param string[] $barData
*/
public function __construct($session, $barData)
{
$this->Session = $session;
$this->DB = $session->DB;
if (empty(array_diff_key(Bar::ValidArray(), $barData))) {
//Loading an existing bar
$this->Refresh($barData);
$this->Valid = true;
} else {
if (empty(array_diff_key(Bar::NewArray(), $barData))) {
//Creating a new bar
$this->Type = $barData['type'];
$this->Title = $barData['title'];
$this->Description = $barData['description'];
$this->CreateStamp = $this->ModifyStamp = (double) microtime(true);
$id = (int) $this->DB->Query("\n INSERT INTO tblBars\n (userID, type, title, description, createStamp, modifyStamp)\n VALUES(\n " . (int) $this->Session->ID . "\n , " . $this->DB->Quote($this->Type) . "\n , " . $this->DB->Quote($this->Title) . "\n , " . $this->DB->Quote($this->Description) . "\n , {$this->CreateStamp}\n , {$this->ModifyStamp}\n )\n ", true);
if ($id) {
$this->ID = $id;
$this->Valid = true;
}
}
}
}