Download the PHP package ibrows/association-resolver-bundle without Composer

On this page you can find all versions of the php package ibrows/association-resolver-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 association-resolver-bundle

Important:

This Bundle is now stored here: https://gitlab.pwc-digital.ch/ec/bundles/IbrowsAssociationResolverBundle

iBrows Association Bundle

A simple bundle to resolve associations on entities when they'll be imported from an external source

Create an annotation

See Annotation/OneToMany.php

In this case I'm going to create a new OneToMany-annotation for this bundle. Therefore I create a new class called OneToMany in the 'Annotation' folder and annotate the class with code>@AnnotationAbstractAssociation If you need to add some properties which can be configured in the annotation create a public property in the Annotation and create the getter/setter

Create the resolver

See Resolver/Type/OneToMany.php

To handle the entity with our annotation @OneToMany we have to create a resolver with the exact same name as the annotation class name. Our resolver extends the AbstractResolver to handle the annotated entity correctly. While extending the AbstractResolver we have to implement an abstract function to handle an entity and recive all the configurated properties.

    
        /**
         * @param ResultBag $resultBag
         * @param AssociationMappingInfoInterface $mappingInfo
         * @param string $propertyName
         * @param mixed $entity
         * @param OutputInterface $output
         * @return ResolverInterface
         */
        public function resolveAssociation(
            ResultBag $resultBag,
            AssociationMappingInfoInterface $mappingInfo,
            $propertyName,
            $entity,
            OutputInterface $output
        )
    

in the function body we extract the data from the mappinginfo for further operations. Inside the MappingInfo object where two properties. The Annotation and the Metadata. The Annotation object holds all the data which can be configured in the annotation. In our case we have 2 properties

public $collectionAddFunctionName;
public $collectionRemoveFunctionName;

collectionAddFunctionName to customize the add function. If this property is not set the method name will be generated with an 'add' as prefix and the propertyname as suffix

collectionRemoveFunctionName to customize the remove function. If this property is not set the method name will be generated with an 'remove' as prefix and the propertyname as suffix

The Service

To make the resolver functional you have to register the resolver as a service in the service.xml

<service id="ibrows_associationresolver.resolver.onetoone" class="Ibrows\AssociationResolver\Resolver\Type\OneToOne">
    <argument type="service" id="doctrine.orm.entity_manager" />
    <tag priority="-20" name="ibrows_associationresolver.resolverchain" />
    <call method="setSoftdeletable">
        <argument>%ibrows_associationresolver.softdelete%</argument>
    </call>
    <call method="setSoftdeletableGetter">
        <argument>%ibrows_associationresolver.softdeletegetter%</argument>
    </call>
</service>
´

The tag defines the position in the chain.


All versions of association-resolver-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
symfony/framework-bundle Version >=2.1
ibrows/annotation-reader Version 1.*
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 ibrows/association-resolver-bundle contains the following files

Loading the files please wait ....