Search the web
Sign In
New User? Sign Up
metal-dev · MetaL Development
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
metastorage persist code   Message List  
Reply | Forward Message #86 of 553 |
Re: [metal-dev] metastorage persist code

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




Tue Dec 31, 2002 9:18 pm

mallemos
Offline Offline
Send Email Send Email

Forward
Message #86 of 553 |
Expand Messages Author Sort by Date

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...
wgollino <wgollino@...>
wgollino
Offline Send Email
Dec 31, 2002
3:21 pm

Hello, ... Here is the problem. PHP object assignment creates a new object. Change this to: $user=&$factory->createUser(); ... Initializing the factory is only...
Manuel Lemos
mallemos
Offline Send Email
Dec 31, 2002
9:18 pm

Hi, That solved the problem. Thanks! - Willie Gollino ... app. ... retrieve ... Change ... between ... meant to ... could ... the ... using ... optionally...
wgollino <wgollino@...>
wgollino
Offline Send Email
Jan 3, 2003
4:14 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help