src/Daikin/BaseBundle/Entity/AbstractActivatableEntity.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Daikin\BaseBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use JMS\Serializer\Annotation as Serializer;
  5. /**
  6.  * @ORM\MappedSuperclass
  7.  * @Serializer\ExclusionPolicy("all")
  8.  */
  9. abstract class AbstractActivatableEntity extends AbstractDeleteableEntity
  10. {
  11.     /** @ORM\Column(type="boolean") */
  12.     protected $active;
  13.     /** @ORM\Column(type="integer", nullable=true) */
  14.     protected $activated;
  15.     public function __construct()
  16.     {
  17.         parent::__construct();
  18.         $this->active false;
  19.     }
  20.     /**
  21.      * Set active property
  22.      *
  23.      * @param boolean $active
  24.      * @return AbstractActivatableEntity
  25.      */
  26.     public function setActive($active)
  27.     {
  28.         $this->active = (bool)$active;
  29.         return $this;
  30.     }
  31.     /**
  32.      * Get active property
  33.      *
  34.      * @return boolean
  35.      */
  36.     public function getActive()
  37.     {
  38.         return $this->active;
  39.     }
  40.     /**
  41.      * is this entity active?
  42.      *
  43.      * @return boolean
  44.      */
  45.     public function isActive()
  46.     {
  47.         return $this->active;
  48.     }
  49.     /**
  50.      * Set activated property
  51.      *
  52.      * @param integer $activated
  53.      * @return AbstractActivatableEntity
  54.      */
  55.     public function setActivated($activated null)
  56.     {
  57.         $this->activated $activated;
  58.         return $this;
  59.     }
  60.     /**
  61.      * Get activated
  62.      *
  63.      * @return integer
  64.      */
  65.     public function getActivated()
  66.     {
  67.         return $this->activated;
  68.     }
  69.     /**
  70.      * may the entity be activated?
  71.      *
  72.      * @return boolean
  73.      */
  74.     public function isActivateable()
  75.     {
  76.         return ( ! $this->isActive() );
  77.     }
  78.     /**
  79.      * may the entity be deactivated?
  80.      *
  81.      * @return boolean
  82.      */
  83.     public function isDeactivateable()
  84.     {
  85.         return $this->isActive();
  86.     }
  87. }