src/Entity/Service.php line 20

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by simpson <simpsonwork@gmail.com>
  4.  * Date: 2019-03-19
  5.  * Time: 17:50
  6.  */
  7. namespace App\Entity;
  8. use AngelGamez\TranslatableBundle\Entity\TranslatableValue;
  9. //use ApiPlatform\Core\Annotation\ApiResource;
  10. use App\Repository\ServiceRepository;
  11. use Symfony\Component\Serializer\Annotation\Groups;
  12. use Doctrine\ORM\Mapping as ORM;
  13. #[ORM\Table(name'services')]
  14. #[ORM\Entity(repositoryClassServiceRepository::class)]
  15. #[ORM\Cache(usage'NONSTRICT_READ_WRITE'region'profiles')]
  16. class Service
  17. {
  18.     #[ORM\Id]
  19.     #[ORM\Column(name'id'type'smallint')]
  20.     #[ORM\GeneratedValue(strategy'AUTO')]
  21.     #[Groups(['preview''listing'])]
  22.     protected int $id;
  23.     #[ORM\Column(name'`group`'type'smallint')]
  24.     #[Groups(['preview''listing'])]
  25.     protected int $group;
  26.     #[ORM\Column(name'name'type'translatable')]
  27.     #[Groups(['preview''listing'])]
  28.     protected TranslatableValue $name;
  29.     #[ORM\Column(name'uri_identity'type'string'length128)]
  30.     #[Groups(['preview''listing'])]
  31.     protected string $uriIdentity;
  32.     #[ORM\Column(name'sort'type'smallint')]
  33.     #[Groups(['preview''listing'])]
  34.     protected int $sort;
  35.     public function __construct(TranslatableValue $namestring $uriIdentityint $groupint $sort)
  36.     {
  37.         $this->group $group;
  38.         $this->name $name;
  39.         $this->uriIdentity $uriIdentity;
  40.         $this->sort $sort;
  41.     }
  42.     public function getId(): int
  43.     {
  44.         return $this->id;
  45.     }
  46.     public function getGroup(): int
  47.     {
  48.         return $this->group;
  49.     }
  50.     public function getName(): TranslatableValue
  51.     {
  52.         return $this->name;
  53.     }
  54.     public function getUriIdentity(): string
  55.     {
  56.         return $this->uriIdentity;
  57.     }
  58.     public function sync(TranslatableValue $nameint $groupint $sort): void
  59.     {
  60.         $this->name $name;
  61.         $this->group $group;
  62.         $this->sort $sort;
  63.     }
  64.     public function update(TranslatableValue $namestring $uriIdentityint $group): void
  65.     {
  66.         $this->name $name;
  67.         $this->uriIdentity $uriIdentity;
  68.         $this->group $group;
  69.     }
  70.     public function getSort(): int
  71.     {
  72.         return $this->sort;
  73.     }
  74.     public function setSort(int $sort): void
  75.     {
  76.         $this->sort $sort;
  77.     }
  78. }