Handle the deletion of typical age range on a place.
@param AbstractDeleteTypicalAgeRange $deleteTypicalAgeRange
425424
public function handleDeleteTypicalAgeRange(AbstractDeleteTypicalAgeRange $deleteTypicalAgeRange)
    {
        $offer = $this->load($deleteTypicalAgeRange->getItemId());

        $offer->deleteTypicalAgeRange();

        $this->offerRepository->save($offer);

    }
1063871
@Subscribe
    public void handleIndexDeletion(final IndicesDeletedEvent event) {
        event.indices().forEach(indexName -> {
            LOG.debug("Removing field type information for deleted index <{}>", indexName);
            dbService.delete(indexName);
        });
    }
238575
public function deleteContent($content)
    {
        $this->deleNodeEntity($this->contentType, array('content' => $content));
        $this->deleNodeEntity(
            $this->subContent, array('father' => $content),
            function ($entity) {
                $this->deleteContent($entity->getChild());
            }
        );
        $this->deleNodeEntity($this->subContent, array('child' => $content));
        $this->deleNodeEntity($this->contentRegion, array('content' => $content));
        $this->manager->remove($content);
        $this->manager->flush();
    }
516946
public function preDelete(DeleteEvent $event)
    {
        /** @var User $user */
        $user = $event->getObject();
        $userRole = $this->roleManager->getUserRole($user->getUsername());

        //soft delete~
        $user->setIsRemoved(true);
        $user->setEmail('email#'.$user->getId());
        $user->setFirstName('firstname#'.$user->getId());
        $user->setLastName('lastname#'.$user->getId());
        $user->setPlainPassword(uniqid());
        $user->setUsername('username#'.$user->getId());
        $user->setPublicUrl('removed#'.$user->getId());
        $user->setAdministrativeCode('code#'.$user->getId());
        $user->setIsEnabled(false);

        // keeping the user's workspace with its original code
        // would prevent creating a user with the same username
        // todo: workspace deletion should be an option
        $ws = $user->getPersonalWorkspace();

        if ($ws) {
            $ws->setCode($ws->getCode().'#deleted_user#'.$user->getId());
            $ws->setDisplayable(false);
            $this->om->persist($ws);
        }

        if ($userRole) {
            $this->om->remove($userRole);
        }
        $this->om->persist($user);
        $this->om->flush();

        //dispatch some events but they should be listening the same as we are imo.
        //something should be done for event listeners
        $this->dispatcher->dispatch('claroline_users_delete', 'GenericData', [[$user]]);
        $this->dispatcher->dispatch('log', 'Log\LogUserDelete', [$user]);
        $this->dispatcher->dispatch('delete_user', 'DeleteUser', [$user]);
    }
623680
public function delete() {

		if (method_exists($this, 'trait_child_delete') and is_callable([$this, 'trait_child_delete'])) {
			$this->trait_child_delete();
		}

		$table = self::trait_get_database_table();
		$db = self::trait_get_database();

		if (isset(self::$object_text_fields)) {
			$object_texts = \Skeleton\I18n\Object\Text::get_by_object($this);
			foreach ($object_texts as $object_text) {
				$object_text->delete();

				if (self::trait_cache_enabled()) {
					$key = get_called_class() . '_' . $object_text->object_id . '_' . $object_text->label . '_' . $object_text->language->name_short;
					self::cache_delete($key);
				}
			}
		}

		if (self::trait_cache_enabled()) {
			self::cache_delete(get_called_class() . '_' . $this->id);
		}

		$db->query('DELETE FROM ' . $db->quote_identifier($table) . ' WHERE ' . self::trait_get_table_field_id() . '=?', [$this->id]);
	}
579147
public function deleting(Model $model)
    {
        $model->deleted_by = $this->guard->check() ? $this->guard->user()->getId() : null;
    }
83676
public function onDelete(DeleteResourceEvent $event)
    {
        $ds = DIRECTORY_SEPARATOR;

        /** @var File $resource */
        $resource = $event->getResource();
        $workspace = $resource->getResourceNode()->getWorkspace();
        $hashName = $resource->getHashName();

        $archiveFile = $this->filesDir.$ds.'webresource'.$ds.$workspace->getUuid().$ds.$hashName;
        $webResourcesPath = $this->uploadDir.$ds.'webresource'.$ds.$workspace->getUuid().$ds.$hashName;

        if (file_exists($archiveFile)) {
            $event->setFiles([$archiveFile]);
        }
        if (file_exists($webResourcesPath)) {
            try {
                $this->deleteFiles($webResourcesPath);
            } catch (\Exception $e) {
            }
        }
        $this->om->remove($resource);
        $event->stopPropagation();
    }
