00f100 / fcphp-repository
Package to manipulate repositories
Installs: 18
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Type:package
Requires
- php: >=7.2
- 00f100/fcphp-cache: *
- 00f100/fcphp-datasource: *
- 00f100/fcphp-di: *
Requires (Dev)
- 00f100/phpdbug: *
- phpunit/phpunit: 6.*
This package is auto-updated.
Last update: 2024-11-18 05:47:32 UTC
README
Abstract class to Repository FcPhp
How to install
Composer:
$ composer require 00f100/fcphp-repository
or add in composer.json
{ "require": { "00f100/fcphp-repository": "*" } }
How to use
namespace Path\To { use FcPhp\Repository\Repository; class ExampleRepository extends Repository { } }
Configure dependencies
use Exception; use FcPhp\Di\Facades\DiFacade; use FcPhp\Datasource\Factories\Factory; use FcPhp\Cache\Facades\CacheFacade; use FcPhp\Datasource\Interfaces\IQuery; $di = DiFacade::getInstance(); $factory = new Factory($di); $cache = CacheFacade::getInstance('path/to/cache');
Create instance and define error callback
use Path\To\ExampleRepository; // See: github.com/00f100/fcphp-datasource $datasource = new Datasource(); $callbackError = function(IQuery $query, Exception $e) { $this->assertInstanceOf(IQuery::class, $query); $this->assertInstanceOf(Exception::class, $e); }; $instance = new ExampleRepository($datasource, $cache, $factory, $callbackError); // Query $query = $instance->getQuery();