forked from Sylius/SyliusReportBundle
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Pitoune/feat/symfony-3
Make bundle works with symfony 3
- Loading branch information
Showing
35 changed files
with
543 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sylius\Bundle\ReportBundle\DataFetcher; | ||
|
||
use Sylius\Bundle\ReportBundle\Doctrine\ORM\OrderRepositoryInterface; | ||
use Sylius\Bundle\ReportBundle\Form\Type\DataFetcher\NumberOfOrdersType; | ||
|
||
/** | ||
* @author Łukasz Chruściel <[email protected]> | ||
*/ | ||
class NumberOfOrdersDataFetcher extends TimePeriod | ||
{ | ||
/** | ||
* @var OrderRepositoryInterface | ||
*/ | ||
protected $orderRepository; | ||
|
||
/** | ||
* @param OrderRepositoryInterface $orderRepository | ||
*/ | ||
public function __construct(OrderRepositoryInterface $orderRepository) | ||
{ | ||
$this->orderRepository = $orderRepository; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function getData(array $configuration = []) | ||
{ | ||
return $this->orderRepository->ordersBetweenDatesGroupByDate($configuration); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getType() | ||
{ | ||
return NumberOfOrdersType::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sylius\Bundle\ReportBundle\DataFetcher; | ||
|
||
use Sylius\Bundle\ReportBundle\Doctrine\ORM\OrderRepositoryInterface; | ||
use Sylius\Bundle\ReportBundle\Form\Type\DataFetcher\SalesTotalType; | ||
|
||
/** | ||
* @author Łukasz Chruściel <[email protected]> | ||
*/ | ||
class SalesTotalDataFetcher extends TimePeriod | ||
{ | ||
/** | ||
* @var OrderRepositoryInterface | ||
*/ | ||
protected $orderRepository; | ||
|
||
/** | ||
* @param OrderRepositoryInterface $orderRepository | ||
*/ | ||
public function __construct(OrderRepositoryInterface $orderRepository) | ||
{ | ||
$this->orderRepository = $orderRepository; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function getData(array $configuration = []) | ||
{ | ||
return $this->orderRepository->revenueBetweenDatesGroupByDate($configuration); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getType() | ||
{ | ||
return SalesTotalType::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sylius\Bundle\ReportBundle\DataFetcher; | ||
|
||
use Sylius\Bundle\ReportBundle\Doctrine\ORM\UserRepositoryInterface; | ||
use Sylius\Bundle\ReportBundle\Form\Type\DataFetcher\UserRegistrationType; | ||
|
||
/** | ||
* @author Łukasz Chruściel <[email protected]> | ||
*/ | ||
class UserRegistrationDataFetcher extends TimePeriod | ||
{ | ||
/** | ||
* @var UserRepositoryInterface | ||
*/ | ||
protected $userRepository; | ||
|
||
/** | ||
* @param UserRepositoryInterface $userRepository | ||
*/ | ||
public function __construct(UserRepositoryInterface $userRepository) | ||
{ | ||
$this->userRepository = $userRepository; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function getData(array $configuration = []) | ||
{ | ||
return $this->userRepository->getRegistrationStatistic($configuration); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getType() | ||
{ | ||
return UserRegistrationType::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Sylius\Bundle\ReportBundle\Doctrine\ORM; | ||
|
||
interface OrderRepositoryInterface | ||
{ | ||
/** | ||
* @param array $configuration | ||
* | ||
* @return mixed | ||
*/ | ||
public function revenueBetweenDatesGroupByDate(array $configuration = []); | ||
|
||
/** | ||
* @param array $configuration | ||
* | ||
* @return mixed | ||
*/ | ||
public function ordersBetweenDatesGroupByDate(array $configuration = []); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace Sylius\Bundle\ReportBundle\Doctrine\ORM; | ||
|
||
interface UserRepositoryInterface | ||
{ | ||
/** | ||
* @param array $configuration | ||
* | ||
* @return mixed | ||
*/ | ||
public function getRegistrationStatistic(array $configuration = []); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sylius\Bundle\ReportBundle\Form\Type\DataFetcher; | ||
|
||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
|
||
/** | ||
* @author Łukasz Chruściel <[email protected]> | ||
*/ | ||
class DataFetcherChoiceType extends AbstractType | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
protected $dataFetchers; | ||
|
||
/** | ||
* @param array $dataFetchers | ||
*/ | ||
public function __construct($dataFetchers) | ||
{ | ||
$this->dataFetchers = $dataFetchers; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function configureOptions(OptionsResolver $resolver) | ||
{ | ||
$resolver | ||
->setDefaults([ | ||
'choices' => $this->dataFetchers, | ||
]) | ||
; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getParent() | ||
{ | ||
return ChoiceType::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sylius\Bundle\ReportBundle\Form\Type\DataFetcher; | ||
|
||
use Sylius\Bundle\ReportBundle\DataFetcher\NumberOfOrdersDataFetcher; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; | ||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | ||
use Symfony\Component\Form\Extension\Core\Type\DateType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
|
||
/** | ||
* @author Łukasz Chruściel <[email protected]> | ||
*/ | ||
class NumberOfOrdersType extends AbstractType | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function buildForm(FormBuilderInterface $builder, array $options) | ||
{ | ||
$builder | ||
->add('start', DateType::class, [ | ||
'label' => 'sylius.form.report.user_registration.start', | ||
]) | ||
->add('end', DateType::class, [ | ||
'label' => 'sylius.form.report.user_registration.end', | ||
]) | ||
->add('period', ChoiceType::class, [ | ||
'choices' => NumberOfOrdersDataFetcher::getPeriodChoices(), | ||
'multiple' => false, | ||
'label' => 'sylius.form.report.user_registration.period', | ||
]) | ||
->add('empty_records', CheckboxType::class, [ | ||
'label' => 'sylius.form.report.user_registration.empty_records', | ||
'required' => false, | ||
]) | ||
; | ||
} | ||
} |
Oops, something went wrong.