Doctrine Cli on Windows - php

I am having some trouble configuring doctrine orm on windows 8, php 5.4. I have installed Doctrine using Composer.
I have followed the docs to the letter but when I run any commands, php vendor/bin/doctrine orm:schema-tool:create for example, my command line just outputs
SRC_DIR="`pwd`"
cd "`dirname "$0"`"
cd "../doctrine/orm/bin"
BIN_TARGET="`pwd`/doctrine"
cd "$SRC_DIR"
"$BIN_TARGET" "$#"
I have also tried php vendor/bin/doctrine.php .... but it just prints out the above.
I have followed Doctrine's guide to the letter. Has anyone seen this before and if so, can you suggest anything?

i found a solution
there are also a bin folder in vendor/doctrine/orm/bin/ you can use this one like this
php vendor/doctrine/orm/bin/doctrine orm:schema-tool:create
make sure you have root folder and a cli-config.php file is present in root folder.
below is location where i found a solution
https://groups.google.com/forum/#!msg/doctrine-user/_ph183Kh-5o/_P_coljB-dcJ
this is working fine for me .

I had the same problem. The following solution worked for me:
"vendor/bin/doctrine.bat" orm:schema-tool:create
So, basically you:
use the ".bat" file provided by Doctrine and
enclose the call to that ".bat" file in quotes.
My Environment
Windows 7 Professional (x64)
PHP 5.5.12
Doctrine ORM 2.4.4

Do not write "php..." (it will write the file content)
Just "vendor\bin\doctrine orm:schema-tool:create" do the job (from the project root eg. c:\php\theProject).
Next, you will need a "cli-config.php" in the project root...

For Window version use backward slash "\"
vendor\bin\doctrine orm:schema-tool:create
not forward slash "/"
vendor/bin/doctrine orm:schema-tool:create

You can either install something like git bash or simply use the PHP version of the script:
php vendor\bin\doctrine.php orm:info
Obviously, the php binary directory should be in your PATH environment variable, otherwise, it's something like:
C:\path\to\php.exe vendor\bin\doctrine.php orm:info

Copy doctrine.bat (located at vendor/bin/doctrine.bat) to your project root directory
Create a bootstrap.php file in any path inside your project root directory with the following content:
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
$paths = array("../model");
$isDevMode = false;
$dbParams = array(
'driver' => 'pdo_mysql',
'host' => 'localhost',
'user' => 'root',
'password' => '',
'dbname' => 'angular_php',
);
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$entityManager = EntityManager::create($dbParams, $config);
Create a cli-config.php file in your project root directory with the following content:
<?php
use Doctrine\ORM\Tools\Console\ConsoleRunner;
// replace with file to your own project bootstrap
require_once 'path/to/file/bootstrap.php';
return ConsoleRunner::createHelperSet($entityManager);
Execute from a command line window (CMD):
c:\path\to\project\root\directory>doctrine --help
It's done!

I found it wasnt returning anything from the doctrine.php.bat. Turns out it was a PHP error in my cli-config.php file

Using Cygwin on Windows with doctrine installed via composer, was having the same problem
resolved by:
vendor/bin/doctrine.bat orm:convert-mapping
if you are still having issues you can run the cli script using php to get the console tools running:
for example
php cli-config.php orm:schema-tool:create

All the answers on this question are either outdated or outright incorrect. In my case, I observed, after installing the the library, the "\vendor\doctrine\orm\" folder was completely empty. The docs ask you to run vendor/bin/doctrine, which in turn attempts to call "vendor\doctrine\orm\bin\doctrine[.php]" (The php file extension is optional). After discovering this, I downloaded the library from the git repository and replaced the composer-installed version.
php vendor/doctrine/orm/bin/doctrine
then works fine.
Also, beware of the common misconception that the cli-config.php file must exist in the root of your project. It's fine to leave it in your config folder

Related

Laravel cannot find public dir

I worked on a team and then clone the laravel/php codes from our repository. When I serve the laravel on localhost, it cannot find all the file inside the public directory and throw an error on the terminal:
[404]: GET /public/css/style.css - No such file or directory
Many answers to similar issues advise me to change the codes in the blade.php file. The problem is that I can't edit the blade.php because it works fine on other team members even though we have the same ubuntu, PHP, and laravel version and .env file.
What I have tried:
Run composer install and composer update
Try different browsers such as firefox and chromium-based browsers
Run php artisan storage:link
Restart apache2
Run npm install and npm run dev
I think there is some package or something missing.
List of paths I get from dd($__data):
"path" => "/project-directory/project-name/app"
"path.base" => "/project-directory/project-name"
"path.lang" => "/project-directory/project-name/resources/lang"
"path.config" => "/project-directory/project-name/config"
"path.public" => "/project-directory/project-name/public"
"path.storage" => "/project-directory/project-name/storage"
"path.database" => "/project-directory/project-name/database"
"path.resources" => "/project-directory/project-name/resources"
"path.bootstrap" => "/project-directory/project-name/bootstrap"
Have you tried?
php artisan storage:link
You need first run
php artisan storage:link
For more details check https://laravel.com/docs/8.x/filesystem
Then you must be check your .env values.
Is correctly APP_URL=
Also in your exception is strange
/public/.../...
Reason is wrong configuration.
First check your .env values like
APP_URL=...
FILESYSTEM_DRIVER=public
then check config/filesystems.php

Using encore webpack with symfony project

