shapecode/repository-as-a-service

This package is abandoned and no longer maintained. No replacement package was suggested.

Symfony2 Bundle which you can register repositories easily.

2.0.0 2018-06-12 13:14 UTC

README

SensioLabsInsight Dependency Status Latest Stable Version Total Downloads License

This bundle allows to register repositories as a service.

Install instructions

Installing this bundle can be done through these simple steps:

Add the bundle to your project as a composer dependency:

// composer.json
{
    // ...
    require: {
        // ...
        "shapecode/repository-as-a-service": "~1.2"
    }
}

Update your composer installation:

$ composer update

Add the bundle to your application kernel:

<?php

// application/ApplicationKernel.php
public function registerBundles()
{
	// ...
	$bundle = array(
		// ...
        new Shapecode\Bundle\RasSBundle\ShapecodeRasSBundle(),
	);
    // ...

    return $bundles;
}

Start using the bundle and set repositories as services:

app.repository.example:
    class: %app.repository.example.class%
    tags:
        -  { name: doctrine.repository, class: %app.entity.example.class%, alias: example_repository }

or let the bundle do the job for you. It creates automatically services for you. Just access it with "lowercaseentitnyname_repository".

<?php

$this->getContainer()->get('lowercaseentitnyname_repository');

The old way to get repository is also supported. If you get them like this ...

<?php

$this->getRepository('ShapecodeRasSBundle:TestEntity');

... you get the service off the repository instead.