Download the PHP package cube/doctrine-entity-factory without Composer

On this page you can find all versions of the php package cube/doctrine-entity-factory. 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-entity-factory

Doctrine Entity Factory

Build Status Code Coverage Packagist Author License

A factory pattern for creating new Doctrine entities. Since Doctrine 2.0 entities may be created which use the constructor. In order to create a standard factory pattern which may be implemented across libraries which implement Doctrine this repository provides an interface for factories to create an entity which is to be newly persisted to the object manager.

Installation

Installation of this module uses composer. For composer documentation, please refer to getcomposer.org.

What Problem does this Solve?

Let's say you have a class that, at some point, has to instantiate a new Doctrine entity. A good example is DoctrineResource from the zfcampus/zf-apigility-admin project, simplified below:

The problem with the code above is that their users can't instantiate any entities that have required parameters in the constructor. They also can't use a named constructor to instantiate the object if they wanted to. There could be many reasons why they have required parameters in their entity's constructor, but since Doctrine is designed to allow that then so should you. Moreover, in the example above DoctrineResource is acting as the de-facto factory for the entities, which is one responsibility too many for that class.

The solution is to decouple the instantiation of your user's Doctrine entities from your library. So we created an interface, EntityFactoryInterface, that can be used by any library that needs a new instance of a Doctrine entity, but wants to delegate the process of actually building that entity. Your updated class would look as follows:

And now your class doesn't need to actually instantiate the Doctrine entity!

Yet Another Library (roll eyes)?

Yes, because the use-case described above happens quite often actually around several Doctrine libraries. By providing a decentralized interface we can make all of these other libraries delegate instantiation to the same type of factory.

This library also provides two simple implementations:

Other implementations are possible, and the most common will probably be end-user factories that know how to instantiate their entities very well.

Is This Library for Me?

This library is for you if you're distributing code that needs a new instance of a Doctrine entity, but you don't personally have (or want!) any knowledge or control over HOW that entity must be instantiated.

License

See LICENSE.md


All versions of doctrine-entity-factory with dependencies

PHP Build Version
Package Version
Requires php Version ^5.6|^7.0
squizlabs/php_codesniffer Version ^2.6
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 cube/doctrine-entity-factory contains the following files

Loading the files please wait ....