Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
7aa6a30d
Commit
7aa6a30d
authored
Aug 07, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #4290: Fixed throwing exception when trying to access AR relation that is null
parent
fd5e05b1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
8 deletions
+8
-8
CHANGELOG.md
extensions/twig/CHANGELOG.md
+1
-0
Extension.php
extensions/twig/Extension.php
+0
-5
Template.php
extensions/twig/Template.php
+5
-3
ViewRenderer.php
extensions/twig/ViewRenderer.php
+2
-0
No files found.
extensions/twig/CHANGELOG.md
View file @
7aa6a30d
...
@@ -7,6 +7,7 @@ Yii Framework 2 twig extension Change Log
...
@@ -7,6 +7,7 @@ Yii Framework 2 twig extension Change Log
-
Bug #2925: Fixed throwing exception when accessing AR property with null value (samdark)
-
Bug #2925: Fixed throwing exception when accessing AR property with null value (samdark)
-
Bug #3767: Fixed repeated adding of extensions when using config. One may now pass extension instances as well (grachov)
-
Bug #3767: Fixed repeated adding of extensions when using config. One may now pass extension instances as well (grachov)
-
Bug #3877: Fixed
`lexerOptions`
throwing exception (dapatrese)
-
Bug #3877: Fixed
`lexerOptions`
throwing exception (dapatrese)
-
Bug #4290: Fixed throwing exception when trying to access AR relation that is null (samdark, tenitski)
-
Enh #1799: Added
`form_begin`
,
`form_end`
to twig extension (samdark)
-
Enh #1799: Added
`form_begin`
,
`form_end`
to twig extension (samdark)
-
Enh #3674: Various enhancements (samdark)
-
Enh #3674: Various enhancements (samdark)
-
Removed
`FileLoader`
and used
`\Twig_Loader_Filesystem`
instead.
-
Removed
`FileLoader`
and used
`\Twig_Loader_Filesystem`
instead.
...
...
extensions/twig/Extension.php
View file @
7aa6a30d
...
@@ -54,11 +54,6 @@ class Extension extends \Twig_Extension
...
@@ -54,11 +54,6 @@ class Extension extends \Twig_Extension
];
];
}
}
public
function
initRuntime
(
\Twig_Environment
$environment
)
{
$environment
->
setBaseTemplateClass
(
'yii\twig\Template'
);
}
/**
/**
* @inheritdoc
* @inheritdoc
*/
*/
...
...
extensions/twig/Template.php
View file @
7aa6a30d
...
@@ -14,12 +14,14 @@ namespace yii\twig;
...
@@ -14,12 +14,14 @@ namespace yii\twig;
*/
*/
abstract
class
Template
extends
\Twig_Template
abstract
class
Template
extends
\Twig_Template
{
{
protected
function
getAttribute
(
$object
,
$item
,
array
$arguments
=
array
(),
$type
=
\Twig_Template
::
ANY_CALL
,
$isDefinedTest
=
false
,
$ignoreStrictCheck
=
false
)
/**
* @inheritdoc
*/
protected
function
getAttribute
(
$object
,
$item
,
array
$arguments
=
[],
$type
=
\Twig_Template
::
ANY_CALL
,
$isDefinedTest
=
false
,
$ignoreStrictCheck
=
false
)
{
{
// Twig uses isset() to check if attribute exists which does not work when attribute exists but is null
// Twig uses isset() to check if attribute exists which does not work when attribute exists but is null
if
(
$object
instanceof
\yii\db\BaseActiveRecord
)
{
if
(
$object
instanceof
\yii\db\BaseActiveRecord
)
{
if
(
$type
==
\Twig_Template
::
METHOD_CALL
)
{
if
(
$type
==
=
\Twig_Template
::
METHOD_CALL
)
{
return
$object
->
$item
();
return
$object
->
$item
();
}
else
{
}
else
{
return
$object
->
$item
;
return
$object
->
$item
;
...
...
extensions/twig/ViewRenderer.php
View file @
7aa6a30d
...
@@ -98,6 +98,8 @@ class ViewRenderer extends BaseViewRenderer
...
@@ -98,6 +98,8 @@ class ViewRenderer extends BaseViewRenderer
'charset'
=>
Yii
::
$app
->
charset
,
'charset'
=>
Yii
::
$app
->
charset
,
],
$this
->
options
));
],
$this
->
options
));
$this
->
twig
->
setBaseTemplateClass
(
'yii\twig\Template'
);
// Adding custom globals (objects or static classes)
// Adding custom globals (objects or static classes)
if
(
!
empty
(
$this
->
globals
))
{
if
(
!
empty
(
$this
->
globals
))
{
$this
->
addGlobals
(
$this
->
globals
);
$this
->
addGlobals
(
$this
->
globals
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment