#Figures
Statistics for your symfony app, simply.
Flex recipe incoming...
// config/bundles.php
return [
...
Suminagashi\FiguresBundle\FiguresBundle::class => ['all' => true],
];php bin/console doctrine:schema:update --forceFirst you need to import Suminagashi\FiguresBundle\Annotation\Watch annotation. Then you have to write add the key of your stat, the type (cumul or count) and the lifecycle (at which lifecycle you want the stat to register).
use Suminagashi\FiguresBundle\Annotation\Watch;
class Product
{
//...
/**
*
* @ORM\Column(type="integer")
*
* @Watch(key="product:price", type="cumul", lifecycle="update")
* @Watch(key="product:sell", type="count", lifecycle="create")
*/
private $price;
//***There is two mode of stats calculation :
countis for counting the number of sales (e.g).cumulis for calculating the amount of sales (e.g).
First you need to import Suminagashi\FiguresBundle\Tools\Figures in your code. Then you can autowire the class and start using it. We provide few methods to help you :
$figures = new Figures();
$figures->all('key');
$figures->getToday('key');
$figures->getLastweek('key');
$figures->getLastmonth('key');
$figures->getLastyear('key');
$figures->get('key', 'start', 'end');- Stat percentages calculations.
- Statut type
- Better exception handling
- Handle delete (cascade)