Beispiel #1
0
 /**
  * Call the delete method on any saved objects.
  *
  * @throws \League\FactoryMuffin\Exceptions\DeletingFailedException
  *
  * return $this
  */
 public function deleteSaved()
 {
     $exceptions = array();
     foreach ($this->saved as $object) {
         try {
             if (!$this->delete($object)) {
                 throw new DeleteFailedException(get_class($object));
             }
         } catch (Exception $e) {
             $exceptions[] = $e;
         }
         Arr::remove($this->saved, $object);
     }
     // If we ran into problem, throw the exception now
     if ($exceptions) {
         throw new DeletingFailedException($exceptions);
     }
     return $this;
 }