Skip to content

Commit

Permalink
[#14907] - Removed cache parsing from Volt
Browse files Browse the repository at this point in the history
  • Loading branch information
niden committed Mar 13, 2020
1 parent a83bc47 commit cd03656
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 33 deletions.
12 changes: 3 additions & 9 deletions phalcon/Mvc/View/Engine/Volt/Compiler.zep
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,9 @@ class Compiler implements InjectionAwareInterface
{
var expr, exprCode, lifetime;
string compilation;

/**
* @todo Remove this in the next major version
*/
/**
* A valid expression is required
*/
Expand Down Expand Up @@ -2759,14 +2761,6 @@ class Compiler implements InjectionAwareInterface

break;

case PHVOLT_T_CACHE:
let compilation .= this->compileCache(
statement,
extendsMode
);

break;

case PHVOLT_T_DO:
let compilation .= this->compileDo(statement);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,30 +505,6 @@ private function getVoltCompileString(): array
'{% set a = 1.2+1*(20/b) and c %}',
'<?php $a = 1.2 + 1 * (20 / $b) && $c; ?>',
],
// Cache statement
[
'{% cache somekey %} hello {% endcache %}',
'<?php $_cache[$somekey] = $this->di->get(\'viewCache\'); ' .
'$_cacheKey[$somekey] = $_cache[$somekey]->start($somekey); ' .
'if ($_cacheKey[$somekey] === null) { ?> hello <?php $_cache[$somekey]->save($somekey); } ' .
'else { echo $_cacheKey[$somekey]; } ?>',
],
[
'{% set lifetime = 500 %}{% cache somekey lifetime %} hello {% endcache %}',
'<?php $lifetime = 500; ?>' .
'<?php $_cache[$somekey] = $this->di->get(\'viewCache\'); ' .
'$_cacheKey[$somekey] = $_cache[$somekey]->start($somekey, $lifetime); ' .
'if ($_cacheKey[$somekey] === null) { ?> hello ' .
'<?php $_cache[$somekey]->save($somekey, null, $lifetime); } else ' .
'{ echo $_cacheKey[$somekey]; } ?>',
],
[
'{% cache somekey 500 %} hello {% endcache %}',
'<?php $_cache[$somekey] = $this->di->get(\'viewCache\'); ' .
'$_cacheKey[$somekey] = $_cache[$somekey]->start($somekey, 500); ' .
'if ($_cacheKey[$somekey] === null) { ?> hello ' .
'<?php $_cache[$somekey]->save($somekey, null, 500); } else { echo $_cacheKey[$somekey]; } ?>',
],
//Autoescape mode
[
'{{ "hello" }}{% autoescape true %}{{ "hello" }}{% autoescape false %}' .
Expand Down

0 comments on commit cd03656

Please sign in to comment.