for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Zenstruck\Foundry\Tests\Fixtures\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*/
class Comment
{
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
private $id;
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
private $user;
* @ORM\Column(type="text")
private $body;
* @ORM\Column(type="datetime")
private $createdAt;
* @ORM\ManyToOne(targetEntity=Post::class, inversedBy="comments")
private $post;
* @ORM\Column(type="boolean")
private $approved = false;
public function __construct(User $user, string $body)
$this->user = $user;
$this->body = $body;
$this->createdAt = new \DateTime('now');
}
public function getId(): ?int
return $this->id;
public function getUser(): User
return $this->user;
public function getBody(): ?string
return $this->body;
public function setBody(string $body): self
return $this;
public function getCreatedAt(): ?\DateTimeInterface
return $this->createdAt;
public function setCreatedAt(\DateTimeInterface $createdAt): self
$this->createdAt = $createdAt;
public function getPost(): ?Post
return $this->post;
public function setPost(?Post $post): self
$this->post = $post;
public function getApproved(): ?bool
return $this->approved;
public function setApproved(bool $approved): self
$this->approved = $approved;