Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Entities;
- /**
- * @Entity
- * @Table(name="user")
- */
- class User
- {
- /**
- * @Id @Column(type="integer")
- * @GeneratedValue
- */
- private $id;
- /** @Column(type="text") */
- private $name;
- /**
- * @ManyToMany(targetEntity="Comment")
- * @JoinTable(name="user_comment",
- * joinColumns={@JoinColumn(name="user_id", referencedColumnName="id")},
- * inverseJoinColumns={@JoinColumn(name="comment_id", referencedColumnName="id")}
- * )
- */
- private $comments;
- public function __construct()
- {
- $this->comments = new \Doctrine\Common\Collections\ArrayCollection;
- }
- public function getId()
- {
- return $this->id;
- }
- public function setId($value)
- {
- $this->id = $value;
- return $this;
- }
- public function getComments()
- {
- return $this->comments;
- }
- public function getName()
- {
- return $this->name;
- }
- public function setName($value)
- {
- $this->name = $value;
- return $this;
- }
- }
- <?php
- namespace Entities;
- /**
- * @Entity
- * @Table(name="comment")
- */
- class Comment
- {
- /**
- * @Id @Column(type="integer")
- * @GeneratedValue
- */
- private $id;
- /** @Column(type="text") */
- private $text;
- public function getId()
- {
- return $this->id;
- }
- public function setId($value)
- {
- $this->id = $value;
- return $this;
- }
- public function getText()
- {
- return $this->text;
- }
- public function setText($value)
- {
- $this->text = $value;
- return $this;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement