Hi,
That solved the problem. Thanks!
- Willie Gollino
--- In metal-dev@yahoogroups.com, Manuel Lemos <mlemos@a...> wrote:
> Hello,
>
> On 12/31/2002 01:21 PM, wgollino wrote:
> > First of all, I have to say that I really like the metastorage
app.
> > Anything that makes work simpler is a Good Idea :)
> >
> > I've trying to test some metastorage generated classes, and I'm
> > encountering a data consistency problem. I'm using the metastorage
> > tarball from the website, not CVS.
> >
> > When I call the persist method on an object, and then try to
retrieve
> > all the objects, the newly added object hasn't been saved yet:
> >
> > $factory=....(init code)
> >
> > // create a new User object
> > $user=$factory->createUser();
>
> Here is the problem. PHP object assignment creates a new object.
Change
> this to:
>
> $user=&$factory->createUser();
>
>
> > Is there a way of avoiding having to re-initialize the factory
between
> > calls?
>
> Initializing the factory is only needed once per script. It is
meant to
> setup the database connection so you can't get away with it. I
could
> make it a constructor but you would still need to call finalize at
the
> script end because PHP 4 does not support destructors except when
using
> some ugly hacks.
>
> Hopefully when PHP 5 is out I can make Metastorage generate
optionally
> optimized code that is nicer.
>
> Happy new year 2003 to everybody.
>
> --
>
> Regards,
> Manuel Lemos