weew/app-doctrine

Integrates doctrine in to the weew/app package.

v1.17.0 2016-08-28 11:19 UTC

README

Build Status Code Quality Test Coverage Version Licence

Table of contents

Installation

composer require weew/app-doctrine

Introduction

This package integrates doctrine/orm and doctrine/migrations into the weew/app framework.

Usage

Simply register the DoctrineProvider class on the application kernel:

$app = new App();
$app->getKernel()->addProviders([
    DoctrineProvider::class,
]);

Example config

This is how your config might look like in yaml:

doctrine:
  debug: true

  cache_path: path/to/cache
  proxy_classes_path: path/to/proxies
  metadata_format: "yaml" or "annotations"

  # required if metadata_format is "annotations"
  entities_paths:
    path/to/entities: Namespace\To\Entities

  # required if metadata_format is "yaml"
  entities_mappings:
    app:
      path: path/to/entities
      namespace: Some\Entities
    bundle:
      path: path/to/bundle/entities
      namespace: Other\Entities

  config:
    driver: pdo_mysql
    host: database_hostname
    dbname: database_name
    user: database_user
    password: database_password

  migrations:
    namespace: migrations/namespace
    path: migrations/directory/path
    table: migrations_table_name

Doctrine console

You can run doctrine console tool like this:

$doctrineProvider->runConsoleRunner();