Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Acme\ProjectBundle\Entity;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * @ORM\Entity
- * @ORM\HasLifecycleCallbacks
- * @ORM\Table(name="projects")
- */
- class Projects
- {
- /**
- * @ORM\Id
- * @ORM\Column(type="integer")
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- protected $id;
- /**
- * @ORM\Column(type="string")
- */
- protected $name;
- /**
- * @ORM\Column(type="datetime")
- */
- protected $created_at;
- /**
- * @ORM\Column(type="datetime")
- */
- protected $modified_at;
- /**
- * Now we tell doctrine that before we persist or update we call the updatedTimestamps() function.
- *
- * @ORM\PrePersist
- * @ORM\PreUpdate
- */
- public function updatedTimestamps()
- {
- $this->setModifiedAt(new \DateTime(date('Y-m-d H:i:s')));
- if($this->getCreatedAt() == null)
- {
- $this->setCreatedAt(new \DateTime(date('Y-m-d H:i:s')));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement