partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

PartAttachment.php (1590B)


      1 <?php
      2 
      3 namespace PartKeepr\PartBundle\Entity;
      4 
      5 use Doctrine\ORM\Mapping as ORM;
      6 use PartKeepr\UploadedFileBundle\Entity\UploadedFile;
      7 use Symfony\Component\Serializer\Annotation\Groups;
      8 
      9 /**
     10  * Holds a part attachment.
     11  *
     12  * @ORM\Entity
     13  **/
     14 class PartAttachment extends UploadedFile
     15 {
     16     /**
     17      * Defines if the attachment is an image.
     18      *
     19      * @ORM\Column(type="boolean",nullable=true)
     20      * @Groups({"default"})
     21      *
     22      * @var bool
     23      */
     24     private $isImage;
     25 
     26     /**
     27      * Creates a new part attachment.
     28      */
     29     public function __construct()
     30     {
     31         parent::__construct();
     32         $this->setType('PartAttachment');
     33         $this->isImage = null;
     34     }
     35 
     36     /**
     37      * The part object.
     38      *
     39      * @ORM\ManyToOne(targetEntity="PartKeepr\PartBundle\Entity\Part", inversedBy="attachments")
     40      *
     41      * @var Part
     42      */
     43     private $part = null;
     44 
     45     /**
     46      * Sets the part.
     47      *
     48      * @param Part $part The part to set
     49      */
     50     public function setPart(Part $part = null)
     51     {
     52         $this->part = $part;
     53     }
     54 
     55     /**
     56      * Returns the part.
     57      *
     58      * @return Part the part
     59      */
     60     public function getPart()
     61     {
     62         return $this->part;
     63     }
     64 
     65     /**
     66      * Returns if the attachment is an image or not.
     67      *
     68      * @return true if the attachment is an image, false otherwise
     69      */
     70     public function isImage()
     71     {
     72         return $this->isImage;
     73     }
     74 
     75     /**
     76      * Sets if the attachment is an image.
     77      *
     78      * @param $image
     79      */
     80     public function setImage($image)
     81     {
     82         $this->isImage = $image;
     83     }
     84 }