Improved serialized fields

This commit is contained in:
Jan Böhmer 2023-03-12 01:12:35 +01:00
parent b99e6c9a21
commit 2c67586873
18 changed files with 84 additions and 1 deletions

View file

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace App\Entity\Base;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use function is_string;
use Symfony\Component\Validator\Constraints as Assert;
@ -36,18 +37,21 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
/**
* @var string The address of the company
* @ORM\Column(type="string")
* @Groups({"full"})
*/
protected string $address = '';
/**
* @var string The phone number of the company
* @ORM\Column(type="string")
* @Groups({"full"})
*/
protected string $phone_number = '';
/**
* @var string The fax number of the company
* @ORM\Column(type="string")
* @Groups({"full"})
*/
protected string $fax_number = '';
@ -55,6 +59,7 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
* @var string The email address of the company
* @ORM\Column(type="string")
* @Assert\Email()
* @Groups({"full"})
*/
protected string $email_address = '';
@ -62,6 +67,7 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
* @var string The website of the company
* @ORM\Column(type="string")
* @Assert\Url()
* @Groups({"full"})
*/
protected string $website = '';

View file

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace App\Entity\Base;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* Class PartsContainingDBElement.
@ -31,4 +32,6 @@ use Doctrine\ORM\Mapping as ORM;
*/
abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement
{
/** @Groups({"full"}) */
protected $parameters;
}

View file

@ -63,7 +63,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
/**
* @var string The comment info for this element
* @ORM\Column(type="text")
* @Groups({"simple", "extended", "full"})
* @Groups({"full"})
*/
protected string $comment = '';
@ -71,6 +71,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
* @var bool If this property is set, this element can not be selected for part properties.
* Useful if this element should be used only for grouping, sorting.
* @ORM\Column(type="boolean")
* @Groups({"full"})
*/
protected bool $not_selectable = false;