contributte / doctrine-migrations

:running: Doctrine Migrations for Nette Framework
https://contributte.org/packages/nettrine/migrations.html
MIT License
39 stars 15 forks source link

Use with kdyby/doctrine #3

Closed tkliner closed 6 years ago

tkliner commented 6 years ago

I would like to ask you if these migrations can be used with kdyby/doctrine and if so, how? Thank you in advance for your time.

tkliner commented 6 years ago

Because when I configure the contributte/console as the second console next to kdyby/console, I get this error:

InvalidArgumentException: You have to specify a --db-configuration file or pass a Database Connection as a dependency to the Migrations. in ../vendor/doctrine/migrations/lib/Doctrine/DBAL/Migrations/Tools/Console/Command/AbstractCommand.php:156: ./bin/console migrations:diff
f3l1x commented 6 years ago

Hi. Could you please test nettrine/migrations: dev-master branch?

tkliner commented 6 years ago

Hi. Still the same problem for dev-master :(

f3l1x commented 6 years ago

Could you send me a composer.json please? And how do you register Kdyby\Console and Contributte\Console?

tkliner commented 6 years ago

composer.json:

{
  "name": "nette/web-project",
  "description": "Nette: Standard Web Project",
  "type": "project",
  "license": [
    "MIT",
    "BSD-3-Clause",
    "GPL-2.0",
    "GPL-3.0"
  ],
  "require": {
    "php": ">= 7.1",
    "nette/application": "^2.4",
    "nette/bootstrap": "^2.4.2",
    "nette/caching": "^2.5",
    "nette/database": "^2.4",
    "nette/di": "^2.4",
    "nette/finder": "^2.4",
    "nette/forms": "^2.4",
    "nette/http": "^2.4",
    "nette/mail": "^2.4",
    "nette/security": "^2.4",
    "nette/utils": "^2.4",
    "latte/latte": "^2.4",
    "tracy/tracy": "^2.4",
    "kdyby/doctrine": "^3.0",
    "kdyby/events": "@dev",
    "kdyby/doctrine-cache": "@dev",
    "doctrine/data-fixtures": "^1.2",
    "guzzlehttp/guzzle": "~6.0",
    "symfony/console": "^3.3",
    "contributte/console": "dev-master",
    "nettrine/migrations": "^0.1.0"
  },
  "require-dev": {
    "codeception/codeception": "^2.3",
    "fzaninotto/faker": "^1.7"
  },
  "minimum-stability": "stable",
  "autoload": {
    "psr-4": {
      "Cli\\": "bin/",
      "App\\": [
            "app/"
      ]
    }
  }
}

nette config:

extensions:
    console: Kdyby\Console\DI\ConsoleExtension
    events: Kdyby\Events\DI\EventsExtension
    annotations: Kdyby\Annotations\DI\AnnotationsExtension
    doctrine: Kdyby\Doctrine\DI\OrmExtension
    console_new: Contributte\Console\DI\ConsoleExtension
console_new:
    name: HbbTV Dashboard
    version: 1.0
    catchExceptions: false
    autoExit: true
    url: http://contributte.com
    helpers:
        - Contributte\Console\Helper\ContainerHelper`
decorator:
    Symfony\Component\Console\Command\Command:
        tags: [kdyby.console.command]
f3l1x commented 6 years ago

Could you please test v0.2 with decorator setup like that?

decorator:
    Symfony\Component\Console\Command\Command:
        tags: [kdyby.console.command]
    Symfony\Component\Console\Helper\Helper:
        tags: [kdyby.console.helper]
tkliner commented 6 years ago

The problem still remains, I will try on a clean project

josefbenjac commented 6 years ago

You dont need both consoles. I prepared examples of use migrations. So take a look.

https://github.com/nettrine/playground/tree/master/migrations/contributte_nettrine https://github.com/nettrine/playground/tree/master/migrations/kdyby

Nettrine Orm/Dbal is not ready yet. But migrations work fine right now.

tkliner commented 6 years ago

ok thank you many times for examples, just have a question. I tried example with kdyby/console and where are the migrations configured? The command migrations:generate always generates the migration file to the root of the application instead of in the migrations folder, as shown in the example.

Config

extensions:
    console: Kdyby\Console\DI\ConsoleExtension
    events: Kdyby\Events\DI\EventsExtension
    annotations: Kdyby\Annotations\DI\AnnotationsExtension
    doctrine: Kdyby\Doctrine\DI\OrmExtension
    migrations: Nettrine\Migrations\DI\MigrationsExtension

migrations:
    table: doctrine_migrations
    column: version
    directory: %appDir%/../migrations
    namespace: Migrations
    versionsOrganization: null # null, year, year_and_month
f3l1x commented 6 years ago

@tkliner Do you use nettrine/migrations: v0.2.0?

Could you join us and reach us on Gitter? We'd discuss it there.

https://gitter.im/nettrine/nettrine

f3l1x commented 6 years ago

Already solved.

Tomáš Kliner @tkliner lis 26 16:08 @f3l1x the problem was caused by the missing decorator in config file: Symfony\Component\Console\Helper\Helper: tags: [kdyby.console.helper] thank you for your help and your time, I appreciate it