Skip to content

Corrected class name in example #11406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions reference/constraints/UniqueEntity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ between all of the constraints in your user table:

.. code-block:: php-annotations

// src/Entity/Author.php
// src/Entity/User.php
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the "Basic Usage" section User is used.

namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;
Expand All @@ -44,7 +44,7 @@ between all of the constraints in your user table:
* @ORM\Entity
* @UniqueEntity("email")
*/
class Author
class User
{
/**
* @ORM\Column(name="email", type="string", length=255, unique=true)
Expand All @@ -56,7 +56,7 @@ between all of the constraints in your user table:
.. code-block:: yaml

# config/validator/validation.yaml
App\Entity\Author:
App\Entity\User:
constraints:
- Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity: email
properties:
Expand All @@ -71,7 +71,7 @@ between all of the constraints in your user table:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping https://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">

<class name="App\Entity\Author">
<class name="App\Entity\User">
<constraint name="Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity">
<option name="fields">email</option>
</constraint>
Expand All @@ -83,15 +83,15 @@ between all of the constraints in your user table:

.. code-block:: php

// src/Entity/Author.php
// src/Entity/User.php
namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;

// DON'T forget this use statement!!!
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

class Author
class User
{
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
Expand Down