Skip to content

Instantly share code, notes, and snippets.

@lbarulski
Created February 15, 2017 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lbarulski/8cb2c3034a4fcae31f7920277efa2c30 to your computer and use it in GitHub Desktop.
Save lbarulski/8cb2c3034a4fcae31f7920277efa2c30 to your computer and use it in GitHub Desktop.
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Answer
* @ORM\Table(name="answer")
*/
class Answer
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
*/
private $id;
/**
* @ORM\Column(name="content", type="string", nullable=false)
*/
private $content;
/**
* @ORM\OneToOne(targetEntity="AppBundle\Entity\Question", inversedBy="answer")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="question_id", referencedColumnName="id", unique=true)
* })
*/
private $question;
/**
* Get id
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* Set content
*
* @param string $content
*
* @return Answer
*/
public function setContent($content)
{
$this->content = $content;
return $this;
}
/**
* Get content
* @return string
*/
public function getContent()
{
return $this->content;
}
/**
* Set question
*
* @param Question $question
*
* @return Answer
*/
public function setQuestion(Question $question = null)
{
$this->question = $question;
return $this;
}
/**
* Get question
* @return Question
*/
public function getQuestion()
{
return $this->question;
}
}
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="question")
*/
class Question
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
*/
private $id;
/**
* @ORM\Column(name="content", type="string", nullable=true)
*/
private $content;
/**
* @ORM\OneToOne(targetEntity="AppBundle\Entity\Answer", mappedBy="question")
*/
private $answer;
/**
* Set content
*
* @param string $content
*
* @return Question
*/
public function setContent($content)
{
$this->content = $content;
return $this;
}
/**
* Get content
* @return string
*/
public function getContent()
{
return $this->content;
}
/**
* Get id
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* Set answer
*
* @param Answer $answer
*
* @return Question
*/
public function setAnswer(Answer $answer = null)
{
$this->answer = $answer;
return $this;
}
/**
* Get answer
* @return Answer
*/
public function getAnswer()
{
return $this->answer;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment