开发者

How to Generate Models using doctrine1.2 in an existing db with PHP?

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::ge开发者_如何学GonerateModelsFromDb('/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 ?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