Skip to content

Instantly share code, notes, and snippets.

@o
Created January 5, 2016 12:28
Show Gist options
  • Save o/cad0af642a9796fb90f0 to your computer and use it in GitHub Desktop.
Save o/cad0af642a9796fb90f0 to your computer and use it in GitHub Desktop.
Sample Symfony Entity
<?php
namespace __
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\UniqueConstraint;
/**
* Post
*
* @ORM\Table(name="posts",uniqueConstraints={@UniqueConstraint(columns={"slug"})})
* @ORM\Entity()
*/
class Post
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=255)
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="content", type="text")
*/
private $content;
/**
* @var string
*
* @ORM\Column(name="slug", type="string", length=255)
*/
private $slug;
/**
* @var \DateTime
*
* @ORM\Column(name="created_at", type="datetime")
*/
private $createdAt;
/**
* @var \DateTime
*
* @ORM\Column(name="published_at", type="datetime")
*/
private $publishedAt;
/**
* @var boolean
*
* @ORM\Column(name="is_active", type="boolean")
*/
private $isActive;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set title
*
* @param string $title
* @return Post
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set content
*
* @param string $content
* @return Post
*/
public function setContent($content)
{
$this->content = $content;
return $this;
}
/**
* Get content
*
* @return string
*/
public function getContent()
{
return $this->content;
}
/**
* Set slug
*
* @param string $slug
* @return Post
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
* @return Post
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set publishedAt
*
* @param \DateTime $publishedAt
* @return Post
*/
public function setPublishedAt($publishedAt)
{
$this->publishedAt = $publishedAt;
return $this;
}
/**
* Get publishedAt
*
* @return \DateTime
*/
public function getPublishedAt()
{
return $this->publishedAt;
}
/**
* Set isActive
*
* @param boolean $isActive
* @return Post
*/
public function setIsActive($isActive)
{
$this->isActive = $isActive;
return $this;
}
/**
* Get isActive
*
* @return boolean
*/
public function getIsActive()
{
return $this->isActive;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment