Hello,

On 10/11/2002 11:31 AM, Juhan Kundla wrote:
> I am planning to write a small web application using PHP. The
> application has several business classes, which store their persistent data
> in relational database. I don't like the idea of embedding the SQL and
> other data access related code into my classes, so i am looking for a
> abstraction layer, which takes care of the dirty work and my classes
> have only simple methods like save, retrieve and delete.
> 
> I would rather not reinvent the wheel here, so it would be nice, if
> anybody could share her/his experience or suggest some PHP-code for
> this. I have searched web and found nothing very useful so far.

I am working on a project to do exactly that. It is not quite an 
abstraction layer, but rather an component generator. Abstraction layers 
try to be too generic and end up spending more memory and be less 
optimized.

What I am working on is a module for MetaL, a meta-programming engine 
with a modular compiler.

MetaL can generate code from a XML based source code into a many 
different target languages: PHP, Java, Perl, ... It comes with many 
modules to handle different aspects of programming languages: 
programming flow, data types and expressions, object oriented 
programming constructs, etc..

The goal of the component persistence module is to depart from a 
description of a component structure of related classes and generate 
schemas and classes to act as persistence later storing and retrieving 
objects of classes that are mapped to database tables. Below you may see 
an example of a component class definition.

Currently the MetaL persistence layer that I am working on is capable of 
generating schemas defined in a XML format that Metabase database 
abstraction layer is capable of installing.

I will be working on class generating these days. I have not yet a clear 
idea of what it will be capable of in a mature version as I will give 
priority to things I will be needing in the applications where I need to 
use this.

I know that it will generate a factory class for each component that 
will create objects of each of the mapped classes to handle the 
persistence operations.

If you are interested to give your input feel free to join MetaL mailing 
list sending a message to [EMAIL PROTECTED] and tell 
about what you think it is needed.

You may find more information on MetaL here:

http://www.meta-language.net/

<?xml version="1.0" encoding="iso-8859-1"?>
<!--
      @(#) $Id: qa.component,v 1.1 2002/10/11 06:05:26 mlemos Exp $
   -->
<component>
        <name>qa</name>
        <description>Question and answer component</description>

        <class>
                <name>question</name>

                <variable>
                        <name>question</name>
                        <type>text</type>
                </variable>

                <variable>
                        <name>lead</name>
                        <type>text</type>
                </variable>

                <variable>
                        <name>answer</name>
                        <type>text</type>
                </variable>

                <collection>
                        <name>categories</name>
                        <class>category</class>
                        <reference>questions</reference>
                </collection>

                <collection>
                        <name>keywords</name>
                        <class>keywords</class>
                        <reference>questions</reference>
                </collection>

        </class>

        <class>
                <name>category</name>

                <variable>
                        <name>name</name>
                        <type>text</type>
                </variable>

                <variable>
                        <name>description</name>
                        <type>text</type>
                </variable>

                <variable>
                        <name>parent</name>
                        <class>category</class>
                </variable>

                <collection>
                        <name>children</name>
                        <class>category</class>
                        <reference>parent</reference>
                </collection>

                <collection>
                        <name>questions</name>
                        <class>question</class>
                        <reference>categories</reference>
                </collection>

        </class>

        <class>
                <name>keywords</name>

                <variable>
                        <name>words</name>
                        <type>text</type>
                </variable>

                <collection>
                        <name>questions</name>
                        <class>question</class>
                        <reference>keywords</reference>
                </collection>

        </class>

</component>



-- 

Regards,
Manuel Lemos


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to