/**
  * Retrieves the attachments of the specified object
  *
  * @param mixed $object
  * @return WebDev\AttachmentBundle\Attachement\File[]
  */
 public function files($object)
 {
     if (!is_object($object)) {
         throw new Exception("Can't retrieve the attachments of a " . get_type($object));
     }
     $class = new ReflectionClass($object);
     $files = array();
     foreach ($this->reader->getClassAnnotations($class) as $annotation) {
         if (!$annotation instanceof FileAttachment) {
             continue;
         }
         $file = new File($annotation, $object, $this);
         $files[$file->getName()] = $file;
     }
     return $files;
 }
 /**
  * Returns the absolute file name without dots.
  *
  * @return string The file path
  */
 public function getName()
 {
     return $this->moved ? parent::getName() : $this->originalName;
 }
Example #3
0
 /**
  * Returns the absolute file name without dots
  *
  * Until the uploaded file is moved, it will return the name of the temporary file
  *
  * @returns string  The file path
  */
 public function getName()
 {
     if (!$this->moved) {
         return $this->originalName;
     }
     return parent::getName();
 }