Download the PHP package icings/partitionable without Composer

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

Partitionable

Build Status Coverage Status Latest Version

A set of partitionable associations for the CakePHP ORM, allowing for basic limiting per group.

Requirements

Installation

Use Composer to add the library to your project:

I don't get it, what is this good for exactly?

What exactly are these associations good for, what is a "limit per group" you may ask.

Basically the associations provided in this library allow applying limits for hasMany and belongsToMany type of associations, so that it's possible to for example receive a maximum of n number of comments per article for an Articles hasMany Comments association.

Usage

Make sure to first check the Known Issues/Limitations section!

Then add the \Icings\Partitionable\ORM\AssociationsTrait trait to your table class, use its partitionableHasMany() and partitionableBelongsToMany() methods to add hasMany, respectively belongsToMany associations, configure a limit and a sort order, and you're done with the minimal setup and you can contain the partitionable associations just like any other associations.

Note that configuring a sort order is mandatory, as it is not possible to reliably partition the results without an explicit sort order, omitting it will result in an error!

Has Many

That would query the 3 highest voted comments for each article, eg the result would look something like:

Belongs To Many

That would query the 3 highest graduated courses for each student, eg the result would look something like:

Using options to configure the associations

Additionally to the chained method call syntax, options as known from the built-in associations are supported too, specifically the following options are supported for both partitionableHasMany() as well as partitionableBelongsToMany():

Changing settings on the fly

The limit and the sort order can be applied/changed on the fly in the containment's query builder:

and via Model.beforeFind, where the partitionable fetcher query that needs to be modified, can be identified via the option partitionableQueryType, which would hold the value fetcher:

Limiting to a single result

When setting the limit to 1, the associations will automatically switch to using singular property names (if no property name has been set yet), and non-nested results.

For example, limiting this association to 1:

would return a result like this:

while a limit of greater or equal to 2, would return a result like this:

This behavior can be disabled using the association's disableSingleResult() method, and likewise enabled using enableSingleResult(). Calling the latter will also cause the limit to be set to 1. Furthermore, setting the limit to greater or equal to 2, will automatically disable the single result mode.

With the single result mode disabled:

a limit of 1 would return a result like this:

Filter Strategies

The associations currently provide a few different filter strategies that affect how the query that obtains the associated data is being filtered.

Not all queries are equal, while one strategy may work fine for one query, it might cause problems for another.

The strategy can be set using the association's setFilterStrategy() method:

Please refer to the API docs for SQL examples of how the different strategies work:

The currently available strategies are:

Known Issues/Limitations


All versions of partitionable with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
cakephp/orm Version ^5.0
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 icings/partitionable contains the following files

Loading the files please wait ....