integrate Tpex componant

This commit is contained in:
Manuel Raynaud
2013-02-18 22:58:46 +01:00
parent d4bc75bc12
commit 2319f06fd2
4 changed files with 27 additions and 7 deletions

13
composer.lock generated
View File

@@ -4,18 +4,23 @@
{
"name": "Thelia/Tpex",
"version": "dev-master",
"target-dir": "Thelia/Tpex",
"source": {
"type": "git",
"url": "https://github.com/thelia/Tpex.git",
"reference": "a19b49de4c2eb1c759646a9d7d4caf5e00825f67"
"reference": "1be74fd835d6e08b5c4500d7720945412195495e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thelia/Tpex/zipball/a19b49de4c2eb1c759646a9d7d4caf5e00825f67",
"reference": "a19b49de4c2eb1c759646a9d7d4caf5e00825f67",
"url": "https://api.github.com/repos/thelia/Tpex/zipball/1be74fd835d6e08b5c4500d7720945412195495e",
"reference": "1be74fd835d6e08b5c4500d7720945412195495e",
"shasum": ""
},
"time": "2013-02-18 20:38:40",
"require": {
"symfony/event-dispatcher": "2.1.*",
"symfony/http-foundation": "2.1.*"
},
"time": "2013-02-18 21:44:38",
"type": "library",
"autoload": {
"psr-0": {

View File

@@ -69,8 +69,11 @@ class TheliaBundle extends Bundle
$container->register('resolver', 'Symfony\Component\HttpKernel\Controller\ControllerResolver');
$container->register('tpex', 'Thelia\Tpex\Tpex');
$container->register('parser','Thelia\Core\Template\Parser')
->addArgument(new Reference('service_container'))
->addArgument(new Reference('tpex'))
;
/**
* RouterListener implements EventSubscriberInterface and listen for kernel.request event

View File

@@ -29,6 +29,8 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Config\ConfigCache;
use Thelia\Tpex\Tpex;
/**
*
* Master class of Thelia's parser. The loop mechanism depends of this parser
@@ -58,6 +60,8 @@ class Parser implements ParserInterface
protected $content;
protected $status = 200;
protected $tpex;
protected $template = "default";
protected $init = false;
@@ -68,9 +72,10 @@ class Parser implements ParserInterface
*
* public function __construct(ContainerBuilder $container)
*/
public function __construct(ContainerInterface $container)
public function __construct(ContainerInterface $container, Tpex $tpex)
{
$this->container = $container;
$this->tpex = $tpex;
}
protected function initialize()
@@ -164,7 +169,11 @@ class Parser implements ParserInterface
{
$content = $this->openFile($this->getRequest());
$content = $this->parseInclude($content);
$this->tpex->setContent($content);
$this->tpex->setDispatcher($this->container->get("dispatcher"));
$this->tpex->setRequest($this->container->get("request"));
$this->tpex->execute();
}
protected function openFile(Request $request)

View File

@@ -2,4 +2,7 @@ INSERT INTO `lang`(`id`,`title`,`code`,`locale`,`url`,`by_default`,`created_at`,
(1, 'Français', 'fr', 'fr_FR', '','1', NOW(), NOW()),
(2, 'English', 'en', 'en_EN', '', '0', NOW(), NOW()),
(3, 'Espanol', 'es', 'es_ES', '', '0', NOW(), NOW()),
(4, 'Italiano', 'it', 'it_IT', '','0', NOW(), NOW());
(4, 'Italiano', 'it', 'it_IT', '','0', NOW(), NOW());
INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updated_at`) VALUES
('session_config.default', '1', 1, 1, NOW(), NOW());