icanboogie / bind-facets
Binds icanboogie/facets to ICanBoogie
Requires
- php: >=7.2
- icanboogie/bind-activerecord: ^5.0
- icanboogie/facets: ^0.8
- icanboogie/icanboogie: ^5.0
Requires (Dev)
- phpunit/phpunit: ^8.5
README
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 7.2 or later.
Installation
composer require icanboogie/bind-facets
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
Run make test-container
to create and log into the test container, then run make test
to run the
test suite. Alternatively, run make test-coverage
to run the test suite with test coverage. Open
build/coverage/index.html
to see the breakdown of the code coverage.
License
icanboogie/bind-facets is released under the New BSD License.