本文整理汇总了PHP中Field::entryDataCleanup方法的典型用法代码示例。如果您正苦于以下问题:PHP Field::entryDataCleanup方法的具体用法?PHP Field::entryDataCleanup怎么用?PHP Field::entryDataCleanup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Field
的用法示例。
在下文中一共展示了Field::entryDataCleanup方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: entryDataCleanup
public function entryDataCleanup($entry_id, $data = null)
{
$entryManager = new EntryManager(Symphony::Engine());
$field_id = $this->get('linked_field_id');
$entry_ids = Symphony::Database()->fetchCol('linked_entry_id', sprintf("\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tf.linked_entry_id\n\t\t\t\t\tFROM\n\t\t\t\t\t\t`tbl_entries_data_%s` AS f\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tf.entry_id = '%s'\n\t\t\t\t", $this->get('id'), $entry_id));
$entries = $entryManager->fetch($entry_ids, $this->get('linked_section_id'));
if ($entries) {
foreach ($entries as $entry) {
if (!is_object($entry)) {
continue;
}
$values = $entry->getData($field_id);
if (is_array($values) and array_key_exists('linked_entry_id', $values)) {
$values = $values['linked_entry_id'];
}
if (is_null($values)) {
$values = array();
} else {
if (!is_array($values)) {
$values = array($values);
}
}
$values = array_diff($values, array($entry_id));
if (empty($values)) {
$values = null;
}
$entry->setData($field_id, array('linked_entry_id' => $values));
$entry->commit();
}
}
return parent::entryDataCleanup($entry_id, $data);
}
示例2: entryDataCleanup
public function entryDataCleanup($entry_id, $data = null)
{
$entryManager = new EntryManager($this->_engine);
$field_id = $this->get('id');
$entries = $this->_engine->Database->fetchCol('linked_entry_id', sprintf("\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tf.linked_entry_id\n\t\t\t\t\tFROM\n\t\t\t\t\t\t`tbl_entries_data_{$field_id}` AS f\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tf.entry_id = '{$entry_id}'\n\t\t\t\t"));
foreach ($entries as $linked_entry_id) {
if (is_null($linked_entry_id)) {
continue;
}
$entry = @current($entryManager->fetch($linked_entry_id, $this->get('linked_section_id')));
if (!is_object($entry)) {
continue;
}
$values = $entry->getData($this->get('linked_field_id'));
if (array_key_exists(linked_entry_id, $values)) {
$values = $values['linked_entry_id'];
}
if (is_null($values)) {
$values = array();
} else {
if (!is_array($values)) {
$values = array($values);
}
}
$values = array_diff($values, array($entry_id));
$entry->setData($this->get('linked_field_id'), array('linked_entry_id' => $values));
$entry->commit();
}
return parent::entryDataCleanup($entry_id, $data);
}
示例3: entryDataCleanup
public function entryDataCleanup($entry_id, $data)
{
$file_location = WORKSPACE . '/' . ltrim($data['file'], '/');
if (is_file($file_location)) {
General::deleteFile($file_location);
}
parent::entryDataCleanup($entry_id);
return true;
}
示例4: entryDataCleanup
public function entryDataCleanup($entry_id, $data = null)
{
$file_location = $this->getFilePath($data['file']);
if (is_file($file_location)) {
General::deleteFile($file_location);
}
parent::entryDataCleanup($entry_id);
return true;
}
示例5: entryDataCleanup
public function entryDataCleanup($entry_id, $data = NULL)
{
if (is_array($data)) {
foreach ($data as $file) {
$file = $this->getFilePath($file);
if (is_file($file)) {
General::deleteFile($file);
}
}
}
return Field::entryDataCleanup($entry_id);
}
示例6: entryDataCleanup
public function entryDataCleanup($entry_id, $data)
{
if ($this->get('remove_from_bucket') == true) {
try {
if (!is_null($data['file'])) {
$this->s3->deleteObject($this->get('bucket'), basename($data['file']));
}
} catch (Exception $e) {
}
}
Field::entryDataCleanup($entry_id);
return true;
}
示例7: entryDataCleanup
public function entryDataCleanup($entry_id, $data = NULL)
{
try {
$newsletter_id = EmailNewsletterManager::delete($data['newsletter_id']);
return parent::entryDataCleanup($entry_id, $data);
} catch (Exception $e) {
return false;
}
}
示例8: entryDataCleanup
/**
*
* Remove the entry data of this field from the database, when deleting an entry
* @param integer|array $entry_id
* @param array $data
* @return boolean
*/
public function entryDataCleanup($entry_id, array $data)
{
if (empty($entry_id) || !parent::entryDataCleanup($entry_id, $data)) {
return false;
}
return true;
}