ggggino / recenty-bundle
Bundle to facilitate the 'recently use of something'
Package info
github.com/GGGGino/RecentyBundle
Type:symfony-bundle
pkg:composer/ggggino/recenty-bundle
v1.0.2
2021-01-04 01:03 UTC
Requires
- php: ^7.2 || ^8.0
- doctrine/doctrine-bundle: ^2.0
- symfony/http-kernel: ^4.4 || ^5.1
Requires (Dev)
- phpunit/phpunit: ^8.4
- psr/cache: ^1.0
- psr/simple-cache: ^1.0
- symfony/phpunit-bridge: ^4.4 || ^5.1
Suggests
- psr/cache: To be used with GGGGino\RecentyBundle\Storage\StorageCache
- psr/simple-cache: To be used with GGGGino\RecentyBundle\Storage\StorageCache
Provides
None
Conflicts
None
Replaces
None
README
Bundle that automize the favourite entity usage.
This bundle answer aim to resolve the question, how many times this thing is used.
Install
composer require ggggino/recenty-bundle
Configuration
services.yaml
services: ... GGGGino\RecentyBundle\Storage\StorageVolatile: shared: false app.strategy.desc: class: GGGGino\RecentyBundle\Strategy\StrategyDesc shared: false arguments: ['@GGGGino\RecentyBundle\Storage\StorageVolatile'] app.strategy.asc: class: GGGGino\RecentyBundle\Strategy\StrategyAsc shared: false arguments: ['@GGGGino\RecentyBundle\Storage\StorageVolatile']
shared: falsepermit to instantiate a object every time it is called
recenty_bundle.yaml
ggggino_recenty: clients: main: class: 'app.strategy.desc' slave: class: 'app.strategy.asc'
You can use as many client you like.
Usage
use GGGGino\RecentyBundle\WrapperManager; /** * @Route("/default", name="default") */ public function index(WrapperManager $wrapperManager): Response { $strategies = $wrapperManager->getStrategies(); /** @var Product $product */ $product = $em->getRepository(Product::class)->find(1); try { $wrapperManager->increment('main', new WrapperGenericEntity($product, 'bought', 2)); } catch (EntityNotValidException $e) { return $this->json([ 'message' => 'Wrapper not generable!' ], 500); } return $this->json([ 'message' => 'Welcome to your new controller!' ]); }
Reference
Strategies
Strategy is the way a Entity will be stored and retrivied
Storages
Storage is the place where the Entity will be stored
Contribute
Test
./vendor/bin/simple-phpunit