Skip to content

Instantly share code, notes, and snippets.

@vaneves
Created September 23, 2015 18:11
Show Gist options
  • Save vaneves/aa2b1cc0b1a79f0d5b54 to your computer and use it in GitHub Desktop.
Save vaneves/aa2b1cc0b1a79f0d5b54 to your computer and use it in GitHub Desktop.
Curso Ninja - Classe Post
<?php
namespace App\Entities;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="posts")
**/
class Post
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string")
*/
protected $title;
/**
* @ORM\Column(type="datetime")
*/
protected $date;
/**
* @ORM\Column(type="string")
*/
protected $content;
public function __construct()
{
$this->date = new \DateTime('now');
}
public function getId()
{
return $this->id;
}
public function getTitle()
{
return $this->title;
}
public function setTitle($title)
{
$this->title = $title;
}
public function getDate()
{
return $this->date->format('d/m/Y');
}
public function getContent()
{
return $this->content;
}
public function setContent($content)
{
$this->content = $content;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment