Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion setUp not called

View Parsed - Show only message text

MIME-Version: 1.0
Received: by 10.100.135.11 with SMTP id i11mr1721639and.27.1246993055931; Tue, 
	07 Jul 2009 11:57:35 -0700 (PDT)
Date: Tue, 7 Jul 2009 11:57:35 -0700 (PDT)
In-Reply-To: <ce16d480-ad00-4644-a868-268fe968ade3@d4g2000yqa.googlegroups.com>
X-IP: 84.38.85.66
References: <ce16d480-ad00-4644-a868-268fe968ade3@d4g2000yqa.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Opera/9.80 (Windows NT 5.1; U; pl) Presto/2.2.15 
	Version/10.00,gzip(gfe),gzip(gfe)
Message-ID: <9310fbb3-66b7-466e-8cdc-f1e390d027cb@26g2000yqk.googlegroups.com>
Subject: Re: setUp not called
From: eXtreme <jacek.jedrzejew...@gmail.com>
To: doctrine-user <doctrine-user@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Maybe use construct() method? (Yes, without leading underscores)

Read the docs: http://preview.tinyurl.com/nxeuvv

On 7 Lip, 20:09, Alex Farcas <alex.far...@gmail.com> wrote:
> Hey guys,
>
> For various reasons (like implementing extended validation with
> specifications) i decided to extend DoctrineRecord. So assuming i have
> the entity/class called Person, it would inherit from BasePerson (the
> default behavior when autogenerated), and BasePerson would inherit
> from My_Doctrine_Record. And of course, My_Doctrine_Record, inherits
> from DoctrineRecord. So i just added a middle class, and did not let
> BasePerson extend Doctrine_Record directly as it normally happens.
>
> Now in Person, i have the setUp function where i add some entries into
> an array, and the array is a member of Person. In order to retrieve a
> Person i use this: $person = Doctrine::getTable( 'person' )->find
> ( (int)$id ); Everything works, the person is fetched, and i can play
> with it, BUT, the array populated with the setUp method is empty!!
>
> After some debug, it was clear that the array was populated correctly,
> so the only explanation remaining was that the Person, was somehow
> cloned, and the array got empty in the process. I debugged further,
> overriding the constructor in My_Doctrine_Record, and added an "echo('
> instance ')". In the setUp method of Person, i added "echo(' set-up
> ')";
>
> So here's what was printed on the screen, when fetching a Person with
> find: instance instance set-up instance.
> Which means there were 3 instances of Person created, and only the
> second one got it's setUp method called, and it was pretty obvious
> that i was getting the last instance, since setUp was not called, and
> my array was thus empty.
>
> In the hope i explained things clearly, can anyone tell me why this is
> happening, and how to fix it? I don't care that the class Person is
> instantiated 3 times (rather wasteful and redundant i would say), but
> i do care about my setUp method being called, or having the object
> cloned properly (if cloning occurs on the third instance). In short i
> need to be able to have that array member i was describing above (or
> any member for that matter), keep it's values. Btw, the array member
> is called $_specifications, so there isn't a naming conflict with one
> of Doctrine_Record's members.
>

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google