Hi Herman,
with dump, I discovered something. If I use
$client_id = 1;
$credit = $em->find('Entities\Credit', $client_id);
if ($credit === null) {
everything works fine, But I am using this to get $client_id:
$client_id = $invoice->getOrder()->getClient()->getId();
So as the client entity is loaded, credited entity is also lazy loaded
because of mapping, this is why it does not consider the if statement as
null and goes to else clause. But if I add below in else clause:
$client = $em->find('Entities\Client', $client_id);
$credit = new Entities\Credit;
$credit->setClient($client);
then how to update the same credit entity next time? Is there any trick to
fix this problem?
as about your point #3, what exactly do you mean? do you mean adding a
blank credit entity on time of client account creation so in this stage,
they have already a credit entity to be updated? or I should eager load to
fetch $client_id rather than lazy load to avoid lazy load of credit entity,
so the if/else clause will work fine? what is the best way?
On Wed, May 7, 2014 at 11:00 AM, Herman Peeren <[email protected]>wrote:
> typo: 'found', not 'dfound'. Sorry, too much hurry.
>
> --
> You received this message because you are subscribed to the Google Groups
> "doctrine-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/doctrine-user.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.