Delete's a model from the repository.

Calls onObjectDeleted afterwards which most repositories extend to do the actual deletion.

@see onObjectDeleted()
@param Model $object
198240
final public function deleteObject(Model $object)
    {
        if ($object->isNewRecord()) {
            return;
        }

        $this->onObjectDeleted($object);

        $this->deleteObjectFromCache($object);
    }
703096
public function delete($object, $meta=null)
    {
        $query = new Query\Criteria();

        if (!is_object($object)) {
            throw new \BadMethodCallException("Please use deleteTable()");
        } 

        if ($meta) {
            $meta = !$meta instanceof Meta ? $this->mapper->getMeta($meta) : $meta;
        } else {
            $meta = $this->mapper->getMeta(get_class($object));
        }

        if (!$meta->canDelete) {
            throw new Exception("Meta {$meta->id} prohibits delete");
        }

        event_before: {
            if (isset($meta->on['beforeDelete'])) {
                foreach ($meta->on['beforeDelete'] as $cb) { $cb = [$object, $cb]; $cb(); }
            }
            if (isset($this->on['beforeDelete'])) {
                foreach ($this->on['beforeDelete'] as $cb) { $cb($object, $meta); }
            }
        }

        $query->where = $meta->getIndexValue($object);
        $return = $this->executeDelete($meta, $query);

        event_after: {
            if (isset($meta->on['afterDelete'])) {
                foreach ($meta->on['afterDelete'] as $cb) { $cb = [$object, $cb]; $cb(); }
            }
            if (isset($this->on['afterDelete'])) {
                foreach ($this->on['afterDelete'] as $cb) { $cb($object, $meta); }
            }
        }

        return $return;
    }
595110
public function endObject(Model $model)
    {
        $this->objects[] = $this->dumpObject($model);
        $this->_fields = null;
    }
628779
protected function addToDb(Database\Model &$object)
    {
        $this->FKValue[1] = $object->id;
        $this->doQuery($this->addToDbQuery());
    }
619915
public function update($object)
    {
        if (!($object instanceof $this->objectType)) {
            throw new IllegalObjectTypeException('The modified object given to update() was not of the type (' . $this->objectType . ') this repository manages.', 1249479625);
        }
        $this->persistenceManager->update($object);
    }
716364
private function object($object, string $label = ''): void
    {
        if ($object instanceof PresentationModel) {
            $this->presentationModel($object, $label);
        } elseif ($object instanceof View) {
            $this->view($object);
        } else {
            $this->iterable(get_object_vars($object), $label);
        }
    }
775279
public function offsetUnset($object) : void
    {
        $hash = spl_object_hash($object);

        unset($this->objects[$hash]);
        unset($this->data[$hash]);
    }
452929
public function remove($object)
    {
        foreach (array_keys($this->dataPlaceHolder) as $k) {
            if ($this->dataPlaceHolder[$k] === $object) {
                unset($this->dataPlaceHolder[$k]);

                return;
            }
        }
    }
985620
public function delete($object)
    {
        $ret = $this->getValidator()->validateDelete($object);
        if ($ret) {
            $ret = $this->_delete($object);
        }
        return $ret;
    }
92590
public function unregisterObject($object)
    {
        unset($this->identifierMap[$this->objectMap[$object]]);
        $this->objectMap->detach($object);
    }
1055261
protected function edit(ModelObject $obj)
    {
        if ($obj->{$obj->getPrimaryKey()} == null)
            $this->errors->reject("{$obj->getPrimaryKey()} is required to edit.")->throwOnError();

        if ($this->dao->getByID($obj->{$obj->getPrimaryKey()}) == false)
            $this->getErrors()->reject("Record not found for ID: " . $obj->{$obj->getPrimaryKey()})->throwOnError();

        if ($this->dao->slugExists($obj->Slug, $obj->{$obj->getPrimaryKey()}))
            $this->errors->reject("The slug for this ".get_class($obj)." record is already in use.")->throwOnError();

        $this->errors->validateModelObject($obj);
    }
447407
public function remove($model, $version) {
		$operations = Configure::read('FileStorage.imageSizes.' . $model . '.' . $version);

		if (empty($operations)) {
			$this->out(__d('file_storage', 'Invalid table or version.'));
			$this->_stop();
		}

		try {
			$this->_loop('remove', $model, [$version => $operations]);
		} catch (Exception $e) {
			$this->out($e->getMessage());
			$this->_stop();
		}
	}
1354438
def delete_object(self, obj):
        
        session = self.get_db_session()
        session.delete(obj)
        session.commit()
1048090
public function remove($object)
    {
        // create property accessor
        $accessor = PropertyAccess::createPropertyAccessor();

        // delete existing documents with same id
        foreach ($this->index->find('id:' . $accessor->getValue($object, 'id')) as $hit) {
            $this->index->delete($hit->id);
        }
    }
873437
protected function delete($model)
    {
        $method = $this->methods['delete'];

        if (!method_exists($this->storage, $method) || !is_callable([$this->storage, $method])) {
            throw new DeleteMethodNotFoundException(get_class($this->storage), $method);
        }

        $this->storage->$method($model);

        return true;
    }
522605
public function delete($object)
    {
        $entityName = get_class($object);
        $repo = $this->getRepository($entityName);

        return $repo->delete($object);
    }
898034
public function crudDeleteObject(Request $request, $object)
    {
        if (!is_object($object)) {
            /** @var ObjectRepository $repo */
            $repo = $this->crudRepositoryForClass($this->crudObjectClass());
            $object = $repo->find($object);
        }

        if (null === $object) {
            throw new NotFoundHttpException('There is no object with this id');
        }

        if (!$this->crudDeleteIsGranted($object)) {
            throw new AccessDeniedException('You need the permission to delete this object!');
        }

        $this->crudDeletePreRemove($object);

        $em = $this->crudManagerForClass($this->crudObjectClass());
        $em->remove($object);
        $em->flush();

        $this->crudDeletePostFlush($object);

        $this->crudFlashMessage($request, 'success', sprintf('%s.delete.flash.success', $this->crudTransPrefix()));

        return new RedirectResponse($this->crudDeleteRedirectUrl(), 302);
    }