Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function remove($data, $flush = true)
 {
     $entity = null;
     if (is_object($data)) {
         $entity = $data;
     } elseif (is_numeric($data)) {
         $entity = $this->source->findOneById($data);
     } else {
         throw new \InvalidArgumentException('Argument passed is not an object or it\'s id');
     }
     if ($this->crudManager instanceof CrudManagerInterface) {
         $this->crudManager->remove($entity);
     } else {
         $this->entityManager->remove($entity);
     }
     if ($flush) {
         $this->entityManager->flush();
     }
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function remove($data)
 {
     $entity = null;
     if (is_object($data)) {
         $entity = $data;
     } elseif (is_numeric($data)) {
         $this->source->clear();
         $entity = $this->source->findPk($data);
     } else {
         throw new \InvalidArgumentException('Argument passed is not an object or it\'s not id');
     }
     if (!$entity instanceof \Persistent) {
         throw new \InvalidArgumentException('The $entity instance is not supported by the Propel implementation');
     }
     if ($this->crudManager instanceof CrudManagerInterface) {
         $this->crudManager->remove($entity);
     } else {
         $entity->delete();
     }
 }