Download the PHP package tbn/query-builder-repository-generator-bundle without Composer

On this page you can find all versions of the php package tbn/query-builder-repository-generator-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 query-builder-repository-generator-bundle

QueryBuilderRepositoryGeneratorBundle

The QueryBuilderRepositoryGeneratorBundle generates Repositories in the repository folders

The functions allow to filter on the columns of the entity with a query builder.

See the create queries section for an example.

Installation

Import the bundle using composer

composer require --dev "tbn/query-builder-repository-generator-bundle"

Import the bundle in your AppKernel

if ('dev' === $this->getEnvironment()) {
    $bundles[] = new Tbn\QueryBuilderRepositoryGeneratorBundle\QueryBuilderRepositoryGeneratorBundle();
}

Configuration

Mandatory configuration

Add the bundles you want:

    query_builder_repository_generator:
        bundles:
            - "<<YourBundleName>>"

Those bundles will have the repositories generated in the Repository directory of the bundles. Check the content by yourself.

Optional configuration

    query_builder_repository_generator:
        templates:
            top_repository: "QueryBuilderRepositoryGeneratorBundle:Generator:TopRepositoryTemplate.html.twig"
            column: "QueryBuilderRepositoryGeneratorBundle:Generator:ColumnTemplate.html.twig"
            association: "QueryBuilderRepositoryGeneratorBundle:Generator:AssociationTemplate.html.twig"
            bottom_repository: "QueryBuilderRepositoryGeneratorBundle:Generator:BottomRepositoryTemplate.html.twig"
    mapping:
        - 'AppBundle\Entity\Member':
            querybuilder_name: 'memberEntity' # the name of the entity used in the queryBuilder

The repository extends

You can specify a class to extends for each entity.

    repositories_extensions:
        - "AcmeBundle\Entity\Item": #the entity class
            extension_class: "\\Gedmo\\Tree\\Entity\\Repository\\MaterializedPathRepository" #the class to extends

The templates used by the generator can be set with these configurations.

    top_repository => The beginning of the repository file
    column => The template used for each column
    extra_column => A custom template of your choice
    bottom_repository => The end of the repository file

The extra_column template have the following variables:

    'entity' => $tableName,
    'entityDql' => lcfirst($tableName),
    'column' => ucfirst($columnName),
    'columnDql' => $columnName

Use generated repositories

In your Entity Repository, extends the generated repository.

    class UserRepository extends UserRepositoryBase

Your repository has now some predefined function like "filterById", "filterInId" for all the columns.

Create queries

Example:

    $qb = $this->createQueryBuilder('document');

    //filter on current user (where XX = YY)
   DocumentRepository::filterByUser($qb, $user);
   //filter on the extension list (where xxx IN () )
   DocumentRepository::filterInExtension($qb, $extensionList);

   //Join the tag entity
   $qb->join('document.tags', 'tag');
   //filter on the tag entity
   TagRepository::filterById($qb, $tagButton);

Regenerate files

Run the command:

php app/console qbrg:generate

All versions of query-builder-repository-generator-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
symfony/maker-bundle Version ^1.7
symfony/framework-bundle Version ^5.4|^6.0|^7.0
doctrine/doctrine-bundle Version ^2.10
symfony/twig-bundle Version ^5.4|^6.0|^7.0
doctrine/orm Version ^2.10
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 tbn/query-builder-repository-generator-bundle contains the following files

Loading the files please wait ....