本文整理汇总了PHP中eZPersistentObject::storeObject方法的典型用法代码示例。如果您正苦于以下问题:PHP eZPersistentObject::storeObject方法的具体用法?PHP eZPersistentObject::storeObject怎么用?PHP eZPersistentObject::storeObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZPersistentObject
的用法示例。
在下文中一共展示了eZPersistentObject::storeObject方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Stores the content object state and its translations.
*
* Before storing a content object state, you should use
* {@link eZContentObjectState::isValid()} to check its validness.
*
* @param array $fieldFilters
*/
public function store($fieldFilters = null)
{
if ($fieldFilters === null) {
$db = eZDB::instance();
$db->begin();
$languageMask = 1;
// set language mask and always available bits
foreach ($this->AllTranslations() as $translation) {
if ($translation->hasData()) {
$languageID = $translation->attribute('language_id');
if (empty($this->DefaultLanguageID)) {
$this->DefaultLanguageID = $languageID & ~1;
}
// if default language, set always available flag
if ($languageID & $this->DefaultLanguageID) {
$translation->setAttribute('language_id', $languageID | 1);
} else {
if ($languageID & 1) {
$translation->setAttribute('language_id', $languageID & ~1);
}
}
$languageMask = $languageMask | $languageID;
}
}
$assignToObjects = false;
if (!isset($this->ID)) {
$rows = $db->arrayQuery("SELECT MAX(priority) AS max_priority FROM ezcobj_state WHERE group_id=" . $this->GroupID);
if (count($rows) > 0 && $rows[0]['max_priority'] !== null) {
$this->setAttribute('priority', $rows[0]['max_priority'] + 1);
} else {
// this is the first state created in the state group
// make all content objects use this state
$assignToObjects = true;
}
}
$this->setAttribute('language_mask', $languageMask);
// store state
eZPersistentObject::storeObject($this, $fieldFilters);
// store or remove translations
foreach ($this->AllTranslations as $translation) {
if (!$translation->hasData()) {
// the name and description are empty
// so the translation needs to be removed if it was stored before
if ($translation->attribute('contentobject_state_id') !== null) {
$translation->remove();
}
} else {
if ($translation->attribute('contentobject_state_id') != $this->ID) {
$translation->setAttribute('contentobject_state_id', $this->ID);
}
$translation->store();
}
}
if ($assignToObjects) {
$stateID = $this->ID;
$db->query("INSERT INTO ezcobj_state_link (contentobject_id, contentobject_state_id) SELECT id, {$stateID} FROM ezcontentobject");
}
$db->commit();
} else {
parent::store($fieldFilters);
}
}
示例2: store
/**
* Stores the content object state group and its translations.
*
* Before storing a content object state group, you should use
* {@link eZContentObjectStateGroup::isValid()} to check its validness.
*
* @param array $fieldFilters
*/
public function store($fieldFilters = null)
{
$db = eZDB::instance();
$db->begin();
$languageMask = 1;
// set language mask and always available bits
foreach ($this->AllTranslations as $translation) {
if ($translation->hasData()) {
$languageID = $translation->attribute('real_language_id');
if (empty($this->DefaultLanguageID)) {
$this->DefaultLanguageID = $languageID & ~1;
}
// if default language, set always available flag
if ($languageID & $this->DefaultLanguageID) {
$translation->setAttribute('language_id', $languageID | 1);
} else {
$translation->setAttribute('language_id', $languageID & ~1);
}
$languageMask = $languageMask | $languageID;
}
}
$this->setAttribute('language_mask', $languageMask);
// store state group
eZPersistentObject::storeObject($this, $fieldFilters);
// store or remove translations
foreach ($this->AllTranslations as $translation) {
if (!$translation->hasData()) {
// the name and description are empty
// so the translation needs to be removed if it was stored before
if ($translation->attribute('contentobject_state_group_id') !== null) {
$translation->remove();
}
} else {
if ($translation->attribute('contentobject_state_group_id') != $this->ID) {
$translation->setAttribute('contentobject_state_group_id', $this->ID);
}
$translation->store();
}
}
$handler = eZExpiryHandler::instance();
$handler->setTimestamp('state-limitations', time());
$db->commit();
}
示例3: store
/**
* reimplementation
* update edtionObject modified date, so you can sort_by in admin interface
*
* @param unknown_type $fieldFilters
* @return void
*/
function store($fieldFilters = null)
{
$this->setEditionObjectModified();
parent::storeObject($this, $fieldFilters);
}
示例4: storeObjectAttribute
function storeObjectAttribute($attribute)
{
if ($attribute->ID === null) {
eZPersistentObject::storeObject($attribute);
}
$meta = $attribute->content();
$xmlString = self::saveXML($meta);
$attribute->setAttribute('data_text', $xmlString);
// save keywords
$keyword = new eZKeyword();
$keyword->setKeywordArray($meta->keywords);
$keyword->store($attribute);
}
示例5: store
/**
* Stores the object in the database, uses storeObject() to do the actual
* job and passes $fieldFilters to it.
*
* Note: Transaction unsafe. If you call several transaction unsafe methods
* you must enclose the calls within a db transaction; thus within db->begin
* and db->commit.
*
* @param array|null $fieldFilters
* @return void
*/
public function store($fieldFilters = null)
{
eZPersistentObject::storeObject($this, $fieldFilters);
}
示例6: store
public function store($fieldFilters = null)
{
$this->setAttribute('backtrace', serialize($this->attribute('backtrace')));
eZPersistentObject::storeObject($this, $fieldFilters);
$this->setAttribute('backtrace', unserialize($this->attribute('backtrace')));
}
示例7: store
function store($fieldFilters = null)
{
/* New object ? */
if (!isset($this->UUID)) {
$this->UUID = self::UUID();
}
eZPersistentObject::storeObject($this, $fieldFilters);
}
示例8: storeObjectAttribute
function storeObjectAttribute($attribute)
{
if ($attribute->ID === null) {
eZPersistentObject::storeObject($attribute);
}
$meta = $attribute->content();
$xml = new DOMDocument("1.0", "UTF-8");
$xmldom = $xml->createElement("MetaData");
$node = $xml->createElement("title", htmlspecialchars($meta->title, ENT_QUOTES, 'UTF-8'));
$xmldom->appendChild($node);
$node = $xml->createElement("keywords", htmlspecialchars($meta->keywords, ENT_QUOTES, 'UTF-8'));
$xmldom->appendChild($node);
$node = $xml->createElement("description", htmlspecialchars($meta->description, ENT_QUOTES, 'UTF-8'));
$xmldom->appendChild($node);
$node = $xml->createElement("priority", htmlspecialchars($meta->priority, ENT_QUOTES, 'UTF-8'));
$xmldom->appendChild($node);
$node = $xml->createElement("change", htmlspecialchars($meta->change, ENT_QUOTES, 'UTF-8'));
$xmldom->appendChild($node);
$node = $xml->createElement("googlemap", htmlspecialchars($meta->googlemap, ENT_QUOTES, 'UTF-8'));
$xmldom->appendChild($node);
$xml->appendChild($xmldom);
$node = $xml->createElement("urlsegment", htmlspecialchars($meta->urlsegment, ENT_QUOTES, 'UTF-8'));
$xmldom->appendChild($node);
$xml->appendChild($xmldom);
$attribute->setAttribute('data_text', $xml->saveXML());
// save keywords
$keyword = new eZKeyword();
$keyword->initializeKeyword($meta->keywords);
$keyword->store($attribute);
}