Skip to content

Instantly share code, notes, and snippets.

@ABM-Dan
Created January 18, 2016 23:27
Show Gist options
  • Save ABM-Dan/6727adbb8f3768a42f52 to your computer and use it in GitHub Desktop.
Save ABM-Dan/6727adbb8f3768a42f52 to your computer and use it in GitHub Desktop.
<?php
namespace MyBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* MyEntity.
*
* @ORM\Table("my_table")
* @ORM\Entity
* @ORM\HasLifecycleCallbacks()
* @UniqueEntity({"title", "customer_id"})
*/
class MyEntity
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
*/
private $id;
/**
* @var int
*
* @ORM\Column(name="customer_id", type="integer", length=15)
*/
private $customer_id;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=40)
* @Assert\NotBlank()
*/
private $title;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set id.
*
* @param int $id
*
* @return MyEntity
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* Get customer_id.
*
* @return int
*/
public function getCustomerId()
{
return $this->customer_id;
}
/**
* Set customer_id.
*
* @param int $customerId
*
* @return MyEntity
*/
public function setCustomerId($customerId)
{
$this->customer_id = $customerId;
return $this;
}
/**
* Get title.
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set title.
*
* @param string $title
*
* @return MyEntity
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment