Implement basic router and a controller for simfile API. Need to make some changes...
[rock.divinelegy.git] / public_html / index.php
index 606a855..def40cd 100644 (file)
@@ -1,83 +1,18 @@
 <?php\r
 require_once('../vendor/autoload.php');\r
 \r
-use Domain\Entities\StepMania\SimfileFactory;\r
-use Domain\Entities\StepMania\SimfileBuilder;\r
-use Domain\Entities\StepMania\SimfileStepByStepBuilder;\r
-use Domain\VOs\StepMania\BPM;\r
-use Domain\VOs\StepMania\StepChart;\r
-use Domain\VOs\StepMania\DanceMode;\r
-use Domain\VOs\StepMania\Difficulty;\r
-use Domain\VOs\StepMania\StepArtist;\r
-use Domain\VOs\StepMania\Artist;\r
-use Domain\ConstantsAndTypes\SimfileConstants;\r
-\r
+// Set up the DI container\r
 $containerBuilder = new DI\ContainerBuilder();\r
 $containerBuilder->addDefinitions('../config/DI.php');\r
 $containerBuilder->useAutowiring(true);\r
 \r
 $container = $containerBuilder->build();\r
 \r
-$route = new Services\Routing\Route('swege', '/yolo/swage', array('GET'));\r
-$request = new Services\Http\HttpRequest();\r
-\r
-$match = $route->matches($request->getPath());\r
-\r
-var_dump($route->supports('POST'));\r
-\r
-//$indexController = $container->get('Controllers\IndexController');\r
-//$indexController->getAction();\r
-\r
-/* @var $foo Domain\Entities\Foo */\r
-//$foo = $container->get('Domain\Entities\Foo');\r
-//$foo->returnMe();\r
-//\r
-//$DataMapper = new \DataAccess\DataMapper\DataMapper('../config/DataMaps.php');\r
-//$user = $DataMapper->find(1,'User');\r
-//\r
-//$simfileFactory = new SimfileFactory();\r
-//$simfileBuilder = new SimfileBuilder($simfileFactory);\r
-//$simfileStepByStepBuilder = new SimfileStepByStepBuilder($simfileBuilder);\r
-//\r
-//$danceMode = new DanceMode('dance-single');\r
-//$difficulty = new Difficulty('challenge');\r
-//$stepArtist = new StepArtist('Someone new fuck');\r
-//$artist = new Artist('A brand new awesome artist!');\r
-//$rating = '10';\r
-//\r
-//$bpm = new BPM('256', '128');\r
-//$stepChart = new StepChart($danceMode,\r
-//    $difficulty,\r
-//    $stepArtist,\r
-//    $rating);\r
-//\r
-//$steps = array($stepChart);\r
-//\r
-//\r
-//$simfile = $simfileStepByStepBuilder->With_Title('Brand New Simfile')\r
-//                                    ->With_Artist($artist)\r
-//                                    ->With_Uploader($user)\r
-//                                    ->With_BPM($bpm)\r
-//                                    ->With_BpmChanges(SimfileConstants::NO_BPM_CHANGES)\r
-//                                    ->With_Stops(SimfileConstants::NO_STOPS)\r
-//                                    ->With_FgChanges(SimfileConstants::NO_FG_CHANGES)\r
-//                                    ->With_BgChanges(SimfileConstants::NO_BG_CHANGES)\r
-//                                    ->With_Steps($steps)\r
-//                                    ->build();\r
-//\r
-//\r
-////$user->setId(NULL);\r
-//\r
-//$simfile = $DataMapper->find(1, 'Simfile');\r
-//$simfile->addStepChart($stepChart);\r
-//$DataMapper->save($simfile);\r
-\r
-\r
-\r
+/* @var $router Services\Routing\IRouter */\r
+$router = $container->get('Services\Routing\IRouter');\r
 \r
-//$stepchart = $simfile->getSteps();\r
-//$stepchart = $stepchart[0];\r
-//$maps = include '../config/DataMaps.php';\r
-//\r
-//$DataMapper->save($user);\r
+$controllerName= $router->getControllerName();\r
+$controllerAction = $router->getActionName();\r
 \r
+$controller = $container->get('Controllers\\' . $controllerName . 'Controller' );\r
+$controller->{$controllerAction . 'Action'}();\r