Presentation prepared especially for #4 SPUG meeting in Gliwice describes integration an old code, spaghetti code with Symfony2 framework. Two really different engines in one application.
10. ŚRODOWISKO
minimum PHP 5.3.3
Sqlite3, JSON, ctype
php app/check.php
date.timezone set in php.ini
Phpcs CodeSniffs
tutaj po raz pierwszy korzystamy z testów
Piotr Pasich @
13. AUTOLOADER
<?php
namespace XsolveLegacyBundle;
require_once(__DIR__ . "/../../../legacy/index.php"); //disabled execute::run
use Legacy;
use SymfonyComponentHttpKernelBundleBundle;
use SymfonyComponentDependencyInjectionContainerBuilder;
class XsolveLegacyBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
spl_autoload_register(array('Kohana', 'auto_load'));
}
}
Piotr Pasich @
20. ESI SERVICE
/**
* @return SymfonyComponentDomCrawlerCrawler
*/
public function request($url)
{
if (!isset($this->response[$url])) {
$client = $this->getClient();
$request = $client->get($url);
$request->setHeader('Cookie', null);
$this->response[$url] = $request->send();
}
return $this->response[$url]->getBody();
}
Piotr Pasich @
21. ESI SERVICE
public function filter($html, $element)
{
$crawler = new Crawler();
$crawler->addHtmlContent($html);
$crawler = $crawler->filter($element);
$html = '';
foreach ($crawler as $domElement) {
$html.= $domElement->ownerDocument->saveHTML($domElement);
}
return $html;
}
Piotr Pasich @
34. TERAZ DZIAŁA
class Session_Core {
// (...)
public function create($vars = NULL)
{
// Destroy any current sessions
self::$createCall = self::$createCall+1;
if (self::$createCall > 10){
$_SESSION = array();
}
// this->destroy();
// (...)
}
}
Piotr Pasich @
35. BAZA DANYCH
ponad 100 tabel = 100 encji
brak odpowiednich relacji
brak pełnej zgodności z wymogami Doctrine 2
Piotr Pasich @