File tree Expand file tree Collapse file tree 4 files changed +103
-0
lines changed Expand file tree Collapse file tree 4 files changed +103
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace ZF \Doctrine \ORM \DataValidation ;
4+
5+ class Module
6+ {
7+ public function getConfig ()
8+ {
9+ return include __DIR__ . '/config/module.config.php ' ;
10+ }
11+
12+ public function getAutoloaderConfig ()
13+ {
14+ return array (
15+ 'Zend\Loader\StandardAutoloader ' => array (
16+ 'namespaces ' => array (
17+ __NAMESPACE__ => __DIR__ . '/src/ ' . __NAMESPACE__ ,
18+ ),
19+ ),
20+ );
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " api-skeletons/zf-doctrine-orm-data-validation" ,
3+ "description" : " Validate foreign key relationships in data" ,
4+ "require" : {
5+ "doctrine/doctrine-orm-module" : " *"
6+ },
7+ "require-dev" : {
8+ "phpunit/phpunit" : " ^5.3"
9+ },
10+ "authors" : [
11+ {
12+ "name" : " Tom H Anderson" ,
13+ "email" : " tom.h.anderson@gmail.com"
14+ }
15+ ]
16+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ return [
4+ 'controllers ' => [
5+ 'invokables ' => [
6+ 'ZF\Doctrine\ORM\DataValidation\Controller\ForeignKey ' =>
7+ 'ZF\Doctrine\ORM\DataValidation\Controller\ForeignKeyController ' ,
8+ ],
9+ ],
10+
11+ 'console ' => [
12+ 'router ' => [
13+ 'routes ' => [
14+ 'zf-doctrine-orm-data-validation-scan ' => [
15+ 'options ' => [
16+ 'route ' => 'orm:data-validation:relationship --objectManager= ' ,
17+ 'defaults ' => [
18+ 'controller ' => 'ZF\Doctrine\ORM\DataValidation\Controller\ForeignKey ' ,
19+ 'action ' => 'relationship ' ,
20+ ],
21+ ],
22+ ],
23+ ],
24+ ],
25+ ],
26+ ];
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace ZF \Doctrine \ORM \DataValidation \Controller ;
4+
5+ use Zend \Mvc \Controller \AbstractActionController ;
6+ use Zend \View \Model \ViewModel ;
7+ use Zend \Console \Request as ConsoleRequest ;
8+ use Zend \Console \Adapter \AdapterInterface as Console ;
9+ use Zend \Console \ColorInterface as Color ;
10+ use Zend \Console \Prompt ;
11+ use DoctrineDataFixtureModule \Loader \ServiceLocatorAwareLoader ;
12+ use Doctrine \Common \DataFixtures \Executor \ORMExecutor ;
13+ use Doctrine \Common \DataFixtures \Purger \ORMPurger ;
14+ use RuntimeException ;
15+ use NoteVault \Entity ;
16+
17+ class ForeignKeyController extends AbstractActionController
18+ {
19+ public function relationshipAction ()
20+ {
21+ // Make sure that we are running in a console and the user has not tricked our
22+ // application into running this action from a public web server.
23+ $ request = $ this ->getRequest ();
24+ if (!$ request instanceof ConsoleRequest) {
25+ throw new RuntimeException ('You can only use this action from a console. ' );
26+ }
27+
28+ $ console = $ this ->getServiceLocator ()->get ('console ' );
29+
30+ $ objectManagerAlias = $ this ->params ()->fromRoute ('objectManager ' );
31+ $ objectManager = $ this ->getServiceLocator ()->get ($ objectManagerAlias );
32+
33+ $ metadataFactory = $ objectManager ->getMetadataFactory ();
34+
35+ print_r ($ metadataFactory ->getLoadedMetadata ());
36+
37+ $ console ->write ("End Metadata \n" , Color::GREEN );
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments