本文整理汇总了PHP中Store::storedTransaction方法的典型用法代码示例。如果您正苦于以下问题:PHP Store::storedTransaction方法的具体用法?PHP Store::storedTransaction怎么用?PHP Store::storedTransaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Store
的用法示例。
在下文中一共展示了Store::storedTransaction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: storedTransaction
public function storedTransaction($db, $args)
{
$uuid = $args['uuid'];
$json = $args['json'];
$lazy = $args['lazy'];
$data = $args['data'];
$this->db->exec('DELETE FROM {weaver_core} WHERE "uuid" = ?', $uuid);
$this->db->exec('DELETE FROM {weaver_storyref} WHERE "story" = ?', $uuid);
if (isset($data['slug'])) {
$data['tag'] = $data['slug'];
}
if (!isset($data['tags'])) {
$data['tags'] = array();
}
$coreinfo = array('parent' => null);
$storyrefs = array();
if (isset($data['title'])) {
$title = preg_replace('![^a-z0-9]!i', '-', strtolower(trim($data['title'])));
while (substr($title, 0, 1) == '-') {
$title = substr($title, 1);
}
while (substr($title, -1) == '-') {
$title = substr($title, 0, -1);
}
while (strstr($title, '--') !== false) {
$title = str_replace('--', '-', $title);
}
if (strlen($title)) {
$coreinfo['title'] = $title;
if (ctype_alpha($title[0])) {
$coreinfo['title_firstchar'] = $title[0];
} else {
$coreinfo['title_firstchar'] = '*';
}
}
}
if (isset($data['universe'])) {
$coreinfo['universe'] = $data['universe'];
}
if ($data['kind'] == 'story' && isset($data['events'])) {
foreach ($data['events'] as $ev) {
if (null !== ($edata = $this->dataForUUID($ev))) {
if (isset($edata['places'])) {
foreach ($edata['places'] as $thing) {
$storyrefs[] = array('uuid' => $ev, 'thing' => $thing, 'story' => $uuid);
}
}
if (isset($edata['agents'])) {
foreach ($edata['agents'] as $thing) {
$storyrefs[] = array('uuid' => $ev, 'thing' => $thing, 'story' => $uuid);
}
}
if (isset($edata['factors'])) {
foreach ($edata['factors'] as $thing) {
$storyrefs[] = array('uuid' => $ev, 'thing' => $thing, 'story' => $uuid);
}
}
$data['tags'][] = $ev;
}
}
}
if (isset($data['factors'])) {
foreach ($data['factors'] as $factor) {
$data['tags'][] = $factor;
}
}
if (isset($data['agents'])) {
foreach ($data['agents'] as $agent) {
$data['tags'][] = $agent;
}
}
if (isset($data['places'])) {
foreach ($data['places'] as $place) {
$data['tags'][] = $place;
}
}
if (isset($data['notionalDate'])) {
$coreinfo['notional_date'] = $data['notionalDate'];
}
if (count($coreinfo)) {
$coreinfo['uuid'] = $uuid;
$this->db->insert('weaver_core', $coreinfo);
}
if (count($storyrefs)) {
foreach ($storyrefs as $ref) {
$this->db->insert('weaver_storyref', $ref);
}
}
$args['data'] = $data;
return parent::storedTransaction($db, $args);
}
示例2: storedTransaction
public function storedTransaction($db, $args)
{
$uuid = $args['uuid'];
$json = $args['json'];
$lazy = $args['lazy'];
$data = $args['data'];
$this->db->exec('DELETE FROM {media_core} WHERE "uuid" = ?', $uuid);
if (!isset($data['iri'])) {
$data['iri'] = array();
}
if (!isset($data['tags'])) {
$data['tags'] = array();
}
if (isset($data['formats'])) {
$this->addClassificationsTagList($data['tags'], $data['formats']);
}
if (isset($data['genres'])) {
$this->addClassificationsTagList($data['tags'], $data['genres']);
}
if (isset($data['people'])) {
$this->addClassificationsTagList($data['tags'], $data['people']);
}
if (isset($data['topics'])) {
$this->addClassificationsTagList($data['tags'], $data['topics']);
}
if (isset($data['places'])) {
$this->addClassificationsTagList($data['tags'], $data['places']);
}
if (isset($data['licenses'])) {
$this->addClassificationsTagList($data['tags'], $data['licenses']);
}
if (isset($data['collections'])) {
$this->addClassificationsTagList($data['tags'], $data['collections']);
}
if (isset($data['slug'])) {
$data['tag'] = $data['slug'];
}
if (isset($data['curie'])) {
if (is_array($data['curie'])) {
foreach ($data['curie'] as $curie) {
$data['iri'][] = '[' . $curie . ']';
}
} else {
$data['iri'][] = '[' . $data['curie'] . ']';
}
}
if (isset($data['sameAs'])) {
if (is_array($data['sameAs'])) {
foreach ($data['sameAs'] as $iri) {
$data['iri'][] = $iri;
}
} else {
$data['iri'][] = $iri;
}
}
$coreinfo = array();
if (isset($data['title'])) {
$title = preg_replace('![^a-z0-9]!i', '-', strtolower(trim($data['title'])));
while (substr($title, 0, 1) == '-') {
$title = substr($title, 1);
}
while (substr($title, -1) == '-') {
$title = substr($title, 0, -1);
}
while (strstr($title, '--') !== false) {
$title = str_replace('--', '-', $title);
}
if (strlen($title)) {
$coreinfo['title'] = $title;
if (ctype_alpha($title[0])) {
$coreinfo['title_firstchar'] = $title[0];
} else {
$coreinfo['title_firstchar'] = '*';
}
}
}
switch ($data['kind']) {
case 'scheme':
$data['iri'][] = '[scheme:' . $data['singular'] . ']';
$data['iri'][] = '[scheme:' . $data['plural'] . ']';
break;
case 'resource':
if (isset($data['version'])) {
$coreinfo['parent'] = $data['version'];
}
break;
case 'version':
if (isset($data['episode'])) {
$coreinfo['parent'] = $data['episode'];
}
break;
case 'episode':
if (isset($data['series'])) {
$coreinfo['parent'] = $data['series'];
} else {
if (isset($data['show'])) {
$coreinfo['parent'] = $data['show'];
}
}
break;
//.........这里部分代码省略.........