Skip to content

Commit

Permalink
[DoctrineBridge][Validator] Allow validating every class against uniq…
Browse files Browse the repository at this point in the history
…ue entity constraint
  • Loading branch information
wkania authored and fabpot committed May 2, 2024
1 parent 00ca03e commit 29f1511
Show file tree
Hide file tree
Showing 10 changed files with 494 additions and 22 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

7.1
---

* Allow validating every class against `UniqueEntity` constraint

7.0
---

Expand Down
24 changes: 24 additions & 0 deletions Tests/Fixtures/CreateDoubleNameEntity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Bridge\Doctrine\Tests\Fixtures;

class CreateDoubleNameEntity
{
public $primaryName;
public $secondaryName;

public function __construct($primaryName, $secondaryName)
{
$this->primaryName = $primaryName;
$this->secondaryName = $secondaryName;
}
}
17 changes: 17 additions & 0 deletions Tests/Fixtures/Dto.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Bridge\Doctrine\Tests\Fixtures;

class Dto
{
public string $foo;
}
22 changes: 22 additions & 0 deletions Tests/Fixtures/HireAnEmployee.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Bridge\Doctrine\Tests\Fixtures;

class HireAnEmployee
{
public $name;

public function __construct($name)
{
$this->name = $name;
}
}
26 changes: 26 additions & 0 deletions Tests/Fixtures/UpdateCompositeIntIdEntity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Bridge\Doctrine\Tests\Fixtures;

class UpdateCompositeIntIdEntity
{
public $id1;
public $id2;
public $name;

public function __construct($id1, $id2, $name)
{
$this->id1 = $id1;
$this->id2 = $id2;
$this->name = $name;
}
}
44 changes: 44 additions & 0 deletions Tests/Fixtures/UpdateCompositeObjectNoToStringIdEntity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Bridge\Doctrine\Tests\Fixtures;

class UpdateCompositeObjectNoToStringIdEntity
{
/**
* @var SingleIntIdNoToStringEntity
*/
protected $object1;

/**
* @var SingleIntIdNoToStringEntity
*/
protected $object2;

public $name;

public function __construct(SingleIntIdNoToStringEntity $object1, SingleIntIdNoToStringEntity $object2, $name)
{
$this->object1 = $object1;
$this->object2 = $object2;
$this->name = $name;
}

public function getObject1(): SingleIntIdNoToStringEntity
{
return $this->object1;
}

public function getObject2(): SingleIntIdNoToStringEntity
{
return $this->object2;
}
}
24 changes: 24 additions & 0 deletions Tests/Fixtures/UpdateEmployeeProfile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Bridge\Doctrine\Tests\Fixtures;

class UpdateEmployeeProfile
{
public $id;
public $name;

public function __construct($id, $name)
{
$this->id = $id;
$this->name = $name;
}
}
Loading

0 comments on commit 29f1511

Please sign in to comment.