PartKeepr\UploadedFileBundle\Entity\UploadedFile::setType PHP Method

setType() protected method

Sets the type of the file. Once the type is set, it may not be changed later.
protected setType ( string $type )
$type string The type of the file
    protected function setType($type)
    {
        $this->type = $type;
    }

Usage Example

Example #1
0
 /**
  * Sets the type of the image. Once the type is set,
  * it may not be changed later.
  *
  * @param string $type The type for the image, one of the IMAGE_ constants.
  *
  * @throws InvalidImageTypeException
  */
 protected function setType($type)
 {
     switch ($type) {
         case self::IMAGE_ICLOGO:
         case self::IMAGE_TEMP:
         case self::IMAGE_PART:
         case self::IMAGE_FOOTPRINT:
         case self::IMAGE_STORAGELOCATION:
             parent::setType($type);
             break;
         default:
             throw new InvalidImageTypeException($type);
     }
 }