I'm using the Encore/Webpack in my Symfony project, but Im having troubles with the installation.
I'm following the official guide: Link to official guide
My project folder:
projectname
---/app
---/assets
/css
/global.scss
/js
/main.js
...
---/node_modules
/.bin
/encore
...
---/web
/build
etc
I was following
Create a new file called webpack.config.js at the root of your
project.
It looks like:
projectname
...
webpack.config.js
I filled it with the example code. Afterwards I wanted to 'build' the assets with the command encore dev on path: projectname\node_modules\.bin
When I do this, I get the following error code:
Running webpack ...
No configuration file found and no output filename configured via CLI option.
A configuration file could be named 'webpack.config.js' in the current directory.
Use --help to display the CLI options.
I have no idea what I'm doing wrong. When I move the webpack.config.js to the .bin folder.. that part works, but than the build doesn't work, because it wants to install the files into .../.bin/build/ which is not correct. I want it into projectname/build like the example.
try this commend it's work for me
install webpack-notifier#^1.6.0 --save-dev

php - ./yiic rresque start does nothing

I installed this extension http://www.yiiframework.com/extension/yii-resque/
user#host:/path/to/protected$ ./yiic rresque start
Yii command runner (based on Yii v1.1.13)
Usage: ./yiic <command-name> [parameters...]
The following commands are available:
- message
- migrate
- shell
- webapp
To see individual command help, use the following:
./yiic help <command-name>
What's might be wrong?
EDIT
I figured out the problem: I didn't put RResqueCommand.php into ./protected/commands folder.
Put RResqueCommand.php inside protected/commands
According the yii docs:
Console commands are stored as class files under the directory specified by CConsoleApplication::commandPath.
By default, this refers to the directory protected/commands.
Put this into your config/console.php:
'import' => array(
'application.models.*',
'application.components.*',
),

behat.yml in app/config instead of root directory

I installed behat with mink and selenium2-driver for my Symfony2 project.
Is it possible to use the /app/config/behat.yml instead of the /behat.yml file?
I searched on google but I can't find anything else this command.
php bin/behat --config app/config/behat.yml
But the command isn't working either.
I think there must be a config-path in composer.json.
Yes, you can configure which config file you want to use. Look at this part of the doc.
http://docs.behat.org/guides/7.config.html#paths
What error do you get when running your command?
php bin/behat --config app/config/behat.yml
This error?
[RuntimeException]
Context class not found.
Maybe you have provided a wrong or no `bootstrap` path in your behat.yml:
http://docs.behat.org/guides/7.config.html#paths
If that's the case, I think if might be because you need to specify where to find the features in your behat.yml file.
Now you moved the file to /app/config/behat.yml, the related path from behat.yml to the feature directory has changed, so you should add the following to the file:
default:
paths:
features: ../features/
bootstrap: ../features/bootstrap

Installation of a symfony2 bundle (DoctrineCouchDBBundle)

I wish to install the bundle into my symfony project. However, I am coming across a few issues. Please accept my ignorance if the answer is trivial but I've tried searching for a solution but alas, I've found nothing.
In my deps file, I have:
[doctrine-couchdb]
git=http://github.com/doctrine/couchdb-odm.git
[DoctrineCouchDBBundle]
git=http://github.com/doctrine/DoctrineCouchDBBundle.git
target=/bundles/Symfony/Bundle/DoctrineCouchDBBundle
I run the bin/vendors install command
In my autoload.php file I have:
'Doctrine\\ODM\\CouchDB'=> __DIR__.'/../vendor/doctrine-couchdb/lib',
I've registered the bundle:
new Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle()
When I run php app/console I get the error:
Fatal error: Class 'Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle' not found in /var/www/symfony2.test/app/AppKernel.php on line 22
I've noticed that for MongoDB ODM you have:
[doctrine-mongodb]
git=http://github.com/doctrine/mongodb.git
is there not a doctrine-couchdb repo? Have you used this bundle?
I changed target to
target= /bundles/Doctrine/Bundle/CouchDBBundle
so now looks like this
[DoctrineCouchDBBundle]
git=http://github.com/doctrine/DoctrineCouchDBBundle.git
target=/bundles/Doctrine/Bundle/CouchDBBundle
because I noticed that name space for couchdb bundle is
namespace Doctrine\Bundle\CouchDBBundle;
therefore adding
new Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle()
to AppKernel will fail, if installation location does not match namespace/class_name.
Detailed setup and configuration here DoctrineCouchDBBundle Git Hub Issue Log
For those that are new to Symfony 2 bundling architecture, you probably wonder what configuration keys are mandatory and available for bundles. Info can be obtained from:
bundle_dir/bundle_name/.../configuration.php
Update :
1.) Check that you also have installed and autoloaded Doctrine\CouchDB
2.) in your git installation
target=/bundles/Symfony/Bundle/DoctrineCouchDBBundle should probably be
target=/bundles/Doctrine/Bundle/DoctrineCouchDBBundle (notice Symfony => Doctrine)
3.) Then change
'Doctrine' => __DIR__.'/../vendor/doctrine/lib',
to
'Doctrine' => array(__DIR__.'/../vendor/doctrine/lib', __DIR__.'/../vendor/bundles'),
Off the top of my head I'd assume either these things:
1.) Cache
2.) 'Doctrine\\ODM\\CouchDB'=> __DIR__.'/../vendor/doctrine-couchdb/lib',
should be above any higher level namespaces ('Doctrine', 'Doctrine\Common')
so it should look like this:
'Doctrine\\ODM\\CouchDB'=> __DIR__.'/../vendor/doctrine-couchdb/lib',
'Doctrine\\DBAL' => __DIR__.'/../vendor/doctrine-dbal/lib',
'Doctrine' => __DIR__.'/../vendor/doctrine/lib',
3.) some configuration missing in config.yml

Categories