440964
public function deleteSubtree($withSelf = false, $forceDelete = false)
    {
        $action = ($forceDelete === true ? 'forceDelete' : 'delete');

        $ids = $this->joinClosureBy('descendant', $withSelf)->pluck($this->getKeyName());

        if ($forceDelete) {
            $this->closure->whereIn($this->closure->getDescendantColumn(), $ids)->delete();
        }

        $this->whereIn($this->getKeyName(), $ids)->$action();
    }
834059
public function delete()
    {
        if ( ! is_null($this->parent)) {
            $this->parent->removeChild($this->id);
        }

        $this->parent = null;
    }
385742
function (config) {
    var guide = config.categoryAxis.guides[0]
    var filter = this.filteredCollection.getFilters(this.filteredCollection.getTriggerField())
    if (filter) {
      if (config.categoryAxis.parseDates) {
        guide.date = filter.expression.value[0].value
        guide.toDate = filter.expression.value[1].value
      } else {
        guide.category = guide.toCategory = filter.expression.value
      }
    } else {
      if (guide.date) delete guide.date
      if (guide.toDate) delete guide.toDate
      if (guide.category) delete guide.category
    }
  }
940963
public function delete($userRoleLinker, $tableName = null)
    {
        $this->checkEntity($userRoleLinker);

        return parent::delete(array('user_id' => $userRoleLinker->getUserId(), 'role_id' => $userRoleLinker->getRoleId()));
    }
979869
protected function deleteCategory()
    {
        $this->controlAccess('category_delete');

        if ($this->category->delete($this->data_category['category_id'])) {
            $url = "admin/content/category/{$this->data_category_group['category_group_id']}";
            $this->redirect($url, $this->text('Category has been deleted'), 'success');
        }

        $this->redirect('', $this->text('Category has not been deleted'), 'warning');
    }
652449
public function deleteRecord($index)
    {
        if (isset($this->records[$index])) {
            $this->fileLength -= ($this->records[$index]->getContentLength() + 4);
            $count = count($this->records) - 1;
            for ($i = $index; $i < $count; ++$i) {
                $this->records[$i] = $this->records[$i + 1];
            }
            unset($this->records[count($this->records) - 1]);
            $this->_deleteRecordFromDBF($index);
        }
    }
1192112
private function handleSoftDeletes($builder, $model)
    {
        // remove where statement for __soft_deleted when soft delete is not active
        // does not show soft deleted items when trait is attached to model and
        // config('scout.soft_delete') is false
        if (!$this->usesSoftDelete($model) || !config('scout.soft_delete', true)) {
            unset($this->builder->wheres['__soft_deleted']);
            return $builder;
        }

        /**
         * Use standard behaviour of Laravel Scout builder class to support soft deletes.
         *
         * When no __soft_deleted statement is given return all entries
         */
        if (!in_array('__soft_deleted', $this->builder->wheres)) {
            return $builder->withTrashed();
        }

        /**
         * When __soft_deleted is 1 then return only soft deleted entries
         */
        if ($this->builder->wheres['__soft_deleted']) {
            $builder = $builder->onlyTrashed();
        }

        /**
         * Returns all undeleted entries, default behaviour
         */
        unset($this->builder->wheres['__soft_deleted']);
        return $builder;
    }
984692
protected function deleteOrphanedAbilities()
    {
        $query = $this->getBaseOrphanedQuery()->where(function ($query) {
            foreach ($this->getEntityModels() as $modelName) {
                $query->orWhere(function ($query) use ($modelName) {
                    $this->scopeQueryToWhereModelIsMissing($query, $modelName);
                });
            }
        });

        if (($count = $query->count()) > 0) {
            $query->delete();

            $this->info("Deleted {$count} orphaned ".Str::plural('ability', $count).'.');
        } else {
            $this->info('No orphaned abilities.');
        }
    }
1134804
public function deleteChildren(int $parentID, int $postTypeID)
    {
        $this->categoryList = self::where("postTypeID", $postTypeID)->get();
        $this->getAllChildren($parentID);
        foreach($this->categoriesToBeDeleted as $cat){
            // Post type should not be able to be deleted if it has posts
            if(self::isInMenuLinks($cat->categoryID)) {
                return $this->response("You can't delete this Category because it is part of a menu.", 403);
            }

            $postType = PostType::findByID($postTypeID);
            // delete relations
            DB::table($postType->slug.'_categories')->where("categoryID", $cat->categoryID)->delete();
            // delete children
            $cat->delete();
        }
    }
714997
public function delete()
    {
        if (!$this->isXmlHttpRequest()) {
            throw new \Exception("wrong request mode");
        }

        $deleted = $this->getClassService()->deleteInstance($this->getCurrentInstance());

        $this->returnJson(array(
            'deleted' => $deleted
        ));
    }