Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-07-2007, 08:59 AM
Junior Member
 
Join Date: Nov 2007
Posts: 3
Default how to generate the model classes automatically with relationships

The headline says it all. is it possible via some php script or free tool ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-07-2007, 04:59 PM
Junior Member
 
Join Date: May 2007
Posts: 25
Default describe table

you should be able to get all the info you need with describe table.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-08-2007, 08:14 AM
Junior Member
 
Join Date: Nov 2007
Posts: 3
Default

Quote:
Originally Posted by frosty1 View Post
you should be able to get all the info you need with describe table.
It seems you missunderstood me. I am talking here about MVC, exactly about the "M". I need to generate the php classes from create statement sql. It shouldnt be problem to generate some basics, at least something like this from the documentation according to the foreign keys

PHP Code:
class Bugs extends Zend_Db_Table_Abstract
{
    protected 
$_name            'bugs';

    protected 
$_dependentTables = array('BugsProducts');

    protected 
$_referenceMap    = array(
        
'Reporter' => array(
            
'columns'           => 'reported_by',
            
'refTableClass'     => 'Accounts',
            
'refColumns'        => 'account_name'
        
),
        
'Engineer' => array(
            
'columns'           => 'assigned_to',
            
'refTableClass'     => 'Accounts',
            
'refColumns'        => 'account_name'
        
),
        
'Verifier' => array(
            
'columns'           => array('verified_by'),
            
'refTableClass'     => 'Accounts',
            
'refColumns'        => array('account_name')
        )
    );
}

class 
BugsProducts extends Zend_Db_Table_Abstract
{
    ...
    protected 
$_referenceMap    = array(
        
'Product' => array(
            
'columns'           => array('product_id'),
            
'refTableClass'     => 'Products',
            
'refColumns'        => array('product_id'),
            
'onDelete'          => self::CASCADE,
            
'onUpdate'          => self::RESTRICT
        
),
        ...
    );

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 11-18-2007, 12:24 PM
Junior Member
 
Join Date: Nov 2007
Posts: 4
Default

Did you ever find such a tool?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 11-21-2007, 04:33 PM
Junior Member
 
Join Date: Nov 2007
Posts: 1
Default

I have very simple script which generates Zend_Table classes from schema.xml with format as used in propel.

and complement is another simple script for converting XML from DIA ER diagram to the schema.xml

currently no support for ON .. triggers but can be extended easily.

i can share it if you think it will help you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:31 AM.