Created
November 2, 2011 21:24
-
-
Save craue/1334971 to your computer and use it in GitHub Desktop.
OneToOne relationship showing an issue with empty `$timespans` if no invoices exist for the timespans, concerning https://github.com/doctrine/doctrine2/pull/180
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Company { | |
/** | |
* @var Timespan[] | |
* @ORM\OneToMany(targetEntity="Timespan", mappedBy="company", cascade={"persist", "remove"}) | |
*/ | |
protected $timespans; | |
} | |
class Timespan { | |
/** | |
* @var Company | |
* @ORM\ManyToOne(targetEntity="Company", inversedBy="timespans") | |
* @ORM\JoinColumn(name="company_id", referencedColumnName="id", nullable=false) | |
* @Assert\NotNull | |
*/ | |
protected $company; | |
/** | |
* @var Invoice | |
* @ORM\OneToOne(targetEntity="Invoice", mappedBy="timespan", cascade={"persist", "remove"}) | |
*/ | |
protected $invoice; | |
} | |
class Invoice { | |
/** | |
* @var Timespan | |
* @ORM\OneToOne(targetEntity="Timespan", inversedBy="invoice") | |
* @ORM\JoinColumn(name="timespan_id", referencedColumnName="id", nullable=false) | |
* @Assert\NotNull | |
*/ | |
protected $timespan; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment