Download the PHP package umanit/doctrine-singleton-bundle without Composer

On this page you can find all versions of the php package umanit/doctrine-singleton-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package doctrine-singleton-bundle

Doctrine Singleton Bundle

This bundle intends to easily create complex singleton entities (totally unique, or based on some properties). Sonata Admin friendly with automatic integration.

Install

Register the bundle to your 'app/AppKernel.php'

That's it!

Usage

Tell that your entity is a singleton

Just need to implement the Umanit\DoctrineSingletonBundle\Model\SingletonInterface

Now, if you try to create 2 entities of type "Page", you'll get a NonUniqueException

More complex unicity

If you want to implement a more complex unicity, for example, you want the entity to be unique per local, you can subscribe to the FilterSingletonEvent::SINGLETON_FILTER_EVENT event to modify the filters (filters are used in a findBy() clause)

e.g (from TranslationBundle)

services.yml

Get singleton

In order to get your singleton instances, you can use the provided helpers for your PHP code or twig :

The method getSingleton($className, array $filters = [], $instantiateIfNotFound = false) can take from 1 to 3 arguments :

Integrating into SonataAdmin

The bundle will automatically remove add and list button from the list and the edit view.

If you use the UmanitDoctrineSingletonBundle:Sonata\SingletonCRUD as a controller for your admin class, you'll have a redirection to create if there's no entity found, to edit if there's only one, and to list if you have more than one.

e.g :


All versions of doctrine-singleton-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
symfony/framework-bundle Version >=5.0
doctrine/doctrine-bundle Version ^2.7
doctrine/orm Version ^2.13
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package umanit/doctrine-singleton-bundle contains the following files

Loading the files please wait ....