src/Entity/Barcode.php line 9
<?php
namespace App\Entity;
use App\Repository\BarcodeRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: BarcodeRepository::class)]
class Barcode
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(name: 'code', type: 'text', nullable: true)]
private ?string $code;
#[ORM\ManyToOne(targetEntity: 'App\Entity\Products', inversedBy: 'barcode')]
private ?Products $products;
/**
* @return string|null
*/
public function getCode(): ?string
{
return $this->code;
}
/**
* @param string|null $code
*/
public function setCode(?string $code): void
{
$this->code = $code;
}
/**
* @return Products|null
*/
public function getProducts(): ?Products
{
return $this->products;
}
/**
* @param Products|null $products
*/
public function setProducts(?Products $products): void
{
$this->products = $products;
}
public function getId(): ?int
{
return $this->id;
}
public function __toString()
{
return $this->code; //or anything else
}
}