API improvements (#1826)

This commit is contained in:
Kevin Papst
2020-07-17 20:30:16 +02:00
committed by GitHub
parent 5864c7e127
commit c843dba29a
77 changed files with 1745 additions and 1189 deletions

View File

@@ -11,6 +11,7 @@ namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as Serializer;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
@@ -22,21 +23,32 @@ use Symfony\Component\Validator\Constraints as Assert;
* )
* @ORM\Entity(repositoryClass="App\Repository\TagRepository")
* @UniqueEntity("name")
*
* @Serializer\ExclusionPolicy("all")
*/
class Tag
{
/**
* The internal ID
*
* @var int
*
* @Serializer\Expose()
* @Serializer\Groups({"Default"})
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* The tag name
*
* @var string
*
* @Serializer\Expose()
* @Serializer\Groups({"Default"})
*
* @ORM\Column(name="name", type="string", length=100, nullable=false)
* @Assert\NotBlank()
* @Assert\Length(min=2, max=100, allowEmptyString=false)
@@ -49,9 +61,11 @@ class Tag
/**
* @var Timesheet[]|ArrayCollection
*
* @Serializer\Exclude()
*
* @ORM\ManyToMany(targetEntity="Timesheet", mappedBy="tags", fetch="EXTRA_LAZY")
*/
protected $timesheets;
private $timesheets;
public function __construct()
{