tags:

views:

18

answers:

1

Hi, can someone please tell/type here how to generate models from an existing DB using php and doctrine ?, what i did was, I placed the Doctrine folder + Doctrine.php inside a folder named e.g test , now within that test folder I added a php script named test1.php, and within that test1.php , here's the code that I used

include_once('Doctrine.php');
spl_autoload_register(array('Doctrine','autoload'));

$manager = Doctrine_Manager::getInstance();

$conn = Doctrine_Manager::connection('mysql://usr:password@localhost/dbname','doctrine');

Doctrine::generateModelsFromDb('/models',
    array('doctrine'),
    array('classPrefix'=>'Square_Model_')
  );

then nothing happend when I ran that script via cmd via php - f test1.php , what should I do ?

+1  A: 

Maybe it is generating the models but not putting them where you think it should be.

'/models' will create a models directory at your filesystem root (for example, C:\models if you're on Windows).

'models' (without the slash) will create the models directory in the same directory as your script.

BenV
my question was posted 10 days ago. nobody answered, I was able to solve it myself..but thanks for your answer man :)
sasori