PHP 클래스 Jarves\PluginController

상속: extends Symfony\Bundle\FrameworkBundle\Controller\Controller
파일 보기 프로젝트 열기: jarves/jarves

보호된 메소드들

메소드 설명
isValidCache ( string $cacheKey ) : boolean Returns whether this cache is valid(exists) or not.
renderCached ( string $cacheKey, string $view, array | callable $data = null ) : string Returns a rendered view. If we find data behind the given cache it uses this data instead of calling $data. So this function does not cache the whole rendered html. To do so use renderFullCache().
renderFullCached ( string $cacheKey, string $view, array | callable $data = null, integer $lifeTime = null, boolean $force = false ) : string Returns a rendered view. If we find html behind the given cache it returns this directly. This is a couple os ms faster than renderCached since the template engine is never used when there's a valid cache.
renderPluginView ( string $view, array $parameters = [] ) : string Renders a view and wrap it with a PluginResponse, so the result will be rendered at the plugin's position.
setOptions ( array &$values, array $defaults ) Replaces all falsy (0, '', null) values in $values with the $default value.

메소드 상세

isValidCache() 보호된 메소드

Returns whether this cache is valid(exists) or not.
protected isValidCache ( string $cacheKey ) : boolean
$cacheKey string
리턴 boolean

renderCached() 보호된 메소드

In this cache method, the template engine is always called. If you want to cache this as well, use renderFullCached(). Example: return $this->renderCache('myCache', 'plugin1/default.tpl', function(){ return array('items' => heavyDbQuery()); }); Note: The $data callable is only called if the cache needs to regenerate (when it has been invalidated or empty, or the view file changed). If the callable $data returns NULL, then this will return NULL, too.
또한 보기: method `render` to get more information.
protected renderCached ( string $cacheKey, string $view, array | callable $data = null ) : string
$cacheKey string
$view string
$data array | callable Pass the data as array or a data provider function.
리턴 string

renderFullCached() 보호된 메소드

Example: return $this->renderFullCached('myCache', 'plugin1/default.tpl', function(){ return array('items' => heavyDbQuery()); }); Note: The $data callable is only called if the cache needs to regenerate (when it has been invalidated or empty, or the view file changed). If the callable $data returns NULL, then this will return NULL, too, without entering the actual rendering process. You should use this method in your plugins instead of writing your own cache mechanism, because this method handles PageResponse merging. Means: If templates used in this $view are changing somehow the PageResponse ({{loadAsset('style.css')}} calls) then this information (diff to current PageResponse) is stored and restored when we found a html cache. The diff is beside the actual rendered HTML also stored in the cache to keep this possible.
또한 보기: method `render` to get more information.
protected renderFullCached ( string $cacheKey, string $view, array | callable $data = null, integer $lifeTime = null, boolean $force = false ) : string
$cacheKey string
$view string
$data array | callable Pass the data as array or a data provider function.
$lifeTime integer In seconds. Default is one hour/3600 seconds.
$force boolean Force to bypass the cache and always call $data. For debuggin purposes.
리턴 string

renderPluginView() 보호된 메소드

If you use the regular render method, its Symfony response will be passed through the HttpKernel and will be displayed without the PageResponse.
protected renderPluginView ( string $view, array $parameters = [] ) : string
$view string The view name
$parameters array An array of parameters to pass to the view
리턴 string will be transformed into a PluginResponse automatically by Jarves

setOptions() 보호된 메소드

Replaces all falsy (0, '', null) values in $values with the $default value.
protected setOptions ( array &$values, array $defaults )
$values array
$defaults array