\Twig_Error_Loader

Exception thrown when an error occurs during template loading.

Automatic template information guessing is always turned off as if a template cannot be loaded, there is nothing to guess. However, when a template is loaded from another one, then, we need to find the current context and this is automatically done by Twig_Template::displayWithErrorHandling().

This strategy makes Twig_Environment::resolveTemplate() much faster.

Summary

Methods
Properties
Constants
__construct()
getRawMessage()
getTemplateLine()
setTemplateLine()
getSourceContext()
setSourceContext()
guess()
appendMessage()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
updateRepr()
guessTemplateInfo()
$lineno
$name
$rawMessage
$sourcePath
$sourceCode
N/A

Properties

$lineno

$lineno : 

Type

$name

$name : 

Type

$rawMessage

$rawMessage : 

Type

$sourcePath

$sourcePath : 

Type

$sourceCode

$sourceCode : 

Type

Methods

__construct()

__construct(string  $message, integer  $lineno = -1, \Twig_Source|string|null  $source = null, \Exception  $previous = null) 

Constructor.

Set both the line number and the name to false to disable automatic guessing of the original template name and line number.

Set the line number to -1 to enable its automatic guessing. Set the name to null to enable its automatic guessing.

By default, automatic guessing is enabled.

Parameters

string $message

The error message

integer $lineno

The template line where the error occurred

\Twig_Source|string|null $source

The source context where the error occurred

\Exception $previous

The previous exception

getRawMessage()

getRawMessage() : string

Gets the raw message.

Returns

string —

The raw message

getTemplateLine()

getTemplateLine() : integer

Gets the template line where the error occurred.

Returns

integer —

The template line

setTemplateLine()

setTemplateLine(integer  $lineno) 

Sets the template line where the error occurred.

Parameters

integer $lineno

The template line

getSourceContext()

getSourceContext() : \Twig_Source|null

Gets the source context of the Twig template where the error occurred.

Returns

\Twig_Source|null

setSourceContext()

setSourceContext(\Twig_Source  $source = null) 

Sets the source context of the Twig template where the error occurred.

Parameters

\Twig_Source $source

guess()

guess() 

appendMessage()

appendMessage(  $rawMessage) 

Parameters

$rawMessage

updateRepr()

updateRepr() 

guessTemplateInfo()

guessTemplateInfo()