SitePoint Sponsor

User Tag List

View Poll Results: If you had a good PHP code generation tool would you use it?

Voters
85. You may not vote on this poll
  • Of course, where can I download the source

    22 25.88%
  • Um, I would have to take a look at it

    50 58.82%
  • No, definitely not.

    11 12.94%
  • What's code generation?

    2 2.35%
Page 1 of 2 12 LastLast
Results 1 to 25 of 49

Hybrid View

  1. #1
    SitePoint Enthusiast escape164's Avatar
    Join Date
    Dec 2002
    Location
    Colorado, USA
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Code Generation,

    Got a question for all of the Advanced PHP guys :-).

    I came across a project a while ago that generated PHP DAO's for me on the fly. The project was closed source, but I absolutely fell in love with it. I liked it so much that I went and implemented it myself.

    I use this DAO Generator all the time now. It finds itself into all of my projects and the fact that I don't have to write a DAO for each and every database table makes me very happy.

    I want to know if other people would be interested in something like this as well. I am thinking of starting a PHP code generation sourceforge project and posting the code, as well as a few other code generators that I have in mind.

    Now, one of the biggest things I have ran into when I show this to other people is that the classes that the code generator writes do not fit their style of coding, yadda yadda yadda. Suppose they did fit what you are used to, would you use them then?

    Thanks for the feedback in advance!

    *Edit*
    Some Links for further background Information
    PHP Patterns DAO
    Closed Source DAO Gen
    Java DAO Explanation
    Last edited by escape164; Nov 19, 2003 at 13:36.

  2. #2
    SitePoint Zealot spybreak's Avatar
    Join Date
    Apr 2003
    Location
    Germany
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what's a DAO?

    (sorry, newbie)

  3. #3
    PHP manual bot bronze trophy Gaheris's Avatar
    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,195
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Data Access Object

  4. #4
    SitePoint Zealot ZangBunny's Avatar
    Join Date
    Jul 2003
    Location
    Mainz, Germany
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First off, giving a link to DaoGen would have been nice, so everyone can take a look.

    DaoGen is a nice tool, if the code it generates matches the pattern you've had in mind for your application. Since it's closed source, you'd have to manually change the generated code otherwise, which kinda defies the purpose. So having a open source version of DaoGen would be really nice, and probably not all that difficult. It could probably be done by passing the data that the user inputs to a simple template that generates the PHP.

    What is even more interesting about having it open source is that it could be evolved into a nice O/R mapping package, something that even Martin Fowler in PEAA suggests one should buy rather than build the mapping layer by hand.

    If you're sourceforging it, count me in.

  5. #5
    SitePoint Enthusiast escape164's Avatar
    Join Date
    Dec 2002
    Location
    Colorado, USA
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I added the link above as well as some information on different links to what Data Access Objects are. I have a copy of the source and will attach it to a post here soon for people to download. I need to run through it and put names on who wrote what first though.

  6. #6
    SitePoint Evangelist ghurtado's Avatar
    Join Date
    Sep 2003
    Location
    Wixom, Michigan
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    DAO Generation is probably the most useful / implementable of all the aspects that you could apply automatic php code generation to. So to answer your question, yes, I would use it provided that:
    1. The approach fits with my coding style
    2. The DAO's can be implemented with a number of DB abstraction layers, and can be extended
    3. The program / generator does not tie me to a single aspect of a rigid architecture, it just provides DAOs for me to use with whichever framework I wish.

    There are very few other "applications" of code generation (besides DAOs, that is) where I feel confident a competent solution could be developed. This translates into me saying that I would not use a code generation tool to create my business objects or any other framework classes in my application, or hardly anything else at all for that matter.

    So in sum, if done right, yes I would use it, but probably only for DAOs. Either way, I can't wait to see what you have!

  7. #7
    SitePoint Evangelist ghurtado's Avatar
    Join Date
    Sep 2003
    Location
    Wixom, Michigan
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just went through generating a sample DAO with DaoGen, and while the intent is good, and it would be nice to have an open source version of it, there are a number of things I disagree with after examining the generated code:

    1. I don't quite like the way that most DAOs out there seem to try to force you into a getThis, setThat type of architecture. This means that for every new column you add to your DB / DAO, you have to modify your DAO and create a new Method. Unnecesary work in my opinion, never mind the fact that your class will grow much bigger than neccesary with a majority of methods that do nothing but blindy set or get a variable. While I don't condone direct access of private members, I would be much merrier with a single get/set(name, value) approach. If all of your DB data is held by an array in your object, as I happen to think it should be, then there is no loss of functionality or OOPability (there, a new word ) with this approach. Am I alone in this?

    2. I dont quite see the purpose of creating one object for every row that is retrieved from the DB. I think the DAO could be a store for any amount of data, one or many rows, but perhaps I am wrong in this. I would like for someone to show me the benefits (design wise) of doing it this way.

    3. The setAll function would be MUCH better served if it accepted a hash as a parameter, so the order of the variables was irrelevant. I think it is easy to see why this implementation would be more effective and flexible (as well as elegant, IMO).

    4. Why all the classes generated are independant and use no inheritance escapes me. In my mind a DAO architecture is about the most blatant target for proper inheritance, with a base class providing all the common methods (get, set, save, count, query... you name it), and the derived classes (UserDao, or DaoUser as I would have named it) only need to extend with class specific methods (ie: getAllUsersByStatus)

    Anyway, this is just one man's opinion, but if others agree, it might be good to consider some of these things in developing "the ultimate DAO"

  8. #8
    ********* Victim lastcraft's Avatar
    Join Date
    Apr 2003
    Location
    London
    Posts
    2,423
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi.

    I have actually written a DAO/persistence generator (from XML using XSLT). They are extremely useful. Although the code generation part is easy, designing the underlying persistence mechanism certainly is not. It has taken myself and colleagues a couple of years (alongside other work) and yet ours is still crude. This is a big job. Have a look at some of the JDO implementations to see how big.

    Some issues...

    1) As has been pointed out, using getValue($name) is a possibility. You lose some security, but PHP method not found errors are unrecoverable whereas accessing a name that should not exist can be dealt with.

    2) Use the "generation gap" pattern (Vlissides). Makes testing a whole lot easier. Basically the objects should descend from a base class as was mentioned.

    3) You want to keep the actual code generation part as simple as possible. It is really difficult and time consuming to test thoroughly.

    4) Make sure they can easily be used with transactions. You will need separate commit() and confirmCommit() methods so that if the first commit fails the object is unchanged and can commit again.

    5) This is people's data. It has to be super tested and super reliable.

    Some future goals...

    1) Things get much more interesting with collections, that is one to many relationships.

    2) One to one and many to one are easiest done with joins. This is quite tricky, but possible.

    3) You also need to generate back-up and restore routines for the database. Something often forgotten. I recommend XML for this. You can then easily transfer data from one system to another and write schema porting scripts with XSLT.

    4) Avoid exposing primary keys and the like. This is tricky for many to one joins when reading from the database. It is still worthwhile though.

    The whole thing could become a huge job, but PHP desperately needs a decent object persistence mechanism, so it's an important job. Sadly PhpDo (Joe Walnes) is no more. Could this be the start of a replacement? Make sure you get plenty of volunteers.

    yours, Marcus
    Marcus Baker
    Testing: SimpleTest, Cgreen, Fakemail
    Other: Phemto dependency injector
    Books: PHP in Action, 97 things

  9. #9
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One for the road: http://www.phpdb.org/ - haven't check this out but it's by one on the Binarycloud / Phing crew which gets me interested.

  10. #10
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wouldn't use Code Generation as I actually see no point for it as far as PHP is concerned in relation to PHP being an interperted language yes ?

    Would proberly be different if PHP was reduced to byte code ala Java for example by default ? But this isn't the case is it ?

  11. #11
    SitePoint Evangelist ghurtado's Avatar
    Join Date
    Sep 2003
    Location
    Wixom, Michigan
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dr,

    I don't think that the benefits that could be drawn from code generation tools have much to do with interpreted vs compiled languages. Everybody needs to write the source code at some point, interpreted or not, and for certain design patterns (ie the DAO), the amount of repetitious coding can be sufficient to warrant an automated process. But of course, just like the choice of IDE, this is all in the eye of the beholder; some will think its a good idea, for some others it might not fit their development model.

    Anyone know what happened with Binarycloud? it seemed like it had a lot going for it, and then it got frozen in time, didnt it?

  12. #12
    SitePoint Zealot ZangBunny's Avatar
    Join Date
    Jul 2003
    Location
    Mainz, Germany
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ghurtado
    I don't think that the benefits that could be drawn from code generation tools have much to do with interpreted vs compiled languages. Everybody needs to write the source code at some point, interpreted or not, and for certain design patterns (ie the DAO), the amount of repetitious coding can be sufficient to warrant an automated process.
    Agree. Even PEAA says that writing the Data Mapping Layer by hand is tedious, repetitious work that can be done just as well by a good tool. While I'm against generating database code on the fly at runtime, using a tool to generate the groundworks and then fine-tune it seems like a good way to me. (The tuning should be done by inheriting and extending of course, so you won't get in trouble when your schema changes and you have to re-generate.)

    Quote Originally Posted by ghurtado
    Anyone know what happened with Binarycloud? it seemed like it had a lot going for it, and then it got frozen in time, didnt it?
    It was touted as the best thing since sliced bred all over Usenet and PHPBuilder by its creator (Alex Black), but I haven't seen any movement in the last year or so. I don't care for heavy frameworks too much, but I think Phing could have evolved into something useful...

  13. #13
    ********* Victim lastcraft's Avatar
    Join Date
    Apr 2003
    Location
    London
    Posts
    2,423
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi.

    Thanks for the link Harry. That is just the kind of thing I was thinking of.

    It is Java based though as they use the Torque persistence layer. It is not PHP native. They seem to have hidden this well, though, so if your development box has Java and the appropriate Apache components then you have the illusion of PHP persistence. If you haven't then you will have to have enough Java nonce to set all of this up. At that point you might as well have used a Java persistence layer and accessed it from PHP.

    My good doctor, PHP being interpreted makes code generation more desirable . Think of the code generation step as doing some of the processing by generating pre-calculated files.

    yours, Marcus
    Marcus Baker
    Testing: SimpleTest, Cgreen, Fakemail
    Other: Phemto dependency injector
    Books: PHP in Action, 97 things

  14. #14
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    Watford, UK
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I've only had a really quick look at this (Propel) so far, so I'm probably setting myself up for a pratfall here...
    Quote Originally Posted by lastcraft
    It is Java based though as they use the Torque persistence layer. It is not PHP native. They seem to have hidden this well, though
    They've hidden it too well for me to see . I've only had a scan thru the source/docs/files, but it looks from my glance that rather than using Torque as a persistence layer, it's a pretty direct port of Torque into PHP5. Having never looked at Torque myself I'm basing that assumption on the number of comments in the code that pop up with a (Torque) attribution, and those that refer to Java stuff. Maybe I'm just failing to see the crucial bit so far.

    This idea of porting things almost directly from Java into PHP5 is intriguing, if a little odd. I guess it kind of maybe makes sense in avoiding reinventing the wheel...?

    (btw, I don't know if this is why binary cloud is quiet, but Phing development is only PHP5 now too , maybe it'll be really loud when there's a release).

    Interesting quote in their docs:
    There are quite a number of object persistence layers for Java...however, there are very few solutions that even provide very basic o/r mapping for PHP. A few noteable:

    * Metastorage - The only other comprehensive persistence layer for PHP [HL: that I know of]
    Given that it works with PHP4 I'm going to have to take a look at Metastorage - is there no way you can post even a little code Manuel, to save everyone an extra visit somewhere else? I've just tried to hit the link in your post but it's not working for me...

    (One last (entirely OT) thing, does anyone know of a tool to generate arbitrary amounts of random test data based on a SQL schema?)

    Anyway, this is all interesting stuff, good luck with the project!

    Cheers,

    Jon

  15. #15
    ********* Victim lastcraft's Avatar
    Join Date
    Apr 2003
    Location
    London
    Posts
    2,423
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi...

    Quote Originally Posted by JonR
    Maybe I'm just failing to see the crucial bit so far.
    No I think you are right. I found some in the master directory and lots of Java properties files, but these may be relics. They also mention it in their FAQ. Not much else to go on, so I have probably jumped the gun.

    yours, Marcus
    Marcus Baker
    Testing: SimpleTest, Cgreen, Fakemail
    Other: Phemto dependency injector
    Books: PHP in Action, 97 things

  16. #16
    SitePoint Addict
    Join Date
    Apr 2002
    Posts
    330
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You may want to take a look at Metastorage.

    It is a tool that generates classes that act as API to store and retrieve data objects in databases.

    It is based on a Model Driven Architecture (MDA). This means that you just need to design your data model definition in a simple XML based format and it will generate classes that you will use in your application.

    It uses a JE WIN approach. ie it generates Just Exactly What You Need. This means that it won't generate generic code or fat base classes that bundle functionality that your particular model will not need. Therefore the generated code is optimized in size and for speed.

    Additionally, Metastorage can also generate optional classes that handle common types of Web based forms to act as user interface to manipulate your data objects. The forms are generated with compiled theme based templates. There are several familiar themes available, but you can build yours.

    As a bonus, Metastorage can generate class diagrams in the UML notation so you can integrate them in your project documentation or even show it to your clients. Clients often do not understand much of software, but UML diagrams helps them to understand what is being proposed. Often UML diagrams help clients accept and buy project bids that are being proposed.

    Metastorage is throughly documented but for a quick start, there is now a tutorial document in progress that is available here: http://groups.yahoo.com/group/metal-.../tutorial.html.
    Manuel Lemos

    Metastorage - Data object relational mapping layer generator
    PHP Classes - Free ready to use OOP components in PHP

  17. #17
    SitePoint Zealot ZangBunny's Avatar
    Join Date
    Jul 2003
    Location
    Mainz, Germany
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I browsed through the Metastorage documentation quickly, and one thing that struck me that it is tied to the Metabase database abstraction layer. This is fine if that is what you want to use, but otherwise can be a problem.

    (I could not get to the tutorial, as it is hidden in a yahoo group and you can't access it unless you join.)

  18. #18
    SitePoint Evangelist ghurtado's Avatar
    Join Date
    Sep 2003
    Location
    Wixom, Michigan
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Then I guess we should add to the list of requirements / desirable features that our DAO generator not be coupled with any particular DB abstraction layer, am I correct? Do you think this would be possible?

  19. #19
    SitePoint Zealot ZangBunny's Avatar
    Join Date
    Jul 2003
    Location
    Mainz, Germany
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ghurtado
    Then I guess we should add to the list of requirements / desirable features that our DAO generator not be coupled with any particular DB abstraction layer, am I correct? Do you think this would be possible?
    I don't see why it shouldn't be possible. One purpose of having a Data Mapping Layer is that the whole layer can be swapped out at any time. If you want to switch from MySQL to Oracle, you just replace the MySQL layer with an Oracle layer.

    If the code generator supports multiple databases (sub-classing the code-generator for each RDBMS supported comes to mind), this can be done in a jiffy. That also means that any number of abstraction libraries can be supported just as easily as any database.

    Could this work?

  20. #20
    SitePoint Addict
    Join Date
    Apr 2002
    Posts
    330
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ZangBunny
    I browsed through the Metastorage documentation quickly, and one thing that struck me that it is tied to the Metabase database abstraction layer. This is fine if that is what you want to use, but otherwise can be a problem.
    Metabase is just a quick way to support many databases. You can also use PEAR::MDB with Metabase wrapper to use the code generated currently by Metastorage.

    In the future, Metastorage generated code will not use any database abstraction package. Metastorage generated classes already provide any abstraction by themselves. Metastorage will generate only code that calls PHP native database functions and so achieve raw speed.

    Quote Originally Posted by ZangBunny
    (I could not get to the tutorial, as it is hidden in a yahoo group and you can't access it unless you join.)
    This is just a working version of the tutorial that was posted there for review of the MetaL development list subscribers.

    The access restriction was imposed by Yahoo. I cannot do anything about it. Anyway, you can have access if you want by subscribing to the group on this page: http://groups.yahoo.com/group/metal-dev/.
    Manuel Lemos

    Metastorage - Data object relational mapping layer generator
    PHP Classes - Free ready to use OOP components in PHP

  21. #21
    ********* Victim lastcraft's Avatar
    Join Date
    Apr 2003
    Location
    London
    Posts
    2,423
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi...

    Quote Originally Posted by mlemos
    It is a tool that generates classes that act as API to store and retrieve data objects in databases.
    Manuel, could you post a small example? Say a person's contact details, equivalent to...
    PHP Code:
    class Contact {
        
    getName() { }
        
    getEmail() { }

    yours, Marcus
    Marcus Baker
    Testing: SimpleTest, Cgreen, Fakemail
    Other: Phemto dependency injector
    Books: PHP in Action, 97 things

  22. #22
    SitePoint Addict
    Join Date
    Apr 2002
    Posts
    330
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by lastcraft
    Manuel, could you post a small example? Say a person's contact details, equivalent to...
    If you download Metastorage archive, without having to install the full MetaL/Metastorage packages, you can see inside the install directory what is generated for the example model defined in the file cms.component.

    Keep in mind that Metastorage follows the JE WIN approach (Just Exactly What I Need), which means that it will only generate classes with the functions to manipulate your data objects that you require. For instance, if you do not need a function to delete an object, no code will be generated to implement such function. This is meant to make classes and lightweight as possible.

    Currently, Metastorage does not generate automatic setters and getters functions. It may generate getters/setters functions for accessing class variables that store references to another objects (ie foreign keys).

    So, if you would expect it to generate getters and setters for basic data types variables, that will be available if explicitly request it. The reason for this is that not everybody likes to bloat their classes with setters/getters functions. OTOH, without requesting setters/getters, the variables have to be made public and so in that case other features are disabled like lazy loading, automated persistence of only the variables that changed, etc..

    Bottom line, is that you will get what you ask explicitly. The examples that come with Metastorage distribution may not show how to enable setters/getters but that does not mean they will not be supported.
    Manuel Lemos

    Metastorage - Data object relational mapping layer generator
    PHP Classes - Free ready to use OOP components in PHP

  23. #23
    ********* Victim lastcraft's Avatar
    Join Date
    Apr 2003
    Location
    London
    Posts
    2,423
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi Manuel...

    I had a ten minute look and it looks quite thorough...

    Quote Originally Posted by mlemos
    If you download Metastorage archive, without having to install the full MetaL/Metastorage packages, you can see inside the install directory what is generated for the example model defined in the file cms.component.
    I am afraid I found it about as clear as mud .

    Assuming I want getters, setters, lazy loading, etc (which I always do) is this definition correct for the example above?
    Code:
    <class>
        <name>Contact</name>
        <variable><name>name</name><type>text</type></variable>
        <variable><name>email</name><type>text</type></variable>
    </class>
    How much is missing?

    Some interim comments and questions...

    1) I could do without the strict adherence to canonical XML . XML is verbose enough without making it any worse. What is wrong with a few attributes?
    2) How do I inherit/use this storage class for domain objects? Apart from a single generated persist method there does not seem to be much control over exactly what gets written out. Do I just decorate that method? If I do, how do I tell the internal factories that I want my version, not the raw one?
    3) How are transactions handled?

    I would be very curious to know how you solved these issues.

    yours, Marcus
    Marcus Baker
    Testing: SimpleTest, Cgreen, Fakemail
    Other: Phemto dependency injector
    Books: PHP in Action, 97 things

  24. #24
    SitePoint Addict
    Join Date
    Apr 2002
    Posts
    330
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by lastcraft
    I am afraid I found it about as clear as mud .
    Of course, this is all new to you and unless somebody explains or you read the documentation, it is natural that you did not find it clear. Don't worry, you just need to experience it more.

    Quote Originally Posted by lastcraft
    Assuming I want getters, setters, lazy loading, etc (which I always do) is this definition correct for the example above?
    As I said, setters/getters are an option that is not yet implemented but they will be. Keep in mind that this a project being developed like any other Open Source project. I developed it to address my own needs and then I decided to document it to make it useful to others, so you can provide feedback that will help the project evolve.

    So, you will find that some things that you would like are not yet implemented, but if you would like them, you can always tell me what you think it should have.

    Quote Originally Posted by lastcraft
    Code:
     <class>
         <name>Contact</name>
         <variable><name>name</name><type>text</type></variable>
         <variable><name>email</name><type>text</type></variable>
     </class>
    How much is missing?
    This is just a definition of data variables. You need also to specify whatever types of functions you need to manipulate your objects.

    Quote Originally Posted by lastcraft
    1) I could do without the strict adherence to canonical XML . XML is verbose enough without making it any worse. What is wrong with a few attributes?
    XML attributes are not extensible, ie, you can't use tags in attribute values. This is against the meaning of X in XML, eXtensible markup language. So, using attributes limits what can be done to make the format more flexible and convinient.

    Anyway, ideally you will use a more productive tool to edit your component definitions. I have a friend that told me that he will be working on a Dreamweaver template for Metastorage. Since I don't use Dreamweaver, I do not know how much more productive you can be with it.

    In any case, component definitions are simple. You will not be editing them all the time to get so bothered with their verbosity.

    Quote Originally Posted by lastcraft
    2) How do I inherit/use this storage class for domain objects?
    This is explained in Metastorage documentation but it will detailed in a simpler to understand way in the tutorial.html]Metastorage tutorial that is being written as we speak.

    Basically, all objects are created by a factory class of which you need to create one instance per script/program. That applies to either objects being created from scratch or retrieved from storage. From than on, you just access the objects to do whatever you want and call a persist function to store the changes.[/font]


    Quote Originally Posted by lastcraft
    Apart from a single generated persist method there does not seem to be much control over exactly what gets written out. Do I just decorate that method? If I do, how do I tell the internal factories that I want my version, not the raw one?
    Metastorage generates final code. You should not edit the code generated by Metastorage. You should not need to edit the generated code either. What Metastorage generates it is like an API that was written by somebody else for a given purpose that you have. The way it works is that you just call this API to build your application.

    If you need to customize any details, you do it in the component definition. If for some reason, you realize that the generated API does not satisfy any particular needs, you just need to tell me what you want so I can figure what can be done to address your needs consistently.


    Quote Originally Posted by lastcraft
    3) How are transactions handled?
    Transactions are not yet support but it will be like any database transactions, you need to start and end transactions by commiting or roll back any changes.
    Manuel Lemos

    Metastorage - Data object relational mapping layer generator
    PHP Classes - Free ready to use OOP components in PHP

  25. #25
    SitePoint Evangelist ghurtado's Avatar
    Join Date
    Sep 2003
    Location
    Wixom, Michigan
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would think so. More to the point, the ideal code generator would be such that the code is neither specific to any single RDBMS nor DB abstraction layer. Perhaps coming up with an example of what kind of code we would like for it to generate, might solidify some of these ideas. Maybe I am way off, but I am thinking something like:
    PHP Code:
    class UserDao extends Dao
    {
        function 
    UserDao(){
            
    $this->defineTable('auth_users');
            
    $this->defineField('user_id''int''primary_key');
            
    $this->defineField('user_name''string');
            
    $this->defineField('parent_id''int''foreign_key');
        }

    Are we talking about something similar?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •