generated from ConductionNL/Proto-component-commonground
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added Label entity & updated modelio
- Loading branch information
1 parent
23c5f16
commit 3aa6a5b
Showing
8 changed files
with
2,454 additions
and
835 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,219 @@ | ||
<?php | ||
|
||
namespace App\Entity; | ||
|
||
use ApiPlatform\Core\Annotation\ApiResource; | ||
use ApiPlatform\Core\Annotation\ApiFilter; | ||
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter; | ||
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter; | ||
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter; | ||
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter; | ||
|
||
use Doctrine\Common\Collections\ArrayCollection; | ||
use Gedmo\Mapping\Annotation as Gedmo; | ||
use Doctrine\ORM\Mapping as ORM; | ||
use Symfony\Component\Serializer\Annotation\Groups; | ||
use Symfony\Component\Validator\Constraints as Assert; | ||
use Symfony\Component\Serializer\Annotation\MaxDepth; | ||
use Ramsey\Uuid\Uuid; | ||
use Ramsey\Uuid\UuidInterface; | ||
|
||
/** | ||
* @ApiResource( | ||
* normalizationContext={"groups"={"read"}, "enable_max_depth"=true}, | ||
* denormalizationContext={"groups"={"write"}, "enable_max_depth"=true} | ||
* | ||
* ) | ||
* | ||
* @ORM\Entity(repositoryClass="App\Repository\LabelRepository") | ||
* @Gedmo\Loggable(logEntryClass="App\Entity\ChangeLog") | ||
* | ||
* @ApiFilter(BooleanFilter::class) | ||
* @ApiFilter(OrderFilter::class) | ||
* @ApiFilter(DateFilter::class, strategy=DateFilter::EXCLUDE_NULL) | ||
* @ApiFilter(SearchFilter::class) | ||
*/ | ||
class Label | ||
{ | ||
/** | ||
* @var UuidInterface The UUID identifier of this object | ||
* | ||
* @example e2984465-190a-4562-829e-a8cca81aa35d | ||
* | ||
* @Groups({"read"}) | ||
* @Assert\Uuid | ||
* @ORM\Id | ||
* @ORM\Column(type="uuid", unique=true) | ||
* @ORM\GeneratedValue(strategy="CUSTOM") | ||
* @ORM\CustomIdGenerator(class="Ramsey\Uuid\Doctrine\UuidGenerator") | ||
*/ | ||
private $id; | ||
|
||
/** | ||
* @var string Name of the label | ||
* | ||
* @example Label | ||
* @Groups({"read", "write"}) | ||
* @ORM\Column(type="string", length=2550) | ||
* @Assert\Length( | ||
* max = 255 | ||
* ) | ||
* @Assert\NotNull | ||
*/ | ||
private $name; | ||
|
||
/** | ||
* @var string Description of the label | ||
* | ||
* @example label description | ||
* @Groups({"read", "write"}) | ||
* @ORM\Column(type="string", length=255) | ||
* @Assert\Length( | ||
* max = 2550 | ||
* ) | ||
* @Assert\NotNull | ||
*/ | ||
private $description; | ||
|
||
/** | ||
* @var string Color of the label | ||
* | ||
* @example red | ||
* @Groups({"read", "write"}) | ||
* @ORM\Column(type="string", length=2550) | ||
* @Assert\Length( | ||
* max = 255 | ||
* ) | ||
* @Assert\NotNull | ||
*/ | ||
private $color; | ||
|
||
/** | ||
* @var string icon of the label | ||
* | ||
* @example url of icon | ||
* @Groups({"read", "write"}) | ||
* @ORM\Column(type="string", length=2550) | ||
* @Assert\Length( | ||
* max = 255 | ||
* ) | ||
* @Assert\NotNull | ||
*/ | ||
private $icon; | ||
|
||
/** | ||
* @var request The request this submitter belongs to | ||
* | ||
* @Groups({"read","write"}) | ||
* @MaxDepth(1) | ||
* @ORM\ManyToOne(targetEntity="App\Entity\Request", inversedBy="labels") | ||
*/ | ||
private $request; | ||
|
||
/** | ||
* @var Datetime $dateCreated The moment this resource was created | ||
* | ||
* @Groups({"read"}) | ||
* @Gedmo\Timestampable(on="create") | ||
* @ORM\Column(type="datetime", nullable=true) | ||
*/ | ||
private $dateCreated; | ||
|
||
/** | ||
* @var Datetime $dateModified The moment this resource last Modified | ||
* | ||
* @Groups({"read"}) | ||
* @Gedmo\Timestampable(on="update") | ||
* @ORM\Column(type="datetime", nullable=true) | ||
*/ | ||
private $dateModified; | ||
|
||
public function getId() | ||
{ | ||
return $this->id; | ||
} | ||
|
||
public function getName(): ?string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
public function setName(string $name): self | ||
{ | ||
$this->name = $name; | ||
|
||
return $this; | ||
} | ||
|
||
public function getDescription(): ?string | ||
{ | ||
return $this->description; | ||
} | ||
|
||
public function setDescription(string $description): self | ||
{ | ||
$this->description = $description; | ||
|
||
return $this; | ||
} | ||
|
||
public function getColor(): ?string | ||
{ | ||
return $this->color; | ||
} | ||
|
||
public function setColor(string $color): self | ||
{ | ||
$this->color = $color; | ||
|
||
return $this; | ||
} | ||
|
||
public function getIcon(): ?string | ||
{ | ||
return $this->icon; | ||
} | ||
|
||
public function setIcon(string $icon): self | ||
{ | ||
$this->icon = $icon; | ||
|
||
return $this; | ||
} | ||
|
||
public function getRequest(): ?Request | ||
{ | ||
return $this->request; | ||
} | ||
|
||
public function setRequest(?Request $request): self | ||
{ | ||
$this->request = $request; | ||
|
||
return $this; | ||
} | ||
|
||
public function getDateCreated(): ?\DateTimeInterface | ||
{ | ||
return $this->dateCreated; | ||
} | ||
|
||
public function setDateCreated(\DateTimeInterface $dateCreated): self | ||
{ | ||
$this->dateCreated= $dateCreated; | ||
|
||
return $this; | ||
} | ||
|
||
public function getDateModified(): ?\DateTimeInterface | ||
{ | ||
return $this->dateModified; | ||
} | ||
|
||
public function setDateModified(\DateTimeInterface $dateModified): self | ||
{ | ||
$this->dateModified = $dateModified; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace App\Repository; | ||
|
||
use App\Entity\Label; | ||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; | ||
use Doctrine\Persistence\ManagerRegistry; | ||
|
||
/** | ||
* @method Label|null find($id, $lockMode = null, $lockVersion = null) | ||
* @method Label|null findOneBy(array $criteria, array $orderBy = null) | ||
* @method Label[] findAll() | ||
* @method Label[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) | ||
*/ | ||
class LabelRepository extends ServiceEntityRepository | ||
{ | ||
public function __construct(ManagerRegistry $registry) | ||
{ | ||
parent::__construct($registry, Label::class); | ||
} | ||
|
||
// /** | ||
// * @return Label[] Returns an array of Label objects | ||
// */ | ||
/* | ||
public function findByExampleField($value) | ||
{ | ||
return $this->createQueryBuilder('l') | ||
->andWhere('l.exampleField = :val') | ||
->setParameter('val', $value) | ||
->orderBy('l.id', 'ASC') | ||
->setMaxResults(10) | ||
->getQuery() | ||
->getResult() | ||
; | ||
} | ||
*/ | ||
|
||
/* | ||
public function findOneBySomeField($value): ?Label | ||
{ | ||
return $this->createQueryBuilder('l') | ||
->andWhere('l.exampleField = :val') | ||
->setParameter('val', $value) | ||
->getQuery() | ||
->getOneOrNullResult() | ||
; | ||
} | ||
*/ | ||
} |