Skip to content
Merged
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
13 changes: 5 additions & 8 deletions reference/constraints/Traverse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,30 +94,27 @@ that all have constraints on their properties.
// src/Entity/BookCollection.php
namespace App\Entity;

use App\Entity\Book;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

/**
* @ORM\Entity
*/
#[ORM\Entity]
#[Assert\Traverse]
class BookCollection implements \IteratorAggregate
{
/**
* @var string
*
* @ORM\Column
*/
#[ORM\Column]
#[Assert\NotBlank]
protected $name = '';

/**
* @var Collection|Book[]
*
* @ORM\ManyToMany(targetEntity="App\Entity\Book")
*/
#[ORM\ManyToMany(targetEntity: Book::class)]
protected $books;

// some other properties
Expand Down