Apply rector rules: add annotation for doctrine mapping

This commit is contained in:
2024-04-05 00:01:30 +02:00
parent 579bd829f8
commit 72016e1a21
124 changed files with 1724 additions and 3770 deletions

View File

@@ -16,69 +16,49 @@ use Doctrine\ORM\Mapping as ORM;
/**
* CustomField.
*
* @ORM\Entity
*
* @ORM\Table(name="customfield")
*
* @ORM\HasLifecycleCallbacks
*/
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'customfield')]
class CustomField
{
final public const ONE_TO_MANY = 2;
final public const ONE_TO_ONE = 1;
/**
* @ORM\Column(type="boolean")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $active = true;
/**
* @ORM\ManyToOne(
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldsGroup",
* inversedBy="customFields")
*/
#[ORM\ManyToOne(targetEntity: \Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class, inversedBy: 'customFields')]
private ?CustomFieldsGroup $customFieldGroup = null;
/**
* @ORM\Id
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null;
/**
* @var array
*
* @ORM\Column(type="json")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private $name;
/**
* @ORM\Column(type="json")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $options = [];
/**
* @ORM\Column(type="float")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
private ?float $ordering = null;
/**
* @ORM\Column(type="boolean")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private false $required = false;
/**
* @ORM\Column(type="string", length=255)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
private ?string $slug = null;
/**
* @ORM\Column(type="string", length=255)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
private ?string $type = null;
/**

View File

@@ -15,61 +15,41 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(
* repositoryClass="Chill\CustomFieldsBundle\EntityRepository\CustomFieldLongChoice\OptionRepository")
*
* @ORM\Table(name="custom_field_long_choice_options")
*/
#[ORM\Entity(repositoryClass: \Chill\CustomFieldsBundle\EntityRepository\CustomFieldLongChoice\OptionRepository::class)]
#[ORM\Table(name: 'custom_field_long_choice_options')]
class Option
{
/**
* @ORM\Column(type="boolean")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $active = true;
/**
* @var Collection<Option>
*
* @ORM\OneToMany(
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option",
* mappedBy="parent")
*/
#[ORM\OneToMany(targetEntity: \Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option::class, mappedBy: 'parent')]
private Collection $children;
/**
* @ORM\Id
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null;
/**
* @ORM\Column(type="string", length=50, name="internal_key")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 50, name: 'internal_key')]
private string $internalKey = '';
/**
* @ORM\Column(type="string", length=15)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 15)]
private ?string $key = null;
/**
* @ORM\ManyToOne(
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option",
* inversedBy="children")
*
* @ORM\JoinColumn(nullable=true)
*/
#[ORM\ManyToOne(targetEntity: \Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option::class, inversedBy: 'children')]
#[ORM\JoinColumn(nullable: true)]
private ?Option $parent = null;
/**
* A json representation of text (multilingual).
*
* @ORM\Column(type="json")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private ?array $text = null;
public function __construct()

View File

@@ -16,37 +16,23 @@ use Doctrine\ORM\Mapping as ORM;
/**
* CustomFieldsDefaultGroup.
*
* @ORM\Entity
*
* @ORM\Table(
* name="customfieldsdefaultgroup",
* uniqueConstraints={@ORM\UniqueConstraint(
* name="unique_entity",
* columns={"entity"}
* )})
*/
#[ORM\Entity]
#[ORM\Table(name: 'customfieldsdefaultgroup')]
#[ORM\UniqueConstraint(name: 'unique_entity', columns: ['entity'])]
class CustomFieldsDefaultGroup
{
/**
* @ORM\ManyToOne(
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldsGroup")
*
* sf4 check: option inversedBy="customFields" return inconsistent error mapping !!
*/
#[ORM\ManyToOne(targetEntity: \Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)] // sf4 check: option inversedBy="customFields" return inconsistent error mapping !!
private ?CustomFieldsGroup $customFieldsGroup = null;
/**
* @ORM\Column(type="string", length=255)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
private ?string $entity = null;
/**
* @ORM\Id
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null;
/**

View File

@@ -18,10 +18,10 @@ use Doctrine\ORM\Mapping as ORM;
/**
* CustomFieldGroup.
*
* @ORM\Entity
*
* @ORM\Table(name="customfieldsgroup")
*/
#[ORM\Entity]
#[ORM\Table(name: 'customfieldsgroup')]
class CustomFieldsGroup
{
/**
@@ -36,38 +36,28 @@ class CustomFieldsGroup
*
* @var Collection<CustomField>
*
* @ORM\OneToMany(
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomField",
* mappedBy="customFieldGroup")
*
* @ORM\OrderBy({"ordering": "ASC"})
*/
#[ORM\OneToMany(targetEntity: \Chill\CustomFieldsBundle\Entity\CustomField::class, mappedBy: 'customFieldGroup')]
#[ORM\OrderBy(['ordering' => \Doctrine\Common\Collections\Criteria::ASC])]
private Collection $customFields;
/**
* @ORM\Column(type="string", length=255)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
private ?string $entity = null;
/**
* @ORM\Id
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null;
/**
* @var array
*
* @ORM\Column(type="json")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private $name;
/**
* @ORM\Column(type="json")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $options = [];
/**