Doctrine Website
  1. Doctrine Website
  2. DWEB-56

Doctrine 2 - sample cli-config.php in "Getting Started XML-Edition" documentation is incorrect.

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Component/s: Documentation
    • Labels:
      None
    • Environment:
      Doctrine Version 2.0.0BETA3

      Description

      From this page: http://www.doctrine-project.org/projects/orm/2.0/docs/cookbook/getting-started-xml-edition/en

      The contents of the sample cli-config.php file are:

      <?php
      $cliConfig = new Doctrine\Common\Cli\Configuration();
      $cliConfig->setAttribute('em', $entityManager);

      This generates an error: Fatal error: require(): Failed opening required 'Doctrine\Common\Cli\Configuration.php' as the class referenced does not exist.

      Futhermore, having examined the $entityManager variable, it is not set and evaluates to NULL.

        Activity

        Hide
        Daniel Moore added a comment -

        After trying to get this work for a while, it seems you need to put something like this in cli-config.php (where index.php is the "obtaining the entity manager" snippet further up the page):

        <?php
        include "index.php";

        $helpers = array(
        'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($entityManager->getConnection()),
        'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($entityManager)
        );

        $helperSet = new \Symfony\Components\Console\Helper\HelperSet($helpers);

        Show
        Daniel Moore added a comment - After trying to get this work for a while, it seems you need to put something like this in cli-config.php (where index.php is the "obtaining the entity manager" snippet further up the page): <?php include "index.php"; $helpers = array( 'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($entityManager->getConnection()), 'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($entityManager) ); $helperSet = new \Symfony\Components\Console\Helper\HelperSet($helpers);

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Daniel Moore
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: