vendor/crosiersource/crosierlib-base/src/Entity/Logs/Syslog.php line 67

Open in your IDE?
  1. <?php
  2. namespace CrosierSource\CrosierLibBaseBundle\Entity\Logs;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter;
  6. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  7. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  8. use CrosierSource\CrosierLibBaseBundle\Doctrine\Annotations\EntityHandler;
  9. use CrosierSource\CrosierLibBaseBundle\Doctrine\Annotations\NotUppercase;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Symfony\Component\Serializer\Annotation\Groups;
  12. use Symfony\Component\Serializer\Annotation\SerializedName;
  13. /**
  14.  * @ApiResource(
  15.  *     normalizationContext={"groups"={"entity","entityId"},"enable_max_depth"=true},
  16.  *     denormalizationContext={"groups"={"entity"},"enable_max_depth"=true},
  17.  *
  18.  *     itemOperations={
  19.  *          "get"={
  20.  *              "path"="/core/config/syslog/{id}",
  21.  *              "security"="is_granted('ROLE_ADMIN')",
  22.  *              "normalization_context"={"groups"={"entity","entityId", "obs"}},
  23.  *             },
  24.  *          "put"={"path"="/core/config/syslog/{id}", "security"="is_granted('ROLE_ADMIN')"},
  25.  *          "delete"={"path"="/core/config/syslog/{id}", "security"="is_granted('ROLE_ADMIN')"}
  26.  *     },
  27.  *     collectionOperations={
  28.  *          "get"={
  29.  *              "path"="/core/config/syslog",
  30.  *              "security"="is_granted('ROLE_ADMIN')",
  31.  *              "normalization_context"={"groups"={"entity","entityId", "obsp"}},
  32.  *              },
  33.  *          "post"={"path"="/core/config/syslog", "security"="is_granted('ROLE_ADMIN')"}
  34.  *     },
  35.  *
  36.  *     attributes={
  37.  *          "pagination_items_per_page"=10,
  38.  *          "formats"={"jsonld", "csv"={"text/csv"}}
  39.  *     }
  40.  * )
  41.  *
  42.  * @ApiFilter(DateFilter::class, properties={"moment"})
  43.  *
  44.  * @ApiFilter(SearchFilter::class, properties={
  45.  *     "id": "exact",
  46.  *     "app": "exact",
  47.  *     "uuidSess": "exact",
  48.  *     "tipo": "exact",
  49.  *     "component": "partial",
  50.  *     "act": "partial",
  51.  *     "username": "exact",
  52.  *     "obs": "partial"
  53.  * })
  54.  *
  55.  * @ApiFilter(OrderFilter::class, properties={"id", "app", "component", "moment", "updated"}, arguments={"orderParameterName"="order"})
  56.  *
  57.  * @EntityHandler(entityHandlerClass="CrosierSource\CrosierLibBaseBundle\EntityHandler\Config\SyslogHandler")
  58.  * @ORM\Entity(repositoryClass="CrosierSource\CrosierLibBaseBundle\Repository\Config\SyslogRepository")
  59.  * @ORM\Table(name="cfg_syslog")
  60.  *
  61.  * @author Carlos Eduardo Pauluk
  62.  */
  63. class Syslog
  64. {
  65.     /**
  66.      * @ORM\Id()
  67.      * @ORM\GeneratedValue()
  68.      * @ORM\Column(type="bigint")
  69.      * @Groups("entityId")
  70.      * @var null|int
  71.      */
  72.     public ?int $id null;
  73.     /**
  74.      * @ORM\Column(name="uuid_sess", type="string")
  75.      * @Groups("entity")
  76.      * @var string|null
  77.      */
  78.     public ?string $uuidSess null;
  79.     /**
  80.      * @ORM\Column(name="tipo", type="string")
  81.      * @Groups("entity")
  82.      * @var string|null
  83.      */
  84.     public ?string $tipo null;
  85.     /**
  86.      * @ORM\Column(name="app", type="string")
  87.      * @Groups("entity")
  88.      * @var string|null
  89.      */
  90.     public ?string $app null;
  91.     /**
  92.      * @ORM\Column(name="component", type="string")
  93.      * @Groups("entity")
  94.      * @var string|null
  95.      */
  96.     public ?string $component null;
  97.     /**
  98.      * @ORM\Column(name="act", type="string")
  99.      * @Groups("entity")
  100.      * @var string|null
  101.      */
  102.     public ?string $act null;
  103.     /**
  104.      * @ORM\Column(name="username", type="string")
  105.      * @Groups("entity")
  106.      * @NotUppercase()
  107.      * @var string|null
  108.      */
  109.     public ?string $username null;
  110.     /**
  111.      * @ORM\Column(name="moment", type="datetime")
  112.      * @Groups("entity")
  113.      * @var null|\DateTime
  114.      */
  115.     public ?\DateTime $moment null;
  116.     /**
  117.      * @ORM\Column(name="obs", type="string")
  118.      * @Groups("obs")
  119.      * @var string|null
  120.      */
  121.     public ?string $obs null;
  122.     /**
  123.      * @ORM\Column(name="delete_after", type="datetime")
  124.      * @Groups("entityId")
  125.      * @var null|\DateTime
  126.      */
  127.     public ?\DateTime $deleteAfter null;
  128.     /**
  129.      * @ORM\Column(name="json_data", type="json")
  130.      * @var null|array
  131.      * @NotUppercase()
  132.      * @Groups("entity")
  133.      */
  134.     public ?array $jsonData null;
  135.     /**
  136.      * @Groups("obsp")
  137.      * @SerializedName("obs")
  138.      * @var null|string
  139.      */
  140.     public function getObsp(): ?string
  141.     {
  142.         if ($this->obs) {
  143.             if (strlen($this->obs) > 200) {
  144.                 return (substr($this->obs0200) . '...');
  145.             } else {
  146.                 return $this->obs;
  147.             }
  148.         }
  149.         return null;
  150.     }
  151. }