Apply rector rules: add annotation for doctrine mapping

This commit is contained in:
2024-04-05 13:11:42 +02:00
parent a3f775a69b
commit 0ff4593863
118 changed files with 143 additions and 658 deletions

View File

@@ -16,17 +16,14 @@ use Chill\MainBundle\Entity\HasScopesInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
#[ORM\Table('chill_doc.accompanyingcourse_document')]
class AccompanyingCourseDocument extends Document implements HasScopesInterface, HasCentersInterface
{
#[ORM\ManyToOne(targetEntity: AccompanyingPeriod::class)]
#[ORM\JoinColumn(nullable: false)]
private ?AccompanyingPeriod $course = null;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]

View File

@@ -26,8 +26,7 @@ class Document implements TrackCreationInterface, TrackUpdateInterface
use TrackUpdateTrait;
#[ORM\ManyToOne(targetEntity: \Chill\DocStoreBundle\Entity\DocumentCategory::class)]
#[ORM\ManyToOne(targetEntity: DocumentCategory::class)]
#[ORM\JoinColumn(name: 'category_bundle_id', referencedColumnName: 'bundle_id')]
#[ORM\JoinColumn(name: 'category_id_inside_bundle', referencedColumnName: 'id_inside_bundle')]
private ?DocumentCategory $category = null;
@@ -40,10 +39,10 @@ class Document implements TrackCreationInterface, TrackUpdateInterface
#[Assert\Valid]
#[Assert\NotNull(message: 'Upload a document')]
#[ORM\ManyToOne(targetEntity: \Chill\DocStoreBundle\Entity\StoredObject::class, cascade: ['persist'])]
#[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
private ?StoredObject $object = null;
#[ORM\ManyToOne(targetEntity: \Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate::class)]
#[ORM\ManyToOne(targetEntity: DocGeneratorTemplate::class)]
private ?DocGeneratorTemplate $template = null;
#[Assert\Length(min: 2, max: 250)]

View File

@@ -13,7 +13,6 @@ namespace Chill\DocStoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
#[ORM\Table('chill_doc.document_category')]
class DocumentCategory
@@ -33,16 +32,12 @@ class DocumentCategory
*/
public function __construct(
/**
*
*
* @var string The id of the bundle that has create the category (i.e. 'person', 'activity', ....)
*/
#[ORM\Id]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'bundle_id')]
private $bundleId,
/**
*
*
* @var int The id which is unique inside the bundle
*/
#[ORM\Id]

View File

@@ -17,24 +17,22 @@ use Chill\MainBundle\Entity\Scope;
use Chill\PersonBundle\Entity\Person;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
#[ORM\Table('chill_doc.person_document')]
class PersonDocument extends Document implements HasCenterInterface, HasScopeInterface
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\Person::class)]
#[ORM\ManyToOne(targetEntity: Person::class)]
private Person $person;
/**
* @var Scope The document's center
*/
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Scope::class)]
#[ORM\ManyToOne(targetEntity: Scope::class)]
private ?Scope $scope = null;
public function getCenter()

View File

@@ -29,8 +29,6 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* The property `$deleteAt` allow a deletion of the document after the given date. But this property should
* be set before the document is actually written by the StoredObjectManager.
*
*
*
* @AsyncFileExists(
* message="The file is not stored properly"
* )
@@ -52,7 +50,6 @@ class StoredObject implements Document, TrackCreationInterface
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
private string $filename = '';
#[Serializer\Groups(['read', 'write'])]
#[ORM\Id]
#[ORM\GeneratedValue]
@@ -103,7 +100,8 @@ class StoredObject implements Document, TrackCreationInterface
/**
* @param StoredObject::STATUS_* $status
*/
public function __construct(#[Serializer\Groups(['read'])] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => 'ready'])]
public function __construct(
#[Serializer\Groups(['read'])] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => 'ready'])]
private string $status = 'ready'
) {
$this->uuid = Uuid::uuid4();