brenodouglas/doctrineconfig

Utility config doctrine

dev-master / 1.3.x-dev 2015-08-01 18:24 UTC

This package is not auto-updated.

Last update: 2024-10-26 16:41:42 UTC


README

Integration doctrine in project Respect/Rest

Require PHP >= 5.3

In index.php

  require 'autoload.php';
  
  \RespectDoctrine\Doctrine\Doctrine::setConfigDir("config.php");
  $doctrine = new Doctrine();
  $em = $doctrine->getEntityManager();

In config.php

return [
  'database' => [
      
      'default' => 'mysql',
      
      'mysql' => [
          'dbname' => "application",
          'user' => 'root',
          'port' => null,
          'password' => '',
          'host' => 'localhost',
          'driver' => 'pdo_mysql'
      ],

      'pgsql' => [
          'dbname' => "application",
          'user' => 'root',
          'port' => 5232,
          'password' => '',
          'host' => 'localhost',
          'driver' => 'pdo_pgsql'
      ]

  ],

  'doctrine' => [
      /** Namespaces on Entity mapped */
      'entity' => [
          __DIR__."/Api/Entity"
      ],
      /** Dir of metadatas generate */
      'metadata' => __DIR__."/../cache/doctrine"
  ]
];