diff --git a/app/AppKernel.php b/app/AppKernel.php
index c5c9eb6..16d943b 100755
--- a/app/AppKernel.php
+++ b/app/AppKernel.php
@@ -16,6 +16,7 @@ public function registerBundles()
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
+ new Butenko\HomeBundle\ButenkoHomeBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
diff --git a/app/config/config.yml b/app/config/config.yml
index 5490b59..ae970e1 100755
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -1,6 +1,7 @@
imports:
- { resource: parameters.yml }
- { resource: security.yml }
+ - { resource: "@ButenkoHomeBundle/Resources/config/services.xml"}
framework:
#esi: ~
diff --git a/app/config/routing.yml b/app/config/routing.yml
index e69de29..39c4340 100755
--- a/app/config/routing.yml
+++ b/app/config/routing.yml
@@ -0,0 +1,4 @@
+butenko_home:
+ resource: "@ButenkoHomeBundle/Resources/config/routing.yml"
+ prefix: /
+
diff --git a/app/config/routing_dev.yml b/app/config/routing_dev.yml
index c45f361..3d02f45 100755
--- a/app/config/routing_dev.yml
+++ b/app/config/routing_dev.yml
@@ -14,5 +14,5 @@ _main:
resource: routing.yml
# AcmeDemoBundle routes (to be removed)
-_acme_demo:
- resource: "@AcmeDemoBundle/Resources/config/routing.yml"
+#_acme_demo:
+# resource: "@AcmeDemoBundle/Resources/config/routing.yml"
diff --git a/src/Butenko/HomeBundle/ButenkoHomeBundle.php b/src/Butenko/HomeBundle/ButenkoHomeBundle.php
new file mode 100644
index 0000000..a842f2a
--- /dev/null
+++ b/src/Butenko/HomeBundle/ButenkoHomeBundle.php
@@ -0,0 +1,9 @@
+container
+ ->get("my_service")
+ ->simpleTask();
+ $fileExists = $this->container
+ ->get("my_service")
+ ->returnFilesystem()
+ ->exists('/var/www/index.html');
+
+ $session = $this->container
+ ->get('my_another_service')
+ ->getSession();
+
+ $metaDataBag = $session->getMetadataBag();
+
+ return $this->render('ButenkoHomeBundle:Default:index.html.twig', array(
+ 'result' => $result,
+ 'filesystem' => $fileExists,
+ 'metadatabag' => $metaDataBag
+ ));
+ }
+}
diff --git a/src/Butenko/HomeBundle/DependencyInjection/ButenkoHomeExtension.php b/src/Butenko/HomeBundle/DependencyInjection/ButenkoHomeExtension.php
new file mode 100644
index 0000000..1732c36
--- /dev/null
+++ b/src/Butenko/HomeBundle/DependencyInjection/ButenkoHomeExtension.php
@@ -0,0 +1,28 @@
+processConfiguration($configuration, $configs);
+
+ $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
+ $loader->load('services.yml');
+ }
+}
diff --git a/src/Butenko/HomeBundle/DependencyInjection/Configuration.php b/src/Butenko/HomeBundle/DependencyInjection/Configuration.php
new file mode 100644
index 0000000..4202cc9
--- /dev/null
+++ b/src/Butenko/HomeBundle/DependencyInjection/Configuration.php
@@ -0,0 +1,29 @@
+root('butenko_home');
+
+ // Here you should define the parameters that are allowed to
+ // configure your bundle. See the documentation linked above for
+ // more information on that topic.
+
+ return $treeBuilder;
+ }
+}
diff --git a/src/Butenko/HomeBundle/Resources/config/routing.yml b/src/Butenko/HomeBundle/Resources/config/routing.yml
new file mode 100755
index 0000000..7830523
--- /dev/null
+++ b/src/Butenko/HomeBundle/Resources/config/routing.yml
@@ -0,0 +1,3 @@
+butenko_home:
+ pattern: /
+ defaults: { _controller: ButenkoHomeBundle:Default:index }
diff --git a/src/Butenko/HomeBundle/Resources/config/services.xml b/src/Butenko/HomeBundle/Resources/config/services.xml
new file mode 100644
index 0000000..46adc5e
--- /dev/null
+++ b/src/Butenko/HomeBundle/Resources/config/services.xml
@@ -0,0 +1,36 @@
+
+
+
1. Simple service that returns value of its parameter
+This is {{ result }}!
+ +2. Symfony's service Symfony\Component\Filesystem\Filesystem was injected via constructor
+we can say that /var/www/index.html exists: {{ filesystem }}
+ +3. Symfony's Symfony\Component\HttpFoundation\Session\Session was injected via setter
+Something called metaDataBag's storageKey: {{ metadatabag.storageKey }}
+ + + +Work on this task is still in progress...
diff --git a/src/Butenko/HomeBundle/Service/MyAnotherService.php b/src/Butenko/HomeBundle/Service/MyAnotherService.php new file mode 100644 index 0000000..6b430f7 --- /dev/null +++ b/src/Butenko/HomeBundle/Service/MyAnotherService.php @@ -0,0 +1,26 @@ +session = $session; + } + + public function getSession() + { + return $this->session; + } +} \ No newline at end of file diff --git a/src/Butenko/HomeBundle/Service/MyService.php b/src/Butenko/HomeBundle/Service/MyService.php new file mode 100644 index 0000000..9d692f0 --- /dev/null +++ b/src/Butenko/HomeBundle/Service/MyService.php @@ -0,0 +1,34 @@ +name = $name; + $this->filesystem = $filesystem; + } + + public function simpleTask() + { + return 'Simple result of my fisrt service, '.$this->name; + } + + public function returnFilesystem() + { + return $this->filesystem; + } +} \ No newline at end of file diff --git a/src/Butenko/HomeBundle/Tests/Controller/DefaultControllerTest.php b/src/Butenko/HomeBundle/Tests/Controller/DefaultControllerTest.php new file mode 100644 index 0000000..0ab61d0 --- /dev/null +++ b/src/Butenko/HomeBundle/Tests/Controller/DefaultControllerTest.php @@ -0,0 +1,17 @@ +request('GET', '/hello/Fabien'); + + $this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0); + } +} diff --git a/web/.htaccess b/web/.htaccess index 0c5f37d..c79dd93 100755 --- a/web/.htaccess +++ b/web/.htaccess @@ -3,7 +3,7 @@ # mod_rewrite). Additionally, this reduces the matching process for the # start page (path "/") because otherwise Apache will apply the rewriting rules # to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl). -DirectoryIndex app.php +DirectoryIndex app_dev.php