File tree Expand file tree Collapse file tree 5 files changed +29
-6
lines changed Expand file tree Collapse file tree 5 files changed +29
-6
lines changed Original file line number Diff line number Diff line change @@ -12,12 +12,14 @@ matrix:
1212 include :
1313 - php : 7.0
1414 env : SYMFONY_VERSION=^3.3
15- - php : 7.0
16- env : SYMFONY_VERSION=^3.4
1715 - php : 7.0
1816 env : COMPOSER_FLAGS="--prefer-lowest"
1917 - php : 7.1
2018 env : SYMFONY_VERSION=^3.4
19+ - php : 7.2
20+ env : SYMFONY_VERSION=^3.3
21+ - php : 7.2
22+ env : SYMFONY_VERSION=^3.4
2123 - php : 7.2
2224 env : DEPENDENCIES=dev
2325 - php : nightly
Original file line number Diff line number Diff line change @@ -5,8 +5,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
55## [ Unreleased]
66Nothing yet.
77
8+ ## [ 0.1.1] - 2017-12-03
9+ ### Fixed
10+ - Changed ORMAdapter autowire to manual to avoid compile time failures when optional
11+ dependencies are missing
12+
813## 0.1.0 - 2017-12-01
914### Added
1015 - Basic functionality
1116
12- [ Unreleased ] : https://github.com/omines/datatables-bundle/compare/0.1.0...master
17+ [ Unreleased ] : https://github.com/omines/datatables-bundle/compare/0.1.1...master
18+ [ 0.1.1 ] : https://github.com/omines/datatables-bundle/compare/0.1.0...0.1.1
Original file line number Diff line number Diff line change @@ -55,10 +55,14 @@ class ORMAdapter extends AbstractAdapter
5555 /**
5656 * DoctrineAdapter constructor.
5757 *
58- * @param RegistryInterface $registry
58+ * @param RegistryInterface|null $registry
5959 */
60- public function __construct (RegistryInterface $ registry )
60+ public function __construct (RegistryInterface $ registry = null )
6161 {
62+ if (null === $ registry ) {
63+ throw new \LogicException ('Install doctrine/doctrine-bundle to use the ORMAdapter ' );
64+ }
65+
6266 parent ::__construct ();
6367 $ this ->registry = $ registry ;
6468 }
Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ services:
66
77 # Register default adapters via autoconfig/autowire
88 Omines\DataTablesBundle\Adapter\ArrayAdapter : ~
9- Omines\DataTablesBundle\Adapter\Doctrine\ORMAdapter : ~
9+ Omines\DataTablesBundle\Adapter\Doctrine\ORMAdapter :
10+ arguments : ['@?doctrine']
1011
1112 Omines\DataTablesBundle\DataTableFactory :
1213 arguments : ['%datatables.config%', '@datatables.renderer']
Original file line number Diff line number Diff line change 1515use Doctrine \ORM \Query ;
1616use Doctrine \ORM \QueryBuilder ;
1717use Omines \DataTablesBundle \Adapter \Doctrine \ORM \SearchCriteriaProvider ;
18+ use Omines \DataTablesBundle \Adapter \Doctrine \ORMAdapter ;
1819use Omines \DataTablesBundle \Column \TextColumn ;
1920use Omines \DataTablesBundle \DataTable ;
2021use PHPUnit \Framework \TestCase ;
@@ -53,4 +54,13 @@ public function testSearchCriteriaProvider()
5354 // As this is buggy right now ignore the result
5455 $ this ->assertTrue (true );
5556 }
57+
58+ /**
59+ * @expectedException \LogicException
60+ * @expectedExceptionMessage doctrine/doctrine-bundle
61+ */
62+ public function testORMAdapterRequiresDependency ()
63+ {
64+ (new ORMAdapter ());
65+ }
5666}
You can’t perform that action at this time.
0 commit comments