本文整理汇总了PHP中xPDOObject::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP xPDOObject::remove方法的具体用法?PHP xPDOObject::remove怎么用?PHP xPDOObject::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xPDOObject
的用法示例。
在下文中一共展示了xPDOObject::remove方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remove
public function remove(array $ancestors = array())
{
$removed = parent::remove();
if ($removed) {
$this->clearCache();
}
return $removed;
}
示例2: remove
/**
* @param array $ancestors
*
* @return bool
*/
public function remove(array $ancestors = array())
{
/** @var TicketAuthor $profile */
if ($profile = $this->xpdo->getObject('TicketAuthor', $this->get('uid'))) {
$profile->removeAction('view', $this->get('parent'), $this->get('uid'));
}
return parent::remove($ancestors);
}
示例3: remove
public function remove(array $ancestors = array())
{
$removed = parent::remove($ancestors);
if ($removed && !$this->getOption(xPDO::OPT_SETUP)) {
$this->xpdo->call('modNamespace', 'clearCache', array(&$this->xpdo));
}
return $removed;
}
示例4: remove
/**
* Overrides xPDOObject::remove to fire modX-specific events.
*
* {@inheritDoc}
*/
public function remove(array $ancestors = array())
{
if ($this->xpdo instanceof modX) {
$this->xpdo->invokeEvent('OnPluginEventBeforeRemove', array('pluginEvent' => &$this, 'ancestors' => $ancestors));
}
$removed = parent::remove($ancestors);
if ($removed && $this->xpdo instanceof modX) {
$this->xpdo->invokeEvent('OnPluginEventRemove', array('pluginEvent' => &$this, 'ancestors' => $ancestors));
}
return $removed;
}
示例5: remove
/**
* @param array $ancestors
*
* @return bool
*/
public function remove(array $ancestors = array())
{
$type = '';
$class = $this->get('class');
if ($class == 'TicketComment') {
$type = 'vote_comment';
} elseif ($class == 'Ticket') {
$type = 'vote_ticket';
}
if (!empty($type)) {
/** @var TicketAuthor $profile */
if ($profile = $this->xpdo->getObject('TicketAuthor', $this->get('owner'))) {
$profile->removeAction($type, $this->id, $this->get('createdby'));
}
}
return parent::remove($ancestors);
}
示例6: remove
/**
* {@inheritdoc}
* Delete option values for product in category while remove option from category
*/
public function remove(array $ancestors = array())
{
$q = $this->xpdo->newQuery('msProduct', array('parent' => $this->get('category_id')));
$q->select('id');
if ($q->prepare() && $q->stmt->execute()) {
$products = $q->stmt->fetchAll(PDO::FETCH_COLUMN);
$products = implode(',', $products);
$key = $this->getOne('Option')->get('key');
$key = $this->xpdo->quote($key);
if (count($products) > 0) {
$sql = "DELETE FROM {$this->xpdo->getTableName('msProductOption')} WHERE `product_id` IN ({$products}) AND `key`={$key};";
$stmt = $this->xpdo->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
}
}
return parent::remove($ancestors);
}
示例7: remove
/**
* Custom remove that respects access policies.
*
* {@inheritdoc}
*/
public function remove(array $ancestors = array())
{
$removed = false;
if (!$this->checkPolicy('remove')) {
$this->xpdo->error->failure($this->xpdo->lexicon('permission_denied'));
}
$removed = parent::remove($ancestors);
return $removed;
}
示例8: remove
/**
* Overrides xPDOObject::remove. Removes and uninstalls the package.
*
* {@inheritdoc}
*/
public function remove($force = false, array $ancestors = array(), $uninstall = true)
{
$removed = false;
if ($this->get('installed') == null || $this->get('installed') == '0000-00-00 00:00:00') {
$uninstalled = true;
} else {
if ($uninstall) {
$uninstalled = $this->uninstall();
}
}
if ($uninstalled || $force) {
$removed = parent::remove($ancestors);
}
return $removed;
}
示例9: remove
/**
* We override the parent func so we can clean out the asset files
*/
public function remove(array $ancestors = array())
{
$storage_basedir = $this->xpdo->getOption('assets_path') . rtrim($this->xpdo->getOption('assman.library_path'), '/') . '/';
$this->xpdo->log(\modX::LOG_LEVEL_DEBUG, 'Removing Asset ' . $this->getPrimaryKey() . ' with assets in storage_basedir ' . $storage_basedir, '', __CLASS__, __FILE__, __LINE__);
$file = $this->get('path');
if (file_exists($file)) {
if (!unlink($file)) {
$this->xpdo->log(\modX::LOG_LEVEL_ERROR, 'Failed to remove file asset for Asset ' . $this->getPrimaryKey() . ': ' . $file, '', __CLASS__, __FILE__, __LINE__);
throw new \Exception('Failed to delete asset file.');
}
} else {
$this->xpdo->log(\modX::LOG_LEVEL_INFO, 'File does not exist for Asset ' . $this->getPrimaryKey() . ': ' . $file . ' This could be because the file was manually deleted or because you did not pass the $storage_basedir parameter.', '', __CLASS__, __FILE__, __LINE__);
}
// remove thumbnails
$storage_basedir = $this->xpdo->getOption('assets_path') . rtrim($this->xpdo->getOption('assman.library_path'), '/') . '/';
$dir = $storage_basedir . 'resized/' . $this->get('asset_id') . '/';
self::rrmdir($dir);
return parent::remove($ancestors);
}