mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 03:16:34 +00:00
added support for is*() methods for attributes (foo.bar now looks for foo->getBar() or foo->isBar())
This commit is contained in:
@@ -13,6 +13,7 @@ Backward incompatibilities:
|
||||
(the old behavior is still possible by adding the "only" keyword)
|
||||
* Moved Exceptions to Twig_Error_* (Twig_SyntaxError/Twig_RuntimeError are now Twig_Error_Syntax/Twig_Error_Runtime)
|
||||
|
||||
* added support for is*() methods for attributes (foo.bar now looks for foo->getBar() or foo->isBar())
|
||||
* changed all exceptions to extend Twig_Error
|
||||
* fixed unary expressions ({{ not(1 or 0) }})
|
||||
* fixed child templates (with an extend tag) that uses one or more imports
|
||||
|
||||
@@ -90,6 +90,7 @@ If a variable or attribute does not exist you will get back a `null` value
|
||||
> * if not, and if `foo` is an object, check that `bar` is a valid method
|
||||
> (even if `bar` is the constructor - use `__construct()` instead);
|
||||
> * if not, and if `foo` is an object, check that `getBar` is a valid method;
|
||||
> * if not, and if `foo` is an object, check that `isBar` is a valid method (as of Twig 0.9.9);
|
||||
> * if not, return a `null` value.
|
||||
>
|
||||
>`foo['bar']` on the other hand works mostly the same with the a small
|
||||
|
||||
@@ -152,6 +152,8 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
||||
$method = $item;
|
||||
} elseif (isset(self::$cache[$class]['methods']['get'.$lcItem])) {
|
||||
$method = 'get'.$item;
|
||||
} elseif (isset(self::$cache[$class]['methods']['is'.$lcItem])) {
|
||||
$method = 'is'.$item;
|
||||
} elseif (isset(self::$cache[$class]['methods']['__call'])) {
|
||||
$method = $item;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user