Skip to content

Instantly share code, notes, and snippets.

@kfuchs
Created May 21, 2014 01:24
Show Gist options
  • Save kfuchs/08faaebdeffe654e7765 to your computer and use it in GitHub Desktop.
Save kfuchs/08faaebdeffe654e7765 to your computer and use it in GitHub Desktop.

Revisions

  1. kfuchs revised this gist May 21, 2014. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion Dvd.php
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,6 @@ class Dvd
    private $id;

    /**
    * @var \Nudeflix\Bundle\ContentBundle\Entity\DvdDescription
    *
    * @Assert\Valid
    * @Assert\NotBlank()
  2. kfuchs created this gist May 21, 2014.
    48 changes: 48 additions & 0 deletions Dvd.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    /**
    * 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;

    /**
    * @var \Nudeflix\Bundle\ContentBundle\Entity\DvdDescription
    *
    * @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;
    }
    102 changes: 102 additions & 0 deletions DvdDescription.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,102 @@
    /**
    * 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;
    }
    }