tags:

views:

93

answers:

3

i setup Doctrine 1 b4 but it seems like now when i try Doctrine 2 it fails

i have Doctrine installed at D:\ResourceLibrary\Frameworks\Doctrine

D:\ResourceLibrary\Frameworks\Doctrine\bin
D:\ResourceLibrary\Frameworks\Doctrine\Doctrine
D:\ResourceLibrary\Frameworks\Doctrine\Doctrine\Common
D:\ResourceLibrary\Frameworks\Doctrine\Doctrine\DBAL
D:\ResourceLibrary\Frameworks\Doctrine\Doctrine\ORM

i put D:\ResourceLibrary\Frameworks\Doctrine\bin in the PATH Windows Environment Variable and added D:\ResourceLibrary\Frameworks\Doctrine to the php.ini include_path

i find that when i try to do

D:\>php doctrine.php
Could not open input file: doctrine.php

fails ... i thought that since i have D:\ResourceLibrary\Frameworks\Doctrine\bin in the PATH Windows Environment Variable, it shld be able to find doctrine.php?

D:\ResourceLibrary\Frameworks\Doctrine\bin>php doctrine.php

Warning: require(D:\ResourceLibrary\Frameworks\Doctrine\bin/../lib/vendor\Symfony\Components\Console\Helper\HelperSet.ph
p): failed to open stream: No such file or directory in D:\ResourceLibrary\Frameworks\Doctrine\Doctrine\Common\ClassLoad
er.php on line 143

Fatal error: require(): Failed opening required 'D:\ResourceLibrary\Frameworks\Doctrine\bin/../lib/vendor\Symfony\Compon
ents\Console\Helper\HelperSet.php' (include_path='D:\ResourceLibrary\Frameworks\ZendFramework\library;D:\ResourceLibrary
\Frameworks\Doctrine;.;c:\php\includes') in D:\ResourceLibrary\Frameworks\Doctrine\Doctrine\Common\ClassLoader.php on li
ne 143

then 2nd try, pass with errors ...

A: 

If you want to use the command line interface in the new Doctrine 2 beta you also have to install the Symfony 2 framework (because it includes the Console Helper) and put it into your include path.

As far as I know there is currently no PEAR installation available, so you will have to download the sources from the Symfony 2 website or via Git.

On a sidenote: It seems that you also tried to execute doctrine.php at a path where it doesn’t exist. That’s the reason why you got the

Could not open input file: doctrine.php

error message.

Rafael
jiewmeng
One easy hack for the beta would be to put the Symfony folder in your main PEAR folder. You wouldn't have to mess around with class loaders. If PEAR is set up correctly on your system everything should work.
Rafael
+1  A: 

You don't need the entire Symfony framework. Just the bits that Doctrine relies on.

If you download the current version of the ORM component (right now at BETA2), it will include a folder called Symfony (probably in lib/vendor/Symfony, but it tends to move around with new releases). You need to make sure that the ClassLoader in doctrine.php or cli-config.php can find that Symfony folder.

$classLoader = new \Doctrine\Common\ClassLoader('Symfony', __DIR__ . '/path/to/Symfony');
$classLoader->register();

I hope this information is accurate. The Doctrine team keeps messing with the structure of the release they closer they get to a final version.

Bryan M.
yes something like this does the trick. i need to replace `__DIR__ . '/path/to/Symfony'` to `D:/ResourceLibrary/Frameworks/Symfony` same for doctrine `D:/ResourceLibrary/Frameworks/Doctrine`. question is php `include_path` does not seem to do anything here?
jiewmeng
include_path will help load files if you're using 'require'. For auto-loading classes by name, you need to spl_autoloader, or something like Doctrine's ClassLoader or Zend_Loader_Autoloader.
Bryan M.
i found that i can also omit the `/path/to/symfony` all that if i have `include_path`set
jiewmeng
A: 
neeraj