Skip to content

Commit

Permalink
Finished refactoring entities
Browse files Browse the repository at this point in the history
  • Loading branch information
TomHAnderson committed Mar 2, 2024
1 parent c936383 commit 4ff1454
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 44 deletions.
10 changes: 4 additions & 6 deletions tests/Assets/Entity/FormEntityTarget.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@

use Doctrine\ORM\Mapping as ORM;

/** @ORM\Entity */
#[ORM\Entity]
class FormEntityTarget
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[ORM\Id]
#[ORM\Column(type: 'integer')]
#[ORM\GeneratedValue(strategy: 'AUTO')]
protected int $id;
}
14 changes: 5 additions & 9 deletions tests/Assets/Entity/Issue237.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity
* @ORM\Table(name="doctrine_orm_module_form_entity_issue237")
*/
#[ORM\Entity]
#[ORM\Table(name: 'doctrine_orm_module_form_entity_issue237')]
class Issue237
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
#[ORM\Id]
#[ORM\Column(type: 'integer')]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
protected int $id;
}
25 changes: 9 additions & 16 deletions tests/Assets/Entity/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,21 @@

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity
* @ORM\Table(name="doctrine_orm_module_product")
*/
#[ORM\Entity]
#[ORM\Table(name: 'doctrine_orm_module_product')]
class Product
{
/**
* @ORM\Id
* @ORM\Column(type="integer");
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[ORM\Id]
#[ORM\Column(type: 'integer')]
#[ORM\GeneratedValue(strategy: 'AUTO')]
protected int $id;

/** @ORM\Column(type="string", nullable=true) */
#[ORM\Column(type: 'string', nullable: true)]
protected string $name;

/**
* @ORM\ManyToMany(targetEntity="Category")
*
* @var Category[]
*/
protected array $categories;
/** @var Category[] */
#[ORM\ManyToMany(targetEntity: Category::class)]
private array $categories;

public function getId(): int|null
{
Expand Down
13 changes: 6 additions & 7 deletions tests/Assets/Entity/ResolveTarget.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@

use Doctrine\ORM\Mapping as ORM;

/** @ORM\Entity */
#[ORM\Entity]
class ResolveTarget
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[ORM\Id]
#[ORM\Column(type: 'integer')]
#[ORM\GeneratedValue(strategy: 'AUTO')]
protected int $id;

/** @ORM\OneToOne(targetEntity="Target") */
#[ORM\ManyToOne(targetEntity: Target::class)]
#[ORM\JoinColumn(name: 'target_id', referencedColumnName: 'id')]
protected Target $target;
}
10 changes: 4 additions & 6 deletions tests/Assets/Entity/TargetEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@

use Doctrine\ORM\Mapping as ORM;

/** @ORM\Entity */
#[ORM\Entity]
class TargetEntity implements Target
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[ORM\Id]
#[ORM\Column(type: 'integer')]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private int $id;

public function getId(): int
Expand Down

0 comments on commit 4ff1454

Please sign in to comment.