Skip to content

Instantly share code, notes, and snippets.

@trq
Forked from kfuchs/Dvd.php
Created May 21, 2014 02:24
Show Gist options
  • Save trq/77831c19dd9125ea3b04 to your computer and use it in GitHub Desktop.
Save trq/77831c19dd9125ea3b04 to your computer and use it in GitHub Desktop.
/**
* Dvd
*
* @ORM\Table(name="dvd")
* @ORM\Entity
*/
class Dvd
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
* @ORM\OneToOne(targetEntity="DvdDescription", mappedBy="dvd")
*/
private $id;
/**
*
* @Assert\Valid
* @Assert\NotBlank()
* @ORM\OneToOne(targetEntity="DvdDescription", mappedBy="dvd", cascade={"persist", "remove"})
*/
private $dvdDescription;
/**
* @return \Doctrine\Common\Collections\ArrayCollection|DvdDescription
*/
public function getDvdDescription()
{
return $this->dvdDescription;
}
/**
* Set Dvd Info
*
* @param DvdDescription $dvdDescription
* @return $this
*/
public function setDvdDescription(DvdDescription $dvdDescription)
{
$dvdDescription->setDvd($this);
$this->dvdDescription = $dvdDescription;
return $this;
}
/**
* DvdDescription
*
* @ORM\Table(name="dvd_description")
* @ORM\Entity
*/
class DvdDescription
{
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=200, nullable=false)
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="description", type="text", nullable=false)
*/
private $description;
/**
* @var \Dvd
*
* @ORM\Id
* @ORM\OneToOne(targetEntity="Dvd", inversedBy="id")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="dvd_id", referencedColumnName="id")
* })
*/
private $dvd;
/**
* Set title
*
* @param string $title
* @return DvdDescription
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set description
*
* @param string $description
* @return DvdDescription
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set dvd
*
* @param $dvd
* @return DvdDescription
*/
public function setDvd(Dvd $dvd)
{
$this->dvd = $dvd;
return $this;
}
/**
* Get dvd
*
* @return Dvd
*/
public function getDvd()
{
return $this->dvd;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment