public function onPreDelete(StorageEvent $event)
    {
        $entity = $event->getContent();
        if (!$entity instanceof Entity\Content) {
            return;
        }
        $taxonomies = $entity->getTaxonomy();
        if ($taxonomies instanceof Collection\Taxonomy) {
            $repo = $this->em->getRepository(Entity\Taxonomy::class);
            foreach ($taxonomies as $taxonomy) {
                $repo->delete($taxonomy);
            }
        }
        $relations = $entity->getRelation();
        if ($relations instanceof Collection\Relations) {
            $repo = $this->em->getRepository(Entity\Relations::class);
            foreach ($relations as $relation) {
                $repo->delete($relation);
            }
        }
    }
public function onPreDelete(StorageEvent $event)
    {
        $entity = $event->getContent();
        if (!$entity instanceof Entity\Content) {
            return;
        }
        $taxonomies = $entity->getTaxonomy();
        if ($taxonomies instanceof Collection\Taxonomy) {
            $repo = $this->em->getRepository(Entity\Taxonomy::class);
            foreach ($taxonomies as $taxonomy) {
                $repo->delete($taxonomy);
            }
        }
        $relations = $entity->getRelation();
        if ($relations instanceof Collection\Relations) {
            $repo = $this->em->getRepository(Entity\Relations::class);
            foreach ($relations as $relation) {
                $repo->delete($relation);
            }
        }
    }
public function onPreDelete ( StorageEvent $ event ) { $ entity = $ event -> getContent ( ) ; if ( ! $ entity instanceof Entity \ Content ) { return ; } $ taxonomies = $ entity -> getTaxonomy ( ) ; if ( $ taxonomies instanceof Collection \ Taxonomy ) { $ repo = $ this -> em -> getRepository ( Entity \ Taxonomy :: class ) ; foreach ( $ taxonomies as $ taxonomy ) { $ repo -> delete ( $ taxonomy ) ; } } $ relations = $ entity -> getRelation ( ) ; if ( $ relations instanceof Collection \ Relations ) { $ repo = $ this -> em -> getRepository ( Entity \ Relations :: class ) ; foreach ( $ relations as $ relation ) { $ repo -> delete ( $ relation ) ; } } }
Pre-delete event to delete an entities taxonomy & relation entities.

@param StorageEvent $event
Pre - delete event to delete an entities taxonomy & relation entities .