本文整理汇总了PHP中RedBeanPHP\R::storeAll方法的典型用法代码示例。如果您正苦于以下问题:PHP R::storeAll方法的具体用法?PHP R::storeAll怎么用?PHP R::storeAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RedBeanPHP\R
的用法示例。
在下文中一共展示了R::storeAll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addTo
public function addTo(Set $set)
{
$setBean = $set->getBean();
$recordBean = $this->newBean();
foreach ($this->directives as $directive) {
$recordBean->{$directive->field->cleanName} = $directive->value;
}
$setBean->{'own' . ucfirst($this->cleanName) . 'List'}[] = $recordBean;
R::storeAll([$recordBean, $setBean]);
return $this;
}
示例2: create
public static function create($module, $component, $group)
{
if (self::isUnique($module, $component, $group->name)) {
$bean = R::dispense('perm');
$groupBean = $group->bean();
$bean->groupName = $group->name;
$bean->module = $module;
$bean->component = $component;
$groupBean->sharedPermList[] = $bean;
R::storeAll([$bean, $groupBean]);
return new Perm($module, $component, $group);
}
return null;
}
示例3: checkOut
public static function checkOut($number, Publisher $publisher)
{
if (R::count('record', ' number = :number AND isnull(`in`) ', ['number' => $number]) > 0) {
return null;
}
$territoryBean = R::findOne('territory', ' number = :number ', ['number' => $number]);
if ($territoryBean === null) {
return null;
}
$bean = R::dispense('record');
$bean->number = $number;
$bean->out = time();
$bean->in = null;
$bean->checkOutBy = App::user()->id;
$record = new Record($number, $bean);
$territoryBean->sharedRecordList[] = $bean;
$publisherBean = $publisher->bean();
$publisherBean->ownRecordList[] = $bean;
R::storeAll([$bean, $territoryBean, $publisherBean]);
$publisher->records[] = $record;
return $record;
}
示例4: __invoke
public function __invoke($school_id)
{
$school = $this->schoolService->getSchool($school_id);
try {
$equipment = $this->inventoryService->getUnitEquipment($school['registry_no']);
} catch (Exception $e) {
$this->logger->error(sprintf('Problem retrieving assets from inventory for school %s', $school_id));
$this->logger->debug('Exception', [$e->getMessage(), $e->getTraceAsString()]);
return false;
}
$labTypes = $this->getLabTypes();
$assetTypes = $this->getAssetTypes();
try {
$locations = $this->getLocations($school_id, $equipment, $labTypes, $assetTypes);
R::storeAll($locations);
$this->logger->info(sprintf('Add assets from inventory for school %s', $school_id));
return $this->labService->getLabsBySchoolId($school_id);
} catch (Exception $e) {
$this->logger->error(sprintf('Problem inserting assets for school %s in database', $school_id));
$this->logger->debug('Exception', [$e->getMessage(), $e->getTraceAsString()]);
return false;
}
}
示例5: addToSet
public function addToSet(Set $set)
{
$setBean = $set->getBean();
if (R::count('skemafield', ' name = ? and skemaset_id = ? ', [$this->name, $setBean->getID()]) > 0) {
if (Set::$strict) {
throw new \Exception('Already exists on set');
}
return $this;
}
$fieldBean = $this->newBean();
$set->fields[$this->cleanName] = $this;
$this->set = $set;
$setBean->ownSkemafieldList[] = $fieldBean;
R::storeAll([$fieldBean, $setBean]);
return $this;
}