Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2486

Getting started does not work with current release

    Details

    • Type: Documentation Documentation
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.4, 2.4.1
    • Fix Version/s: 2.4
    • Component/s: ORM
    • Security Level: All
    • Labels:
    • Environment:
      Ubuntu 12.04

      Description

      The tutorial states: "This tutorial assumes you work with Doctrine 2.3 and above. Some of the code will not work with lower versions."

      I'm using 2.3.4

      When running "php vendor/bin/doctrine orm:schema-tool:create"

      this happens:

      PHP Fatal error: Call to undefined method Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet() in /var/www/project/cli-config.php on line 5
      PHP Stack trace:
      PHP 1.

      {main}() /var/www/project/vendor/doctrine/orm/bin/doctrine:0
      PHP 2. include() /var/www/project/vendor/doctrine/orm/bin/doctrine:4
      PHP 3. require() /var/www/project/vendor/doctrine/orm/bin/doctrine.php:31

      Fatal error: Call to undefined method Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet() in /var/www/project/cli-config.php on line 5

      Call Stack:
      0.0001 619840 1. {main}

      () /var/www/project/vendor/doctrine/orm/bin/doctrine:0
      0.0003 632072 2. include('/var/www/project/vendor/doctrine/orm/bin/doctrine.php') /var/www/project/vendor/doctrine/orm/bin/doctrine:4
      0.0012 730208 3. require('/var/www/project/cli-config.php') /var/www/project/vendor/doctrine/orm/bin/doctrine.php:31

      This is because some commits are not yet in the release. The current GIT version probably works but is not an option for me.

        Activity

        Julian Picht created issue -
        Hide
        Benton Jackson added a comment -

        I'm seeing this problem too. Kinda hard to learn Doctrine when the tutorial is brain dead.

        Show
        Benton Jackson added a comment - I'm seeing this problem too. Kinda hard to learn Doctrine when the tutorial is brain dead.
        Hide
        Benton Jackson added a comment -

        "CreateHelperSet" appears to be a method in 2.4. I adapted the "2.3 configuring the command line" code to make my "cli-config.php" file read like this, and it appears to work:

        <?php
        // cli-config.php
        require_once "bootstrap.php";

        $em = $entityManager;

        $helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(
        'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
        'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
        ));

        Show
        Benton Jackson added a comment - "CreateHelperSet" appears to be a method in 2.4. I adapted the "2.3 configuring the command line" code to make my "cli-config.php" file read like this, and it appears to work: <?php // cli-config.php require_once "bootstrap.php"; $em = $entityManager; $helperSet = new \Symfony\Component\Console\Helper\HelperSet(array( 'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()), 'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em) ));
        Hide
        Stephen Westman added a comment -

        Thanks to Benton, I now have a working Doctrine app. I agree that it would be nice to have had this taken care of before release. However, as an old time guerrilla-type programmer, I can do "whatever works"!

        Thanks again, Benton!

        Show
        Stephen Westman added a comment - Thanks to Benton, I now have a working Doctrine app. I agree that it would be nice to have had this taken care of before release. However, as an old time guerrilla-type programmer, I can do "whatever works"! Thanks again, Benton!
        Hide
        Mortensen Cristian added a comment -

        Thanks Benton!

        Show
        Mortensen Cristian added a comment - Thanks Benton!
        Hide
        Benjamin Eberlei added a comment -

        2.4 is now released and the tutorial works, sorry for the long disconnect

        Show
        Benjamin Eberlei added a comment - 2.4 is now released and the tutorial works, sorry for the long disconnect
        Benjamin Eberlei made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.4 [ 10321 ]
        Resolution Fixed [ 1 ]
        Hide
        Vishal Bandre added a comment -

        My working cli-config.php with latest fresh doctrine source as on Mar 03 2014.

        Windows XP - Access doctrine without using php command like > vendor\bin\doctrine.

        <?php // cli-config.php
        use Doctrine\ORM\Tools\Console\ConsoleRunner;

        // replace with file to your own project bootstrap
        require_once 'bootstrap.php';

        // replace with mechanism to retrieve EntityManager in your app
        // $entityManager = GetEntityManager();

        $em = $entityManager;
        $helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(
        'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
        'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
        ));
        return ConsoleRunner::createHelperSet($em);

        Show
        Vishal Bandre added a comment - My working cli-config.php with latest fresh doctrine source as on Mar 03 2014. Windows XP - Access doctrine without using php command like > vendor\bin\doctrine. <?php // cli-config.php use Doctrine\ORM\Tools\Console\ConsoleRunner; // replace with file to your own project bootstrap require_once 'bootstrap.php'; // replace with mechanism to retrieve EntityManager in your app // $entityManager = GetEntityManager(); $em = $entityManager; $helperSet = new \Symfony\Component\Console\Helper\HelperSet(array( 'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()), 'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em) )); return ConsoleRunner::createHelperSet($em);
        Hide
        Igor Timoshenkov added a comment -

        Hello, everyone.

        I am trying to follow the Tutorial, but I am stuck with the cli generation. Here is my cli-config.php file:

        <?php
        use Doctrine\ORM\EntityManager;
        use Doctrine\ORM\Tools\Console\ConsoleRunner;
        use Doctrine\ORM\Tools\Setup;

        require_once "vendor/autoload.php";

        $modelsPath = realpath(_DIR_.'/../model');
        $config = Setup::createAnnotationMetadataConfiguration(array($modelsPath), true);

        // database configuration parameters
        $conn = array(
        'driver' => 'pdo_sqlite',
        'host' => 'localhost',
        'user' => 'root',
        'password' => '',
        'dbname' => 'someDb',
        );

        return ConsoleRunner::createHelperSet(EntityManager::create($conn, $config));

        Now, when I run

        php vendor/bin/doctrine orm:schema-tool:create
        or
        php vendor/bin/doctrine orm:schema-tool:drop

        I get Access denied. What am I doing wrong?

        P.S. I am not using Symfony, Doctrine version is 2.4.1.

        Show
        Igor Timoshenkov added a comment - Hello, everyone. I am trying to follow the Tutorial , but I am stuck with the cli generation. Here is my cli-config.php file: <?php use Doctrine\ORM\EntityManager; use Doctrine\ORM\Tools\Console\ConsoleRunner; use Doctrine\ORM\Tools\Setup; require_once "vendor/autoload.php"; $modelsPath = realpath(_ DIR _.'/../model'); $config = Setup::createAnnotationMetadataConfiguration(array($modelsPath), true); // database configuration parameters $conn = array( 'driver' => 'pdo_sqlite', 'host' => 'localhost', 'user' => 'root', 'password' => '', 'dbname' => 'someDb', ); return ConsoleRunner::createHelperSet(EntityManager::create($conn, $config)); Now, when I run php vendor/bin/doctrine orm:schema-tool:create or php vendor/bin/doctrine orm:schema-tool:drop I get Access denied . What am I doing wrong? P.S. I am not using Symfony, Doctrine version is 2.4.1.
        Hide
        Vishal Bandre added a comment -

        Which db driver are you using?

        If you are using sqlite the conn parameters to be used are user, password, path, memory as described on http://docs.doctrine-project.org/projects/doctrine-dbal/en/2.0.x/reference/configuration.html but your connection array is showing wrong settings (these are MYSQL specific). Please check required db driver and try again.

        Show
        Vishal Bandre added a comment - Which db driver are you using? If you are using sqlite the conn parameters to be used are user, password, path, memory as described on http://docs.doctrine-project.org/projects/doctrine-dbal/en/2.0.x/reference/configuration.html but your connection array is showing wrong settings (these are MYSQL specific). Please check required db driver and try again.
        Hide
        Marco Pivetta added a comment - - edited

        Igor Timoshenkov's question was solved at http://stackoverflow.com/q/22336256/347063

        Basically, his vendor/bin/doctrine was broken, but running php vendor/doctrine/orm/bin/doctrine worked fine.

        Show
        Marco Pivetta added a comment - - edited Igor Timoshenkov 's question was solved at http://stackoverflow.com/q/22336256/347063 Basically, his vendor/bin/doctrine was broken, but running php vendor/doctrine/orm/bin/doctrine worked fine.
        Hide
        Igor Timoshenkov added a comment -

        Hi, guys.

        Igor Timoshenkov's question was solved at http://stackoverflow.com/q/22336256/347063

        My question is not solved.

        If you are using sqlite the conn parameters to be used are user, password, path, memory as described on http://docs.doctrine-project.org/projects/doctrine-dbal/en/2.0.x/reference/configuration.html but your connection array is showing wrong settings (these are MYSQL specific). Please check required db driver and try again.

        I have corrected the configuration parameters - I needed pdo_mysql, not pdo_sqlite. But the php vendor/bin/doctrine orm:schema-tool:create is still not working. Any ideas what else could that be?

        BTW, the link to the configuration should be added to the Tutorial.

        Show
        Igor Timoshenkov added a comment - Hi, guys. Igor Timoshenkov's question was solved at http://stackoverflow.com/q/22336256/347063 My question is not solved. If you are using sqlite the conn parameters to be used are user, password, path, memory as described on http://docs.doctrine-project.org/projects/doctrine-dbal/en/2.0.x/reference/configuration.html but your connection array is showing wrong settings (these are MYSQL specific). Please check required db driver and try again. I have corrected the configuration parameters - I needed pdo_mysql , not pdo_sqlite . But the php vendor/bin/doctrine orm:schema-tool:create is still not working. Any ideas what else could that be? BTW, the link to the configuration should be added to the Tutorial .
        Igor Timoshenkov made changes -
        Affects Version/s 2.4.1 [ 10528 ]
        Environment Ubuntu 12.04
        Priority Major [ 3 ] Minor [ 4 ]
        Labels Cli
        Hide
        Vishal Bandre added a comment -

        Will you please share/paste full error message here?

        Check for missing db password, etc.

        Show
        Vishal Bandre added a comment - Will you please share/paste full error message here? Check for missing db password, etc.

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-2486, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Julian Picht
          • Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: