I'm attempting to set up a many-to-one relationship between a series of sales memos and transaction records.
/**
* @var TransactionInterface
*
* @ORM\ManyToOne(targetEntity="Twb\Common\Model\Broker\TransactionInterface")
* @ORM\JoinColumn(name="FormNoSeller", referencedColumnName="Form")
*/
private $formnoseller;
/**
* @var TransactionInterface
*
* @ORM\ManyToOne(targetEntity="Twb\Common\Model\Broker\TransactionInterface")
* @ORM\JoinColumn(name="FormNoBuyer", referencedColumnName="Form")
*/
private $formnobuyer;
They are split between two different bundles at the moment ('SalesBundle' and 'BrokerBundle'), and with that in mind I am using interfaces from the SalesMemo entity in SalesBundle to the Transaction entity in BrokerBundle.
For some reason, when I reference either or both of $formnoseller
and $formnobuyer
in my forms, I notice in dev.log that, after selecting all Transaction rows matching the $formnoseller
and/or $formnobuyer
fields in the SalesMemos, Doctrine tries to SELECT
all rows in the Transaction table (the entity for which TransactionInterface references). This is a bit of a problem, since there is an innumerable amount of rows in the DB, which takes up a lot of memory.
Is there any way to have Doctrine avoid selecting all rows with associations? Or am I even understanding properly how Doctrine does associations? Many thanks for any help.