public function delete($entity)
    {
        $event = new StorageEvent($entity);
        $this->event()->dispatch(StorageEvents::PRE_DELETE, $event);
        $qb = $this->em->createQueryBuilder()
            ->delete($this->getTableName())
            ->where('id = :id')
            ->setParameter('id', $entity->getId());

        $response = $qb->execute();
        $event = new StorageEvent($entity);
        $this->event()->dispatch(StorageEvents::POST_DELETE, $event);

        return $response;
    }
public function delete($entity)
    {
        $event = new StorageEvent($entity);
        $this->event()->dispatch(StorageEvents::PRE_DELETE, $event);
        $qb = $this->em->createQueryBuilder()
            ->delete($this->getTableName())
            ->where('id = :id')
            ->setParameter('id', $entity->getId());

        $response = $qb->execute();
        $event = new StorageEvent($entity);
        $this->event()->dispatch(StorageEvents::POST_DELETE, $event);

        return $response;
    }
public function delete ( $ entity ) { $ event = new StorageEvent ( $ entity ) ; $ this -> event ( ) -> dispatch ( StorageEvents :: PRE_DELETE , $ event ) ; $ qb = $ this -> em -> createQueryBuilder ( ) -> delete ( $ this -> getTableName ( ) ) -> where ( 'id = :id' ) -> setParameter ( 'id' , $ entity -> getId ( ) ) ; $ response = $ qb -> execute ( ) ; $ event = new StorageEvent ( $ entity ) ; $ this -> event ( ) -> dispatch ( StorageEvents :: POST_DELETE , $ event ) ; return $ response ; }
Deletes a single object.

@param object $entity the entity to delete

@return bool
Deletes a single object .