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 to share photos of your group with the world? 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 example application   Message List  
Reply | Forward Message #84 of 553 |
Re: [metal-dev] MetaStorage example application

Hello,

On 12/14/2002 07:38 PM, Jason Hines wrote:
> Is there an example available anywhere that demonstrates how the
> generated data classes / factory class should be interfaced within an
> external PHP script? The documentation does not illustrate this.

Yes, you are right, the documentation needs to be improved on this
aspect. I will try to provide something in that direction soon.


> My first inclination would be something like:
>
> include("cms.php");
> include("article.php");

Yes...

> $article = new articleclass();

No, objects should be created by the factory class, calling functions
defined the component XML definition. These functions can be to create a
new object from scratch or to create objects retrieved from the
persistence contains which in the current Metastorage version can only
be a relational database.

I will provide a better example later, but a possible script to create
and persist an article object would look like this:

require("cms.php");
require("article.php");

$factory=&new cmsclass;
$factory->connection="mysql://localhost/cms";
$factory->includepath="metabase/relative/path/to/script";

if($factory->initialize())
{
$article=$factory->createarticle();
if($article!=null)
{
$article->title="My first article";
$article->persistarticle();
}
$factory->finalize();
}

if(strlen($factory->error))
echo "Error: ".$factory->error;



--

Regards,
Manuel Lemos




Sun Dec 15, 2002 12:17 am

mallemos
Offline Offline
Send Email Send Email

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

Is there an example available anywhere that demonstrates how the generated data classes / factory class should be interfaced within an external PHP script?...
Jason Hines
oweff
Online Now Send Email
Dec 14, 2002
9:33 pm

Hello, ... Yes, you are right, the documentation needs to be improved on this aspect. I will try to provide something in that direction soon. ... Yes... ... ...
Manuel Lemos
mallemos
Offline Send Email
Dec 15, 2002
12:17 am
Advanced

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