Skip to content

Instantly share code, notes, and snippets.

@anvodev
Created May 12, 2020 18:59
Show Gist options
  • Select an option

  • Save anvodev/b2cd267f44562bcc2e5e94954c651985 to your computer and use it in GitHub Desktop.

Select an option

Save anvodev/b2cd267f44562bcc2e5e94954c651985 to your computer and use it in GitHub Desktop.
Customer Entity with default autogenerate ID
<?php
namespace App\Entity;
use App\Repository\CustomerRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CustomerRepository::class)
*/
class Customer
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment