本文整理汇总了PHP中modResource::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP modResource::remove方法的具体用法?PHP modResource::remove怎么用?PHP modResource::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modResource
的用法示例。
在下文中一共展示了modResource::remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* {@inheritDoc}
* @return mixed
*/
public function process()
{
if (!$this->resource->checkPolicy('delete')) {
return $this->failure($this->modx->lexicon('resource_err_delete'));
}
$resources = array($this->resource);
$ids = array($this->resource->id);
$this->modx->invokeEvent('OnBeforeEmptyTrash', array('ids' => &$ids, 'resources' => &$resources));
$this->handleChildren();
/** @var modResourceGroupResource[] $resourceGroupResources */
$resourceGroupResources = $this->resource->getMany('ResourceGroupResources');
/** @var modTemplateVarResource[] $templateVarResources */
$templateVarResources = $this->resource->getMany('TemplateVarResources');
foreach ($resourceGroupResources as $resourceGroupResource) {
$resourceGroupResource->remove();
}
foreach ($templateVarResources as $templateVarResource) {
$templateVarResource->remove();
}
$this->modx->removeCollection('CollectionSelection', array('resource' => $this->resource->id));
if ($this->resource->remove() == false) {
return $this->failure($this->modx->lexicon('resource_err_delete'));
}
$this->modx->invokeEvent('OnEmptyTrash', array('num_deleted' => 1, 'resources' => &$resources, 'ids' => &$ids));
$this->logManagerAction();
$skipClearCache = $this->getProperty('skipClearCache', false);
if ($skipClearCache == false) {
$this->clearCache();
}
return $this->success();
}
示例2: remove
/**
* @param array $ancestors
*
* @return bool
*/
public function remove(array $ancestors = array())
{
$collection = $this->xpdo->getIterator('TicketThread', array('name' => 'resource-' . $this->id));
/** @var TicketThread $item */
foreach ($collection as $item) {
$item->remove();
}
/** @var TicketAuthor $profile */
if ($profile = $this->xpdo->getObject('TicketAuthor', $this->get('createdby'))) {
$profile->removeAction('ticket', $this->id, $this->get('createdby'));
}
return parent::remove($ancestors);
}
示例3: tearDown
public function tearDown()
{
parent::tearDown();
$this->thread->remove();
$this->resource->remove();
}
示例4: remove
/**
* Override remove to remove the associated Quip thread
*
* {@inheritDoc}
*
* @param array $ancestors
* @return boolean
*/
public function remove(array $ancestors = array())
{
$removed = parent::remove($ancestors);
if ($removed) {
$quipPath = $this->xpdo->getOption('quip.core_path', null, $this->xpdo->getOption('core_path') . 'components/quip/');
$this->xpdo->addPackage('quip', $quipPath . 'model/');
/** @var quipThread $thread */
$thread = $this->xpdo->getObject('quipThread', array('name' => 'article-b' . $this->get('parent') . '-' . $this->get('id')));
if ($thread) {
$thread->remove();
}
}
return $removed;
}