mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-04 20:39:40 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -17,19 +17,21 @@ use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use UnexpectedValueException;
|
||||
|
||||
/**
|
||||
* **About denormalization**: this operation is operated by @see{AccompanyingPeriodResourdeNormalizer}.
|
||||
*
|
||||
* @ORM\Entity
|
||||
*
|
||||
* @ORM\Table(
|
||||
* name="chill_person_accompanying_period_resource",
|
||||
* uniqueConstraints={
|
||||
*
|
||||
* @ORM\UniqueConstraint(name="person_unique", columns={"person_id", "accompanyingperiod_id"}),
|
||||
* @ORM\UniqueConstraint(name="thirdparty_unique", columns={"thirdparty_id", "accompanyingperiod_id"})
|
||||
* }
|
||||
* )
|
||||
*
|
||||
* @DiscriminatorMap(typeProperty="type", mapping={
|
||||
* "accompanying_period_resource": Resource::class
|
||||
* })
|
||||
@@ -41,34 +43,43 @@ class Resource
|
||||
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod",
|
||||
* inversedBy="resources"
|
||||
* )
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
private ?AccompanyingPeriod $accompanyingPeriod = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private ?string $comment = '';
|
||||
|
||||
/**
|
||||
* @ORM\Id
|
||||
*
|
||||
* @ORM\GeneratedValue
|
||||
*
|
||||
* @ORM\Column(type="integer")
|
||||
*
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Person::class)
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
private ?Person $person = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
private ?ThirdParty $thirdParty = null;
|
||||
@@ -113,7 +124,7 @@ class Resource
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setComment(?string $comment = null): self
|
||||
public function setComment(string $comment = null): self
|
||||
{
|
||||
$this->comment = (string) $comment;
|
||||
|
||||
@@ -135,12 +146,7 @@ class Resource
|
||||
$this->setPerson(null);
|
||||
$this->setThirdParty(null);
|
||||
} else {
|
||||
throw new UnexpectedValueException(sprintf(
|
||||
'the resource ' .
|
||||
'should be an instance of %s or %s',
|
||||
Person::class,
|
||||
ThirdParty::class
|
||||
));
|
||||
throw new \UnexpectedValueException(sprintf('the resource should be an instance of %s or %s', Person::class, ThirdParty::class));
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
Reference in New Issue
Block a user