← Back
Editing: Note.php
<?php namespace App\Entity; use App\Repository\NoteRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping\UniqueConstraint; use Symfony\Component\Validator\Constraints as Assert; /** * Note. */ #[ORM\Table(name: 'note')] #[ORM\Index(columns: ['item_id'], name: 'item_id')] #[ORM\Index(columns: ['controle_id'], name: 'controls_id')] #[UniqueConstraint(name: 'control_items_idx', columns: ['controle_id', 'item_id'])] #[ORM\Entity(repositoryClass: NoteRepository::class)] class Note { #[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Id] #[ORM\GeneratedValue(strategy: 'IDENTITY')] private ?int $id = null; #[ORM\Column(name: 'note', type: 'integer', nullable: true)] #[Assert\Type(type: 'integer')] private ?int $note = null; #[ORM\Column(name: 'commentaire', type: 'string', length: 255, nullable: true)] private ?string $commentaire = null; #[ORM\Column(name: 'photo', type: 'text', length: 0, nullable: true)] private ?string $photo = null; #[ORM\Column(name: 'checked', type: 'boolean', nullable: false, options: ['default' => 1])] #[Assert\Type(type: 'bool')] private bool $checked = true; #[ORM\JoinColumn(name: 'controle_id', referencedColumnName: 'id', onDelete: 'CASCADE')] #[ORM\ManyToOne(targetEntity: Controle::class, cascade: ['persist'], inversedBy: 'notes')] private Controle $controle; #[ORM\JoinColumn(name: 'item_id', referencedColumnName: 'id')] #[ORM\ManyToOne(targetEntity: 'Item', inversedBy: 'notes')] private ?Item $item = null; #[ORM\OneToMany(mappedBy: 'note', targetEntity: Picture::class, cascade: ['persist'])] private Collection $pictures; public function __construct() { $this->pictures = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getNote(): ?int { return $this->note; } public function setNote(?int $note): self { $this->note = $note; return $this; } public function getCommentaire(): ?string { return $this->commentaire; } public function setCommentaire(?string $commentaire): self { $this->commentaire = $commentaire; return $this; } public function getPhoto(): ?string { return $this->photo; } public function setPhoto(?string $photo): self { $this->photo = $photo; return $this; } public function getChecked(): ?bool { return $this->checked; } public function setChecked(bool $checked): self { $this->checked = $checked; return $this; } public function getControle(): ?Controle { return $this->controle; } public function setControle(Controle $controle): self { $this->controle = $controle; return $this; } public function getItem(): ?Item { return $this->item; } public function setItem(?Item $item): self { $this->item = $item; return $this; } public function getPictures(): Collection { return $this->pictures; } public function addPicture(Picture $picture): self { if (!$this->pictures->contains($picture)) { $this->pictures[] = $picture; $picture->setNote($this); } return $this; } public function removePicture(Picture $picture): self { if ($this->pictures->removeElement($picture)) { // set the owning side to null (unless already changed) if ($picture->getNote() === $this) { $picture->setNote(null); } } return $this; } public function isChecked(): ?bool { return $this->checked; } }
Save File
Cancel