icanboogie/bind-facets

v0.7.0 2018-03-18 17:00 UTC

README

Release Build Status Code Quality Code Coverage Packagist

The icanboogie/bind-facets package binds icanboogie/facets to ICanBoogie, using its autoconfig feature, and provides the following features:

  • A synthesizer for the activerecord_facets config.
  • A criteria prototype property for Model instances.
  • A criterion_list prototype property for Model instances.
  • A fetch_record() prototype method for Model instances.
  • A fetch_records() prototype method for Model instances.

Hinting prototype bindings

Because most features are provided through prototype methods, your favorite editor might complain about unknown methods, in which case simply use the ModelBindings trait.

The following example demonstrates how to hint your code about a fetch_records method. Notice the type hint in the annotation Model|ModelBindings:

<?php

use ICanBoogie\ActiveRecord\Model;
use ICanBoogie\Binding\Facets\ModelBindings;
use ICanBoogie\Facets\RecordCollection;

/**
 * @param Model|ModelBindings
 * 
 * @return RecordCollection
 */
function fetch(Model $model, array $conditions)
{
	return $model->fetch_records($conditions;
}

Requirements

The package requires PHP 5.6 or later.

Installation

The recommended way to install this package is through Composer:

$ composer require icanboogie/bind-facets

Cloning the repository

The package is available on GitHub, its repository can be cloned with the following command line:

$ git clone https://github.com/ICanBoogie/bind-facets.git

Documentation

The package is documented as part of the ICanBoogie framework documentation. You can generate the documentation for the package and its dependencies with the make doc command. The documentation is generated in the build/docs directory. ApiGen is required. The directory can later be cleaned with the make clean command.

Testing

The test suite is ran with the make test command. PHPUnit and Composer need to be globally available to run the suite. The command installs dependencies as required. The make test-coverage command runs test suite and also creates an HTML coverage report in "build/coverage". The directory can later be cleaned with the make clean command.

The package is continuously tested by Travis CI.

Build Status Code Coverage

License

icanboogie/bind-facets is licensed under the New BSD License - See the LICENSE file for details.