From: Maarten van Leeuwen <mvanleeu...@gmail.com>
Date: Sat, 10 Nov 2012 15:53:07 +0100
Local: Sat, Nov 10 2012 9:53 am
Subject: Re: [doctrine-user] __construct() not executing after a find()
An entity that exists in your database is not a new entity so it does not have to be constructed. It should not matter if the domainobject you want to find in your repository is managed or must be fetched from a database first. Constructors are for new entities, not for persisted entities.
Regards,
Op 10 nov. 2012 om 02:44 heeft fesja <fes...@gmail.com> het volgende geschreven:
> Hi,
> I'm starting with Doctrine2 (previously in Doctrine1.2) and I have found something that seems strange and I don't understand.
> I do a query to get a place:
> <?php
> namespace TE\TestBundle\Entity;
> use Doctrine\ORM\EntityRepository;
> class PlaceRepository extends EntityRepository
> It returns me an object of that Entity, but it doesn't execute the __construct() method.
> Could you explain me why and how is the philosophy about that, and how I have to manage those kinds of things. On this scenario, I wanted to inject a service to Place through the constructor.
> thanks!
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||