Ejemplo n.º 1
0
 /**
  * Returns the prefix to the Generator. This can be "unique", or "optional".
  *
  * @return string
  */
 protected function getPrefix()
 {
     $prefixes = array('unique', 'optional');
     $prefix = current(explode(':', $this->getGenerator()));
     return Arr::has($prefixes, $prefix) ? $prefix : false;
 }
Ejemplo n.º 2
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;
 }