自分用。
namespaceはお好きに。(てか任意の位置に)
Gedmo\Timestampableを使っているので各エンティティからuseすること。
namespace Hoge\FugaBundle\Traits; trait EntityCommonProperties { /** * @var smallint * * @ORM\Column(name="status", type="smallint", options={"unsigned"=true}) */ protected $status = 1; /** * @var \DateTime * * @ORM\Column(name="created_at", type="datetime") * @Gedmo\Timestampable(on="create") */ protected $createdAt; /** * @var \DateTime * * @Gedmo\Timestampable(on="update") * @ORM\Column(name="updated_at", type="datetime", nullable=true) */ protected $updatedAt; /** * @var \DateTime * * @ORM\Column(name="deleted_at", type="datetime", nullable=true) */ protected $deletedAt; /** * @var integer * * @ORM\Column(name="created_uid", type="integer", nullable=true) */ protected $createdUid; /** * @var integer * * @ORM\Column(name="updated_uid", type="integer", nullable=true) */ protected $updatedUid; /** * @var integer * * @ORM\Column(name="deleted_uid", type="integer", nullable=true) */ protected $deletedUid; /** * Set status * * @param integer $status */ public function setStatus($status) { $this->status = $status; return $this; } /** * Get status * */ public function getStatus() { return $this->status; } /** * Set createdAt * * @param \DateTime $createdAt */ public function setCreatedAt($createdAt) { $this->createdAt = $createdAt; return $this; } /** * Get createdAt * */ public function getCreatedAt() { return $this->createdAt; } /** * Set updatedAt * * @param \DateTime $updatedAt */ public function setUpdatedAt($updatedAt) { $this->updatedAt = $updatedAt; return $this; } /** * Get updatedAt * */ public function getUpdatedAt() { return $this->updatedAt; } /** * Set deletedAt * * @param \DateTime $deletedAt */ public function setDeletedAt($deletedAt) { $this->deletedAt = $deletedAt; return $this; } /** * Get deletedAt * */ public function getDeletedAt() { return $this->deletedAt; } /** * Set createdUid * * @param integer $createdUid */ public function setCreatedUid($createdUid) { $this->createdUid = $createdUid; return $this; } /** * Get createdUid * */ public function getCreatedUid() { return $this->createdUid; } /** * Set updatedUid * * @param integer $updatedUid */ public function setUpdatedUid($updatedUid) { $this->updatedUid = $updatedUid; return $this; } /** * Get updatedUid * */ public function getUpdatedUid() { return $this->updatedUid; } /** * Set deletedUid * * @param integer $deletedUid */ public function setDeletedUid($deletedUid) { $this->deletedUid = $deletedUid; return $this; } /** * Get deletedUid * */ public function getDeletedUid() { return $this->deletedUid; } }