本文整理匯總了PHP中RedBeanPHP\OODBBean::withCondition方法的典型用法代碼示例。如果您正苦於以下問題:PHP OODBBean::withCondition方法的具體用法?PHP OODBBean::withCondition怎麽用?PHP OODBBean::withCondition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類RedBeanPHP\OODBBean
的用法示例。
在下文中一共展示了OODBBean::withCondition方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: insertEvent
/** Function to insert new Event
* @param array $eventData containg to be inserted for event
* @param \RedBeanPHP\OODBBean $user user who is creating the event
* @retrun boolean
* **/
public function insertEvent(array $eventData, \RedBeanPHP\OODBBean $user)
{
try {
//check if event with same name is already associated with user
$associatedRow = $user->withCondition('event_name = ? LIMIT 1', array($eventData['event_name']))->ownEventsList;
if (!$associatedRow) {
$event = $this->_redbeans->dispense('events');
foreach ($eventData as $column => $data) {
$event->{$column} = $data;
}
$user->ownEventsList[] = $event;
return $this->_redbeans->store($user);
} else {
throw new \Exception('Cannot insert event with same name');
}
} catch (\Exception $e) {
return false;
}
return false;
}