diablomedia/doctrine1-bundle

Symfony Doctrine1Bundle

1.1.1 2024-04-30 18:03 UTC

README

Build Latest Stable Version Total Downloads License

Symfony Bundle for Doctrine1 ORM

This is heavily based on the Symfony/Doctrine DoctrineBundle (https://github.com/doctrine/DoctrineBundle) but adapted to work with Doctrine1. This bundle allows you to configure Doctrine1 through Symfony's configuration and also adds a section to the Symfony profiler/debug toolbar so you can view query information in the same way you would with the DoctrineBundle.

Installation

Install using composer:

composer require diablomedia/doctrine1-bundle

While this bundle should work with the original Doctrine1 library, we recommend using our fork that is better tested against recent versions of PHP.

composer require diablomedia/doctrine1

Configuration

Enable the Bundle in Symfony:

<?php
// config/bundles.php

return [
    // ...
    DiabloMedia\Bundle\Doctrine1Bundle\Doctrine1Bundle::class => ['all' => true],
    // ...
];

To configure your database connection, create a doctrine1.yaml file in your config/packages folder with the necessary connection credentials, here's a sample for mysql:

doctrine1:
    default_connection: writer
    connections:
        writer:
            url: '%env(resolve:WRITE_DATABASE_URL)%'
            cache_class: 'Doctrine_Cache_Array'
            enable_query_cache: true
            enable_result_cache: true
        reader:
            url: '%env(resolve:READ_DATABASE_URL)%'
            cache_class: 'Doctrine_Cache_Array'
            enable_query_cache: true
            enable_result_cache: true