Get support for KnpLabs/rad-auto-registration

If you're new to LTH, please see our FAQ for more information on what it is we do.

Support Options

Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:

View Open Issues

Take a look to see if anyone else has experienced the same issue as you and if they managed to solve it.

Open an Issue

Make sure to read any relevant guidelines for opening issues on this repo before posting a new issue.

Sponsor directly

Check out the page and see if there are any options to sponsor this project or it's developers directly.

KnpLabs/rad-auto-registration

DEPRECATED

Unfortunately we decided to not maintain this project anymore (see why). If you want to mark another package as a replacement for this one please send an email to hello@knplabs.com.

Rapid Application Development : Auto-Registration

Auto register some common services

Build Status Scrutinizer Code Quality Latest Stable Version Total Downloads Latest Unstable Version License

Official maintainers:

Installation

composer require knplabs/rad-auto-registration:~2.0
class AppKernel
{
    function registerBundles()
    {
        $bundles = array(
            //...
            new Knp\Rad\AutoRegistration\Bundle\AutoRegistrationBundle($this), // !! Do not forget to inject the kernel !!
            //...
        );

        //...

        return $bundles;
    }
}

Use

Doctrine repositories auto-registration

Just activate doctrine (or doctrine_mongodb ou doctrine_couchdb depending on your needs) into your configuration.

knp_rad_auto_registration:
    enable:
        doctrine: ~
        doctrine_mongodb: ~
        doctrine_couchdb: ~

Now all repositories are auto-registred.

Entity Repository
MyProjectBundle\Entity\User my_project_bundle.entity.user_repository
TheOtherBundle\Entity\Model\Address the_other_bundle.model.user.address_repository
MyProjectBunde\Document\User my_project_bundle.document.user_repository

Requirements

Your doctrine entity (or documents) should be stored under Entity, Document or Model sub-namespace.

Constraint validators

Just activate constraint_validator into your configuration.

knp_rad_auto_registration:
    enable:
        constraint_validator: ~

Now all custom constaint validators are auto-registered.

Requirements

Your constraint validators should be stored under Validation or Validator sub-namespace.

Form extensions

Just activate form_type_extension into your configuration.

knp_rad_auto_registration:
    enable:
        form_type_extension: ~

Now all form type extensions are auto-registred.

Requirements

Your form type extensions should be stored under Form sub-namespace.

Security voters

Just activate security_voter into your configuration.

knp_rad_auto_registration:
    enable:
        security_voter: ~

Now all the voters are auto-registered.

Requirements

Your security voters should be stored under Security sub-namespace.

Twig extensions

Just activate twig_extension into your configuration.

knp_rad_auto_registration:
    enable:
        twig_extension: ~

Now all Twig extensions are auto-registered.

Requirements

Your Twig extensions should be stored under Twig or Templating sub-namespace.

Public/Private services

By default, all autoregistered services are marked as private (public: false). You can overide this behavior by setting the public parameter to true.

Example:

knp_rad_auto_registration:
    enable:
        doctrine:
            public: true
        doctrine_mongodb:
            public: false
        doctrine_couchdb:
            public: false

Restrictions

Autoloading

  • Only services without constructor or without required parameters into the constructor will be auto-registred.
  • If a service already exists, it will not be erased.

Bundle

You can apply auto-registration on only certains bundle. You just have to add a bundles configuration:

knp_rad_auto_registration:
    enable:
        # ...
    bundles: [ App, ProductBundle ]

WARNING

All auto-registered services are set as private, so it's impossible to get them by using $container->get('service_name'). If needed, create the service definition by yourself.

Our Mission

We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.

Interesting Articles

Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated

p-e622a1a2