Download the PHP package vrok/ref-helper without Composer

On this page you can find all versions of the php package vrok/ref-helper. 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 ref-helper

Reference Helper

Library to support polymorphic asssociations with Doctrine 2 in Zend Framework 3.

Build Status Coverage Status

Many applications have polymorphic relations where we don't know (and don't want to know in advance) which entities may be assigned to which (e.g. which entity is owned by which). For example a bank account may be owned by an user or an organization, a validation may belong to a bank account or an user.

To support this loose coupling we store the class of the referenced entity and the identifiers forming the primary key (e.g. autoincrement or composite keys) in the referencing entity in separate columns. The referencing entities should be kept simple POPOs, they need to implement , which is implemented in for re-use. The interface and trait support multiple references on one entity, for example to reference a creator and an owner.

The builds on this principle by providing functions to set and retrieve the referenced entities. The helper also has the ability to restrict references to only one or some targeted classes.

Usage

Entity preparation

1) Implement the on your entity that should store the reference to another object, use for simplicity 2) Add one or more references to the entity by defining the property and , properties for each reference

Now and can store references to any other Doctrine entity.

Set & get references with the ReferenceHelper

Using the you can now set and fetch references:

Restrict reference target classes

To restrict the ReferenceHelper to allow only one or some classes as targets add something like this to your config:

Now for the reference only instances of (and child classes) are accepted. Every other reference on will still allow every target class. Entity classes not listed in accept every target for every reference.

Querying for entities

Because is a separate column from the identifiers we can easily filter for every object referencing an entity of class :

We can also use the to get the values to filter for usage in a queryBuilder etc:

The ReferenceHelper can not add the conditions to a given QueryBuilder for you because it would have to know the alias to use (e.g. if you are using joins) and wether to to combine with previous conditions using "AND" or "OR". Maybe you even want to search for multiple conditions at once:


All versions of ref-helper with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
doctrine/doctrine-orm-module Version ^1.1.5
zendframework/zend-servicemanager Version ^3.3.2
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 vrok/ref-helper contains the following files

Loading the files please wait ....