开发者

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

开发者 https://www.devze.com 2023-01-21 10:45 出处:网络
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.gtest , now w

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

精彩评论

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