Skip to content
Browse files

dev release

  • Loading branch information...
0 parents commit 0e682ea12e7e411137feea71a6a8546f42bab096 heartsentwined committed Sep 12, 2012
Showing with 82 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +21 −0 README.md
  3. +4 −0 bin/doctrine-cli
  4. +32 −0 bin/doctrine-cli.php
  5. +22 −0 composer.json
3 .gitignore
@@ -0,0 +1,3 @@
+.git/
+vendor/
+composer.lock
21 README.md
@@ -0,0 +1,21 @@
+# zf2-doctrine
+
+wrapper for DoctrineORMModule + DoctrineModule's CLI, tailored for yaml config files
+
+The official CLI looks for `config/application.config.php`. This wrapper looks for `config/application.yml`.
+
+# Installation
+
+[Composer](http://getcomposer.org/):
+
+```json
+{
+ "require": {
+ "heartsentwined/zf2-doctrine": "dev-master"
+ }
+}
+```
+
+# Usage
+
+Call (modified) CLI at `vendor/bin/doctrine-cli`.
4 bin/doctrine-cli
@@ -0,0 +1,4 @@
+#!/usr/bin/env php
+<?php
+
+include('doctrine-cli.php');
32 bin/doctrine-cli.php
@@ -0,0 +1,32 @@
+<?php
+use Zend\ServiceManager\ServiceManager;
+use Zend\Mvc\Application;
+
+ini_set('display_errors', true);
+chdir(__DIR__);
+
+$previousDir = '.';
+
+while (!file_exists('config/application.config.yml')) {
+ $dir = dirname(getcwd());
+
+ if ($previousDir === $dir) {
+ throw new RuntimeException(
+ 'Unable to locate "config/application.config.yml": ' .
+ 'is DoctrineModule in a subdir of your application skeleton?'
+ );
+ }
+
+ $previousDir = $dir;
+ chdir($dir);
+}
+
+if (!(@include_once __DIR__ . '/../vendor/autoload.php') && !(@include_once __DIR__ . '/../../../autoload.php')) {
+ throw new RuntimeException('Error: vendor/autoload.php could not be found. Did you run php composer.phar install?');
+}
+
+$application = Application::init(Symfony\Component\Yaml\Yaml::parse('config/application.config.yml'));
+
+/* @var $cli \Symfony\Component\Console\Application */
+$cli = $application->getServiceManager()->get('doctrine.cli');
+$cli->run();
22 composer.json
@@ -0,0 +1,22 @@
+{
+ "name": "heartsentwined/zf2-doctrine",
+ "description": "wrapper for DoctrineORMModule + DoctrineModule's CLI, tailored for yaml config files",
+ "license": "GPL-3.0",
+ "keywords": ["cli", "zf2", "doctrine"],
+ "homepage": "https://github.com/heartsentwined/zf2-doctrine",
+ "authors": [
+ {
+ "name": "heartsentwined",
+ "email": "heartsentwined@cogito-lab.com",
+ "role": "Developer"
+ }
+ ],
+ "bin": ["bin/doctrine-cli"]
+ "require": {
+ "php": ">=5.3.3",
+ "symfony/yaml": "2.0.*"
+ },
+ "require-dev": {
+ "doctrine/doctrine-orm-module": "dev-master"
+ }
+}

0 comments on commit 0e682ea

Please sign in to comment.
Something went wrong with that request. Please try again.