Skip to content

Commit

Permalink
removes doctrine annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristoforo Cervino committed Jun 14, 2024
1 parent dab2499 commit 3d76eb4
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 82 deletions.
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@
"doctrine/doctrine-bundle": "^2.2",
"roave/security-advisories": "dev-master",
"phpunit/phpunit": "^9.5",
"symfony/framework-bundle": "^4.4 | ^5.0",
"symfony/framework-bundle": "^4.4 | ^5.0 | ^6.0 | ^7.0",
"symfony/yaml": "^5.2",
"ext-json": "*",
"friendsofphp/php-cs-fixer": "^3.35",
"doctrine/annotations": "^2.0",
"friendsofphp/php-cs-fixer": "^3.58",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/extension-installer": "^1.3",
Expand Down
2 changes: 1 addition & 1 deletion tests/HttpKernel/config/config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ doctrine:
auto_mapping: true
mappings:
fixtures:
type: annotation
type: attribute
prefix: 'Andante\Doctrine\ORM\Tests\Model'
dir: '%kernel.project_dir%/tests/Model/'
is_bundle: false
18 changes: 6 additions & 12 deletions tests/Model/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,17 @@

namespace Andante\Doctrine\ORM\Tests\Model;

use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity()
*/
#[ORM\Entity]
class Address
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(Types::INTEGER)]
private ?int $id = null;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(Types::STRING, null, null, null, null, false, true)]
private ?string $name = null;

public function getId(): ?int
Expand Down
17 changes: 6 additions & 11 deletions tests/Model/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,18 @@

namespace Andante\Doctrine\ORM\Tests\Model;

use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity()
*/
#[ORM\Entity]
class Document
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(Types::INTEGER)]
private ?int $id = null;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(Types::STRING, null, null, null, null, false, true)]
private ?string $name = null;

public function getId(): ?int
Expand Down
10 changes: 3 additions & 7 deletions tests/Model/Employee.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity()
*/
#[ORM\Entity]
class Employee extends Person
{
/**
* @var Collection<int, Paper>
* @ORM\OneToMany(targetEntity="Paper", mappedBy="employee")
*/
/** @var Collection<int, Paper> */
#[ORM\OneToMany('employee', Paper::class)]

Check failure on line 15 in tests/Model/Employee.php

View workflow job for this annotation

GitHub Actions / check-code-php-8

Parameter #1 $targetEntity of attribute class Doctrine\ORM\Mapping\OneToMany constructor expects class-string|null, string given.
private Collection $papers;

public function __construct()
Expand Down
27 changes: 9 additions & 18 deletions tests/Model/Organization.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,25 @@

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity()
*/
#[ORM\Entity]
class Organization
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(Types::INTEGER)]
private ?int $id = null;

/**
* @ORM\ManyToOne(targetEntity="Address")
*/
#[ORM\ManyToOne(Address::class)]
private ?Address $address = null;

/**
* @var Collection<int, Person>
* @ORM\ManyToMany(targetEntity="Person")
*/
/** @var Collection<int, Person> */
#[ORM\ManyToMany(Person::class)]
private Collection $persons;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(Types::STRING, null, null, null, null, false, true)]
private ?string $name = null;

public function __construct()
Expand Down
27 changes: 9 additions & 18 deletions tests/Model/Paper.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,25 @@

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity()
*/
#[ORM\Entity]
class Paper
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(Types::INTEGER)]
private ?int $id = null;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(Types::STRING, null, null, null, null, false, true)]
private ?string $name = null;

/**
* @var Collection<int, Employee>
* @ORM\OneToMany(targetEntity="Employee", mappedBy="papers")
*/
/** @var Collection<int, Employee> */
#[ORM\OneToMany('papers', Employee::class)]

Check failure on line 24 in tests/Model/Paper.php

View workflow job for this annotation

GitHub Actions / check-code-php-8

Parameter #1 $targetEntity of attribute class Doctrine\ORM\Mapping\OneToMany constructor expects class-string|null, string given.
private Collection $employees;

/**
* @ORM\ManyToOne(targetEntity="Document")
*/
#[ORM\ManyToOne(Document::class)]
private ?Document $document = null;

public function __construct()
Expand Down
19 changes: 7 additions & 12 deletions tests/Model/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,19 @@

namespace Andante\Doctrine\ORM\Tests\Model;

use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity
* @ORM\InheritanceType("JOINED")
*/
#[ORM\Entity]
#[ORM\InheritanceType('JOINED')]
class Person
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(Types::INTEGER)]
private ?int $id = null;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(Types::STRING, null, null, null, null, false, true)]
private ?string $name = null;

public function getId(): ?int
Expand Down

0 comments on commit 3d76eb4

Please sign in to comment.