Skip to content

Instantly share code, notes, and snippets.

@Ocramius
Last active December 15, 2015 04:19
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 Ocramius/5200932 to your computer and use it in GitHub Desktop.
Save Ocramius/5200932 to your computer and use it in GitHub Desktop.
<?php
/**
* So for example I have two tables "ab" and "cd". "ab" references "cd" table
*/
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="\App\Entity\Repository\Ab")
* @ORM\Table(name="ab")
*/
class Ab
{
/**
* @ORM\Id()
* @ORM\Column(name="ab_id", type="integer")
* @ORM\GeneratedValue(strategy="IDENTITY")
* @var integer
*/
protected $abId;
/**
* @ORM\ManyToOne(targetEntity="Cd")
* @var \App\Entity\Cd
*/
protected $cd;
...
}
/**
* @ORM\Entity(repositoryClass="\App\Entity\Repository\Cd")
* @ORM\Table(name="cd")
*/
class Cd
{
/**
* @ORM\Id()
* @ORM\Column(name="cd_id", type="integer")
* @ORM\GeneratedValue(strategy="IDENTITY")
* @var integer
*/
protected $cdId;
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment