ÿØÿà JFIF    ÿÛ „ ( %!1!%*+...983,7(-.- PKi][[5Twig/Resources/views/Form/form_table_layout.html.twignu[{% use "form_div_layout.html.twig" %} {% block form_row %} {% spaceless %} {{ form_label(form) }} {{ form_errors(form) }} {{ form_widget(form) }} {% endspaceless %} {% endblock form_row %} {% block button_row %} {% spaceless %} {{ form_widget(form) }} {% endspaceless %} {% endblock button_row %} {% block hidden_row %} {% spaceless %} {{ form_widget(form) }} {% endspaceless %} {% endblock hidden_row %} {% block form_widget_compound %} {% spaceless %} {% if form.parent is empty and errors|length > 0 %} {% endif %} {{ block('form_rows') }} {{ form_rest(form) }}
{{ form_errors(form) }}
{% endspaceless %} {% endblock form_widget_compound %} PKi] 92923Twig/Resources/views/Form/form_div_layout.html.twignu[{# Widgets #} {% block form_widget %} {% spaceless %} {% if compound %} {{ block('form_widget_compound') }} {% else %} {{ block('form_widget_simple') }} {% endif %} {% endspaceless %} {% endblock form_widget %} {% block form_widget_simple %} {% spaceless %} {% set type = type|default('text') %} {% endspaceless %} {% endblock form_widget_simple %} {% block form_widget_compound %} {% spaceless %}
{% if form.parent is empty %} {{ form_errors(form) }} {% endif %} {{ block('form_rows') }} {{ form_rest(form) }}
{% endspaceless %} {% endblock form_widget_compound %} {% block collection_widget %} {% spaceless %} {% if prototype is defined %} {% set attr = attr|merge({'data-prototype': form_row(prototype) }) %} {% endif %} {{ block('form_widget') }} {% endspaceless %} {% endblock collection_widget %} {% block textarea_widget %} {% spaceless %} {% endspaceless %} {% endblock textarea_widget %} {% block choice_widget %} {% spaceless %} {% if expanded %} {{ block('choice_widget_expanded') }} {% else %} {{ block('choice_widget_collapsed') }} {% endif %} {% endspaceless %} {% endblock choice_widget %} {% block choice_widget_expanded %} {% spaceless %}
{% for child in form %} {{ form_widget(child) }} {{ form_label(child) }} {% endfor %}
{% endspaceless %} {% endblock choice_widget_expanded %} {% block choice_widget_collapsed %} {% spaceless %} {% if required and empty_value is none and not empty_value_in_choices and not multiple %} {% set required = false %} {% endif %} {% endspaceless %} {% endblock choice_widget_collapsed %} {% block choice_widget_options %} {% spaceless %} {% for group_label, choice in options %} {% if choice is iterable %} {% set options = choice %} {{ block('choice_widget_options') }} {% else %} {% endif %} {% endfor %} {% endspaceless %} {% endblock choice_widget_options %} {% block checkbox_widget %} {% spaceless %} {% endspaceless %} {% endblock checkbox_widget %} {% block radio_widget %} {% spaceless %} {% endspaceless %} {% endblock radio_widget %} {% block datetime_widget %} {% spaceless %} {% if widget == 'single_text' %} {{ block('form_widget_simple') }} {% else %}
{{ form_errors(form.date) }} {{ form_errors(form.time) }} {{ form_widget(form.date) }} {{ form_widget(form.time) }}
{% endif %} {% endspaceless %} {% endblock datetime_widget %} {% block date_widget %} {% spaceless %} {% if widget == 'single_text' %} {{ block('form_widget_simple') }} {% else %}
{{ date_pattern|replace({ '{{ year }}': form_widget(form.year), '{{ month }}': form_widget(form.month), '{{ day }}': form_widget(form.day), })|raw }}
{% endif %} {% endspaceless %} {% endblock date_widget %} {% block time_widget %} {% spaceless %} {% if widget == 'single_text' %} {{ block('form_widget_simple') }} {% else %} {% set vars = widget == 'text' ? { 'attr': { 'size': 1 }} : {} %}
{{ form_widget(form.hour, vars) }}{% if with_minutes %}:{{ form_widget(form.minute, vars) }}{% endif %}{% if with_seconds %}:{{ form_widget(form.second, vars) }}{% endif %}
{% endif %} {% endspaceless %} {% endblock time_widget %} {% block number_widget %} {% spaceless %} {# type="number" doesn't work with floats #} {% set type = type|default('text') %} {{ block('form_widget_simple') }} {% endspaceless %} {% endblock number_widget %} {% block integer_widget %} {% spaceless %} {% set type = type|default('number') %} {{ block('form_widget_simple') }} {% endspaceless %} {% endblock integer_widget %} {% block money_widget %} {% spaceless %} {{ money_pattern|replace({ '{{ widget }}': block('form_widget_simple') })|raw }} {% endspaceless %} {% endblock money_widget %} {% block url_widget %} {% spaceless %} {% set type = type|default('url') %} {{ block('form_widget_simple') }} {% endspaceless %} {% endblock url_widget %} {% block search_widget %} {% spaceless %} {% set type = type|default('search') %} {{ block('form_widget_simple') }} {% endspaceless %} {% endblock search_widget %} {% block percent_widget %} {% spaceless %} {% set type = type|default('text') %} {{ block('form_widget_simple') }} % {% endspaceless %} {% endblock percent_widget %} {% block password_widget %} {% spaceless %} {% set type = type|default('password') %} {{ block('form_widget_simple') }} {% endspaceless %} {% endblock password_widget %} {% block hidden_widget %} {% spaceless %} {% set type = type|default('hidden') %} {{ block('form_widget_simple') }} {% endspaceless %} {% endblock hidden_widget %} {% block email_widget %} {% spaceless %} {% set type = type|default('email') %} {{ block('form_widget_simple') }} {% endspaceless %} {% endblock email_widget %} {% block button_widget %} {% spaceless %} {% if label is empty %} {% set label = name|humanize %} {% endif %} {% endspaceless %} {% endblock button_widget %} {% block submit_widget %} {% spaceless %} {% set type = type|default('submit') %} {{ block('button_widget') }} {% endspaceless %} {% endblock submit_widget %} {% block reset_widget %} {% spaceless %} {% set type = type|default('reset') %} {{ block('button_widget') }} {% endspaceless %} {% endblock reset_widget %} {# Labels #} {% block form_label %} {% spaceless %} {% if label is not sameas(false) %} {% if not compound %} {% set label_attr = label_attr|merge({'for': id}) %} {% endif %} {% if required %} {% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %} {% endif %} {% if label is empty %} {% set label = name|humanize %} {% endif %} {{ label|trans({}, translation_domain) }} {% endif %} {% endspaceless %} {% endblock form_label %} {% block button_label %}{% endblock %} {# Rows #} {% block repeated_row %} {% spaceless %} {# No need to render the errors here, as all errors are mapped to the first child (see RepeatedTypeValidatorExtension). #} {{ block('form_rows') }} {% endspaceless %} {% endblock repeated_row %} {% block form_row %} {% spaceless %}
{{ form_label(form) }} {{ form_errors(form) }} {{ form_widget(form) }}
{% endspaceless %} {% endblock form_row %} {% block button_row %} {% spaceless %}
{{ form_widget(form) }}
{% endspaceless %} {% endblock button_row %} {% block hidden_row %} {{ form_widget(form) }} {% endblock hidden_row %} {# Misc #} {% block form %} {% spaceless %} {{ form_start(form) }} {{ form_widget(form) }} {{ form_end(form) }} {% endspaceless %} {% endblock form %} {% block form_start %} {% spaceless %} {% set method = method|upper %} {% if method in ["GET", "POST"] %} {% set form_method = method %} {% else %} {% set form_method = "POST" %} {% endif %}
{% if form_method != method %} {% endif %} {% endspaceless %} {% endblock form_start %} {% block form_end %} {% spaceless %} {% if not render_rest is defined or render_rest %} {{ form_rest(form) }} {% endif %}
{% endspaceless %} {% endblock form_end %} {% block form_enctype %} {% spaceless %} {% if multipart %}enctype="multipart/form-data"{% endif %} {% endspaceless %} {% endblock form_enctype %} {% block form_errors %} {% spaceless %} {% if errors|length > 0 %} {% endif %} {% endspaceless %} {% endblock form_errors %} {% block form_rest %} {% spaceless %} {% for child in form %} {% if not child.rendered %} {{ form_row(child) }} {% endif %} {% endfor %} {% endspaceless %} {% endblock form_rest %} {# Support #} {% block form_rows %} {% spaceless %} {% for child in form %} {{ form_row(child) }} {% endfor %} {% endspaceless %} {% endblock form_rows %} {% block widget_attributes %} {% spaceless %} id="{{ id }}" name="{{ full_name }}" {%- if read_only %} readonly="readonly"{% endif -%} {%- if disabled %} disabled="disabled"{% endif -%} {%- if required %} required="required"{% endif -%} {%- if max_length %} maxlength="{{ max_length }}"{% endif -%} {%- if pattern %} pattern="{{ pattern }}"{% endif -%} {%- for attrname, attrvalue in attr -%} {{- " " -}} {%- if attrname in ['placeholder', 'title'] -%} {{- attrname }}="{{ attrvalue|trans({}, translation_domain) }}" {%- elseif attrvalue is sameas(true) -%} {{- attrname }}="{{ attrname }}" {%- elseif attrvalue is not sameas(false) -%} {{- attrname }}="{{ attrvalue }}" {%- endif -%} {%- endfor -%} {% endspaceless %} {% endblock widget_attributes %} {% block widget_container_attributes %} {% spaceless %} {%- if id is not empty %}id="{{ id }}"{% endif -%} {%- for attrname, attrvalue in attr -%} {{- " " -}} {%- if attrname in ['placeholder', 'title'] -%} {{- attrname }}="{{ attrvalue|trans({}, translation_domain) }}" {%- elseif attrvalue is sameas(true) -%} {{- attrname }}="{{ attrname }}" {%- elseif attrvalue is not sameas(false) -%} {{- attrname }}="{{ attrvalue }}" {%- endif -%} {%- endfor -%} {% endspaceless %} {% endblock widget_container_attributes %} {% block button_attributes %} {% spaceless %} id="{{ id }}" name="{{ full_name }}"{% if disabled %} disabled="disabled"{% endif -%} {%- for attrname, attrvalue in attr -%} {{- " " -}} {%- if attrname in ['placeholder', 'title'] -%} {{- attrname }}="{{ attrvalue|trans({}, translation_domain) }}" {%- elseif attrvalue is sameas(true) -%} {{- attrname }}="{{ attrname }}" {%- elseif attrvalue is not sameas(false) -%} {{- attrname }}="{{ attrvalue }}" {%- endif -%} {%- endfor -%} {% endspaceless %} {% endblock button_attributes %} PKi]^DddTwig/TwigEngine.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig; use Symfony\Component\Templating\EngineInterface; use Symfony\Component\Templating\StreamingEngineInterface; use Symfony\Component\Templating\TemplateNameParserInterface; use Symfony\Component\Templating\TemplateReferenceInterface; /** * This engine knows how to render Twig templates. * * @author Fabien Potencier */ class TwigEngine implements EngineInterface, StreamingEngineInterface { protected $environment; protected $parser; /** * Constructor. * * @param \Twig_Environment $environment A \Twig_Environment instance * @param TemplateNameParserInterface $parser A TemplateNameParserInterface instance */ public function __construct(\Twig_Environment $environment, TemplateNameParserInterface $parser) { $this->environment = $environment; $this->parser = $parser; } /** * {@inheritdoc} * * It also supports \Twig_Template as name parameter. * * @throws \Twig_Error if something went wrong like a thrown exception while rendering the template */ public function render($name, array $parameters = array()) { return $this->load($name)->render($parameters); } /** * {@inheritdoc} * * It also supports \Twig_Template as name parameter. * * @throws \Twig_Error if something went wrong like a thrown exception while rendering the template */ public function stream($name, array $parameters = array()) { $this->load($name)->display($parameters); } /** * {@inheritdoc} * * It also supports \Twig_Template as name parameter. */ public function exists($name) { if ($name instanceof \Twig_Template) { return true; } $loader = $this->environment->getLoader(); if ($loader instanceof \Twig_ExistsLoaderInterface) { return $loader->exists((string) $name); } try { // cast possible TemplateReferenceInterface to string because the // EngineInterface supports them but Twig_LoaderInterface does not $loader->getSource((string) $name); } catch (\Twig_Error_Loader $e) { return false; } return true; } /** * {@inheritdoc} * * It also supports \Twig_Template as name parameter. */ public function supports($name) { if ($name instanceof \Twig_Template) { return true; } $template = $this->parser->parse($name); return 'twig' === $template->get('engine'); } /** * Loads the given template. * * @param string|TemplateReferenceInterface|\Twig_Template $name A template name or an instance of * TemplateReferenceInterface or \Twig_Template * * @return \Twig_TemplateInterface A \Twig_TemplateInterface instance * * @throws \InvalidArgumentException if the template does not exist */ protected function load($name) { if ($name instanceof \Twig_Template) { return $name; } try { return $this->environment->loadTemplate((string) $name); } catch (\Twig_Error_Loader $e) { throw new \InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } } } PKi]`fS..#Twig/Extension/RoutingExtension.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Extension; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; /** * Provides integration of the Routing component with Twig. * * @author Fabien Potencier */ class RoutingExtension extends \Twig_Extension { private $generator; public function __construct(UrlGeneratorInterface $generator) { $this->generator = $generator; } /** * Returns a list of functions to add to the existing list. * * @return array An array of functions */ public function getFunctions() { return array( new \Twig_SimpleFunction('url', array($this, 'getUrl'), array('is_safe_callback' => array($this, 'isUrlGenerationSafe'))), new \Twig_SimpleFunction('path', array($this, 'getPath'), array('is_safe_callback' => array($this, 'isUrlGenerationSafe'))), ); } public function getPath($name, $parameters = array(), $relative = false) { return $this->generator->generate($name, $parameters, $relative ? UrlGeneratorInterface::RELATIVE_PATH : UrlGeneratorInterface::ABSOLUTE_PATH); } public function getUrl($name, $parameters = array(), $schemeRelative = false) { return $this->generator->generate($name, $parameters, $schemeRelative ? UrlGeneratorInterface::NETWORK_PATH : UrlGeneratorInterface::ABSOLUTE_URL); } /** * Determines at compile time whether the generated URL will be safe and thus * saving the unneeded automatic escaping for performance reasons. * * The URL generation process percent encodes non-alphanumeric characters. So there is no risk * that malicious/invalid characters are part of the URL. The only character within an URL that * must be escaped in html is the ampersand ("&") which separates query params. So we cannot mark * the URL generation as always safe, but only when we are sure there won't be multiple query * params. This is the case when there are none or only one constant parameter given. * E.g. we know beforehand this will be safe: * - path('route') * - path('route', {'param': 'value'}) * But the following may not: * - path('route', var) * - path('route', {'param': ['val1', 'val2'] }) // a sub-array * - path('route', {'param1': 'value1', 'param2': 'value2'}) * If param1 and param2 reference placeholder in the route, it would still be safe. But we don't know. * * @param \Twig_Node $argsNode The arguments of the path/url function * * @return array An array with the contexts the URL is safe */ public function isUrlGenerationSafe(\Twig_Node $argsNode) { // support named arguments $paramsNode = $argsNode->hasNode('parameters') ? $argsNode->getNode('parameters') : ( $argsNode->hasNode(1) ? $argsNode->getNode(1) : null ); if (null === $paramsNode || $paramsNode instanceof \Twig_Node_Expression_Array && count($paramsNode) <= 2 && (!$paramsNode->hasNode(1) || $paramsNode->getNode(1) instanceof \Twig_Node_Expression_Constant) ) { return array('html'); } return array(); } /** * Returns the name of the extension. * * @return string The extension name */ public function getName() { return 'routing'; } } PKi]5mm%Twig/Extension/StopwatchExtension.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Extension; use Symfony\Component\Stopwatch\Stopwatch; use Symfony\Bridge\Twig\TokenParser\StopwatchTokenParser; /** * Twig extension for the stopwatch helper. * * @author Wouter J */ class StopwatchExtension extends \Twig_Extension { private $stopwatch; public function __construct(Stopwatch $stopwatch = null) { $this->stopwatch = $stopwatch; } public function getStopwatch() { return $this->stopwatch; } public function getTokenParsers() { return array( /* * {% stopwatch foo %} * Some stuff which will be recorded on the timeline * {% endstopwatch %} */ new StopwatchTokenParser($this->stopwatch !== null), ); } public function getName() { return 'stopwatch'; } } PKi]KΙ&Twig/Extension/ExpressionExtension.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Extension; use Symfony\Component\ExpressionLanguage\Expression; /** * ExpressionExtension gives a way to create Expressions from a template. * * @author Fabien Potencier */ class ExpressionExtension extends \Twig_Extension { /** * {@inheritdoc} */ public function getFunctions() { return array( new \Twig_SimpleFunction('expression', array($this, 'createExpression')), ); } public function createExpression($expression) { return new Expression($expression); } /** * Returns the name of the extension. * * @return string The extension name */ public function getName() { return 'expression'; } } PKi]doo$Twig/Extension/SecurityExtension.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Extension; use Symfony\Component\Security\Acl\Voter\FieldVote; use Symfony\Component\Security\Core\SecurityContextInterface; /** * SecurityExtension exposes security context features. * * @author Fabien Potencier */ class SecurityExtension extends \Twig_Extension { private $context; public function __construct(SecurityContextInterface $context = null) { $this->context = $context; } public function isGranted($role, $object = null, $field = null) { if (null === $this->context) { return false; } if (null !== $field) { $object = new FieldVote($object, $field); } return $this->context->isGranted($role, $object); } /** * {@inheritdoc} */ public function getFunctions() { return array( new \Twig_SimpleFunction('is_granted', array($this, 'isGranted')), ); } /** * Returns the name of the extension. * * @return string The extension name */ public function getName() { return 'security'; } } PKi]? 'Twig/Extension/TranslationExtension.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Extension; use Symfony\Bridge\Twig\TokenParser\TransTokenParser; use Symfony\Bridge\Twig\TokenParser\TransChoiceTokenParser; use Symfony\Bridge\Twig\TokenParser\TransDefaultDomainTokenParser; use Symfony\Component\Translation\TranslatorInterface; use Symfony\Bridge\Twig\NodeVisitor\TranslationNodeVisitor; use Symfony\Bridge\Twig\NodeVisitor\TranslationDefaultDomainNodeVisitor; /** * Provides integration of the Translation component with Twig. * * @author Fabien Potencier */ class TranslationExtension extends \Twig_Extension { private $translator; private $translationNodeVisitor; public function __construct(TranslatorInterface $translator, \Twig_NodeVisitorInterface $translationNodeVisitor = null) { if (!$translationNodeVisitor) { $translationNodeVisitor = new TranslationNodeVisitor(); } $this->translator = $translator; $this->translationNodeVisitor = $translationNodeVisitor; } public function getTranslator() { return $this->translator; } /** * {@inheritdoc} */ public function getFilters() { return array( new \Twig_SimpleFilter('trans', array($this, 'trans')), new \Twig_SimpleFilter('transchoice', array($this, 'transchoice')), ); } /** * Returns the token parser instance to add to the existing list. * * @return array An array of Twig_TokenParser instances */ public function getTokenParsers() { return array( // {% trans %}Symfony is great!{% endtrans %} new TransTokenParser(), // {% transchoice count %} // {0} There is no apples|{1} There is one apple|]1,Inf] There is {{ count }} apples // {% endtranschoice %} new TransChoiceTokenParser(), // {% trans_default_domain "foobar" %} new TransDefaultDomainTokenParser(), ); } /** * {@inheritdoc} */ public function getNodeVisitors() { return array($this->translationNodeVisitor, new TranslationDefaultDomainNodeVisitor()); } public function getTranslationNodeVisitor() { return $this->translationNodeVisitor; } public function trans($message, array $arguments = array(), $domain = null, $locale = null) { if (null === $domain) { $domain = 'messages'; } return $this->translator->trans($message, $arguments, $domain, $locale); } public function transchoice($message, $count, array $arguments = array(), $domain = null, $locale = null) { if (null === $domain) { $domain = 'messages'; } return $this->translator->transChoice($message, $count, array_merge(array('%count%' => $count), $arguments), $domain, $locale); } /** * Returns the name of the extension. * * @return string The extension name */ public function getName() { return 'translator'; } } PKi]9=KK Twig/Extension/FormExtension.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Extension; use Symfony\Bridge\Twig\TokenParser\FormThemeTokenParser; use Symfony\Bridge\Twig\Form\TwigRendererInterface; use Symfony\Component\Form\Extension\Core\View\ChoiceView; /** * FormExtension extends Twig with form capabilities. * * @author Fabien Potencier * @author Bernhard Schussek */ class FormExtension extends \Twig_Extension { /** * This property is public so that it can be accessed directly from compiled * templates without having to call a getter, which slightly decreases performance. * * @var TwigRendererInterface */ public $renderer; public function __construct(TwigRendererInterface $renderer) { $this->renderer = $renderer; } /** * {@inheritdoc} */ public function initRuntime(\Twig_Environment $environment) { $this->renderer->setEnvironment($environment); } /** * {@inheritdoc} */ public function getTokenParsers() { return array( // {% form_theme form "SomeBundle::widgets.twig" %} new FormThemeTokenParser(), ); } /** * {@inheritdoc} */ public function getFunctions() { return array( 'form_enctype' => new \Twig_Function_Node('Symfony\Bridge\Twig\Node\FormEnctypeNode', array('is_safe' => array('html'))), 'form_widget' => new \Twig_Function_Node('Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', array('is_safe' => array('html'))), 'form_errors' => new \Twig_Function_Node('Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', array('is_safe' => array('html'))), 'form_label' => new \Twig_Function_Node('Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', array('is_safe' => array('html'))), 'form_row' => new \Twig_Function_Node('Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', array('is_safe' => array('html'))), 'form_rest' => new \Twig_Function_Node('Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', array('is_safe' => array('html'))), 'form' => new \Twig_Function_Node('Symfony\Bridge\Twig\Node\RenderBlockNode', array('is_safe' => array('html'))), 'form_start' => new \Twig_Function_Node('Symfony\Bridge\Twig\Node\RenderBlockNode', array('is_safe' => array('html'))), 'form_end' => new \Twig_Function_Node('Symfony\Bridge\Twig\Node\RenderBlockNode', array('is_safe' => array('html'))), 'csrf_token' => new \Twig_Function_Method($this, 'renderer->renderCsrfToken'), ); } /** * {@inheritdoc} */ public function getFilters() { return array( new \Twig_SimpleFilter('humanize', array($this->renderer, 'humanize')), ); } /** * {@inheritdoc} */ public function getTests() { return array( new \Twig_SimpleTest('selectedchoice', array($this, 'isSelectedChoice')), ); } /** * Returns whether a choice is selected for a given form value. * * Unfortunately Twig does not support an efficient way to execute the * "is_selected" closure passed to the template by ChoiceType. It is faster * to implement the logic here (around 65ms for a specific form). * * Directly implementing the logic here is also faster than doing so in * ChoiceView (around 30ms). * * The worst option tested so far is to implement the logic in ChoiceView * and access the ChoiceView method directly in the template. Doing so is * around 220ms slower than doing the method call here in the filter. Twig * seems to be much more efficient at executing filters than at executing * methods of an object. * * @param ChoiceView $choice The choice to check. * @param string|array $selectedValue The selected value to compare. * * @return Boolean Whether the choice is selected. * * @see ChoiceView::isSelected() */ public function isSelectedChoice(ChoiceView $choice, $selectedValue) { if (is_array($selectedValue)) { return false !== array_search($choice->value, $selectedValue, true); } return $choice->value === $selectedValue; } /** * {@inheritdoc} */ public function getName() { return 'form'; } } PKi]&a a &Twig/Extension/HttpKernelExtension.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Extension; use Symfony\Component\HttpKernel\Fragment\FragmentHandler; use Symfony\Component\HttpKernel\Controller\ControllerReference; /** * Provides integration with the HttpKernel component. * * @author Fabien Potencier */ class HttpKernelExtension extends \Twig_Extension { private $handler; /** * Constructor. * * @param FragmentHandler $handler A FragmentHandler instance */ public function __construct(FragmentHandler $handler) { $this->handler = $handler; } public function getFunctions() { return array( new \Twig_SimpleFunction('render',array($this, 'renderFragment'), array('is_safe' => array('html'))), new \Twig_SimpleFunction('render_*', array($this, 'renderFragmentStrategy'), array('is_safe' => array('html'))), new \Twig_SimpleFunction('controller', array($this, 'controller')), ); } /** * Renders a fragment. * * @param string|ControllerReference $uri A URI as a string or a ControllerReference instance * @param array $options An array of options * * @return string The fragment content * * @see Symfony\Component\HttpKernel\Fragment\FragmentHandler::render() */ public function renderFragment($uri, $options = array()) { $strategy = isset($options['strategy']) ? $options['strategy'] : 'inline'; unset($options['strategy']); return $this->handler->render($uri, $strategy, $options); } /** * Renders a fragment. * * @param string $strategy A strategy name * @param string|ControllerReference $uri A URI as a string or a ControllerReference instance * @param array $options An array of options * * @return string The fragment content * * @see Symfony\Component\HttpKernel\Fragment\FragmentHandler::render() */ public function renderFragmentStrategy($strategy, $uri, $options = array()) { return $this->handler->render($uri, $strategy, $options); } public function controller($controller, $attributes = array(), $query = array()) { return new ControllerReference($controller, $attributes, $query); } public function getName() { return 'http_kernel'; } } PKi]| Twig/Extension/YamlExtension.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Extension; use Symfony\Component\Yaml\Dumper as YamlDumper; /** * Provides integration of the Yaml component with Twig. * * @author Fabien Potencier */ class YamlExtension extends \Twig_Extension { /** * {@inheritdoc} */ public function getFilters() { return array( new \Twig_SimpleFilter('yaml_encode', array($this, 'encode')), new \Twig_SimpleFilter('yaml_dump', array($this, 'dump')), ); } public function encode($input, $inline = 0, $dumpObjects = false) { static $dumper; if (null === $dumper) { $dumper = new YamlDumper(); } return $dumper->dump($input, $inline, false, $dumpObjects); } public function dump($value, $inline = 0, $dumpObjects = false) { if (is_resource($value)) { return '%Resource%'; } if (is_array($value) || is_object($value)) { return '%'.gettype($value).'% '.$this->encode($value, $inline, $dumpObjects); } return $this->encode($value, $inline, $dumpObjects); } /** * Returns the name of the extension. * * @return string The extension name */ public function getName() { return 'yaml'; } } PKi]  Twig/Extension/CodeExtension.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Extension; if (!defined('ENT_SUBSTITUTE')) { define('ENT_SUBSTITUTE', 8); } /** * Twig extension relate to PHP code and used by the profiler and the default exception templates. * * @author Fabien Potencier */ class CodeExtension extends \Twig_Extension { private $fileLinkFormat; private $rootDir; private $charset; /** * Constructor. * * @param string $fileLinkFormat The format for links to source files * @param string $rootDir The project root directory * @param string $charset The charset */ public function __construct($fileLinkFormat, $rootDir, $charset) { $this->fileLinkFormat = empty($fileLinkFormat) ? ini_get('xdebug.file_link_format') : $fileLinkFormat; $this->rootDir = str_replace('\\', '/', $rootDir).'/'; $this->charset = $charset; } /** * {@inheritdoc} */ public function getFilters() { return array( new \Twig_SimpleFilter('abbr_class', array($this, 'abbrClass'), array('is_safe' => array('html'))), new \Twig_SimpleFilter('abbr_method', array($this, 'abbrMethod'), array('is_safe' => array('html'))), new \Twig_SimpleFilter('format_args', array($this, 'formatArgs'), array('is_safe' => array('html'))), new \Twig_SimpleFilter('format_args_as_text', array($this, 'formatArgsAsText')), new \Twig_SimpleFilter('file_excerpt', array($this, 'fileExcerpt'), array('is_safe' => array('html'))), new \Twig_SimpleFilter('format_file', array($this, 'formatFile'), array('is_safe' => array('html'))), new \Twig_SimpleFilter('format_file_from_text', array($this, 'formatFileFromText'), array('is_safe' => array('html'))), new \Twig_SimpleFilter('file_link', array($this, 'getFileLink'), array('is_safe' => array('html'))), ); } public function abbrClass($class) { $parts = explode('\\', $class); $short = array_pop($parts); return sprintf("%s", $class, $short); } public function abbrMethod($method) { if (false !== strpos($method, '::')) { list($class, $method) = explode('::', $method, 2); $result = sprintf("%s::%s()", $this->abbrClass($class), $method); } elseif ('Closure' === $method) { $result = sprintf("%s", $method, $method); } else { $result = sprintf("%s()", $method, $method); } return $result; } /** * Formats an array as a string. * * @param array $args The argument array * * @return string */ public function formatArgs($args) { $result = array(); foreach ($args as $key => $item) { if ('object' === $item[0]) { $parts = explode('\\', $item[1]); $short = array_pop($parts); $formattedValue = sprintf("object(%s)", $item[1], $short); } elseif ('array' === $item[0]) { $formattedValue = sprintf("array(%s)", is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]); } elseif ('string' === $item[0]) { $formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES, $this->charset)); } elseif ('null' === $item[0]) { $formattedValue = 'null'; } elseif ('boolean' === $item[0]) { $formattedValue = ''.strtolower(var_export($item[1], true)).''; } elseif ('resource' === $item[0]) { $formattedValue = 'resource'; } else { $formattedValue = str_replace("\n", '', var_export(htmlspecialchars((string) $item[1], ENT_QUOTES, $this->charset), true)); } $result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue); } return implode(', ', $result); } /** * Formats an array as a string. * * @param array $args The argument array * * @return string */ public function formatArgsAsText($args) { return strip_tags($this->formatArgs($args)); } /** * Returns an excerpt of a code file around the given line number. * * @param string $file A file path * @param int $line The selected line number * * @return string An HTML string */ public function fileExcerpt($file, $line) { if (is_readable($file)) { // highlight_file could throw warnings // see https://bugs.php.net/bug.php?id=25725 $code = @highlight_file($file, true); // remove main code/span tags $code = preg_replace('#^\s*(.*)\s*#s', '\\1', $code); $content = preg_split('#
#', $code); $lines = array(); for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; $i++) { $lines[] = ''.self::fixCodeMarkup($content[$i - 1]).''; } return '
    '.implode("\n", $lines).'
'; } } /** * Formats a file path. * * @param string $file An absolute file path * @param integer $line The line number * @param string $text Use this text for the link rather than the file path * * @return string */ public function formatFile($file, $line, $text = null) { if (null === $text) { $file = trim($file); $text = $file; if (0 === strpos($text, $this->rootDir)) { $text = str_replace($this->rootDir, '', str_replace('\\', '/', $text)); $text = sprintf('kernel.root_dir/%s', $this->rootDir, $text); } } $text = "$text at line $line"; if (false !== $link = $this->getFileLink($file, $line)) { return sprintf('%s', htmlspecialchars($link, ENT_QUOTES | ENT_SUBSTITUTE, $this->charset), $text); } return $text; } /** * Returns the link for a given file/line pair. * * @param string $file An absolute file path * @param integer $line The line number * * @return string A link of false */ public function getFileLink($file, $line) { if ($this->fileLinkFormat && is_file($file)) { return strtr($this->fileLinkFormat, array('%f' => $file, '%l' => $line)); } return false; } public function formatFileFromText($text) { $that = $this; return preg_replace_callback('/in ("|")?(.+?)\1(?: +(?:on|at))? +line (\d+)/s', function ($match) use ($that) { return 'in '.$that->formatFile($match[2], $match[3]); }, $text); } public function getName() { return 'code'; } protected static function fixCodeMarkup($line) { // ending tag from previous line $opening = strpos($line, ''); if (false !== $closing && (false === $opening || $closing < $opening)) { $line = substr_replace($line, '', $closing, 7); } // missing tag at the end of line $opening = strpos($line, ''); if (false !== $opening && (false === $closing || $closing > $opening)) { $line .= ''; } return $line; } } PKi])UU"Twig/Translation/TwigExtractor.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Translation; use Symfony\Component\Finder\Finder; use Symfony\Component\Translation\Extractor\ExtractorInterface; use Symfony\Component\Translation\MessageCatalogue; /** * TwigExtractor extracts translation messages from a twig template. * * @author Michel Salib * @author Fabien Potencier */ class TwigExtractor implements ExtractorInterface { /** * Default domain for found messages. * * @var string */ private $defaultDomain = 'messages'; /** * Prefix for found message. * * @var string */ private $prefix = ''; /** * The twig environment. * * @var \Twig_Environment */ private $twig; public function __construct(\Twig_Environment $twig) { $this->twig = $twig; } /** * {@inheritDoc} */ public function extract($directory, MessageCatalogue $catalogue) { // load any existing translation files $finder = new Finder(); $files = $finder->files()->name('*.twig')->sortByName()->in($directory); foreach ($files as $file) { $this->extractTemplate(file_get_contents($file->getPathname()), $catalogue); } } /** * {@inheritDoc} */ public function setPrefix($prefix) { $this->prefix = $prefix; } protected function extractTemplate($template, MessageCatalogue $catalogue) { $visitor = $this->twig->getExtension('translator')->getTranslationNodeVisitor(); $visitor->enable(); $this->twig->parse($this->twig->tokenize($template)); foreach ($visitor->getMessages() as $message) { $catalogue->set(trim($message[0]), $this->prefix.trim($message[0]), $message[1] ? $message[1] : $this->defaultDomain); } $visitor->disable(); } } PKi]< Twig/Form/TwigRendererEngine.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Form; use Symfony\Component\Form\AbstractRendererEngine; use Symfony\Component\Form\FormView; /** * @author Bernhard Schussek */ class TwigRendererEngine extends AbstractRendererEngine implements TwigRendererEngineInterface { /** * @var \Twig_Environment */ private $environment; /** * @var \Twig_Template */ private $template; /** * {@inheritdoc} */ public function setEnvironment(\Twig_Environment $environment) { $this->environment = $environment; } /** * {@inheritdoc} */ public function renderBlock(FormView $view, $resource, $blockName, array $variables = array()) { $cacheKey = $view->vars[self::CACHE_KEY_VAR]; $context = $this->environment->mergeGlobals($variables); ob_start(); // By contract,This method can only be called after getting the resource // (which is passed to the method). Getting a resource for the first time // (with an empty cache) is guaranteed to invoke loadResourcesFromTheme(), // where the property $template is initialized. // We do not call renderBlock here to avoid too many nested level calls // (XDebug limits the level to 100 by default) $this->template->displayBlock($blockName, $context, $this->resources[$cacheKey]); return ob_get_clean(); } /** * Loads the cache with the resource for a given block name. * * This implementation eagerly loads all blocks of the themes assigned to the given view * and all of its ancestors views. This is necessary, because Twig receives the * list of blocks later. At that point, all blocks must already be loaded, for the * case that the function "block()" is used in the Twig template. * * @see getResourceForBlock() * * @param string $cacheKey The cache key of the form view. * @param FormView $view The form view for finding the applying themes. * @param string $blockName The name of the block to load. * * @return Boolean True if the resource could be loaded, false otherwise. */ protected function loadResourceForBlockName($cacheKey, FormView $view, $blockName) { // The caller guarantees that $this->resources[$cacheKey][$block] is // not set, but it doesn't have to check whether $this->resources[$cacheKey] // is set. If $this->resources[$cacheKey] is set, all themes for this // $cacheKey are already loaded (due to the eager population, see doc comment). if (isset($this->resources[$cacheKey])) { // As said in the previous, the caller guarantees that // $this->resources[$cacheKey][$block] is not set. Since the themes are // already loaded, it can only be a non-existing block. $this->resources[$cacheKey][$blockName] = false; return false; } // Recursively try to find the block in the themes assigned to $view, // then of its parent view, then of the parent view of the parent and so on. // When the root view is reached in this recursion, also the default // themes are taken into account. // Check each theme whether it contains the searched block if (isset($this->themes[$cacheKey])) { for ($i = count($this->themes[$cacheKey]) - 1; $i >= 0; --$i) { $this->loadResourcesFromTheme($cacheKey, $this->themes[$cacheKey][$i]); // CONTINUE LOADING (see doc comment) } } // Check the default themes once we reach the root view without success if (!$view->parent) { for ($i = count($this->defaultThemes) - 1; $i >= 0; --$i) { $this->loadResourcesFromTheme($cacheKey, $this->defaultThemes[$i]); // CONTINUE LOADING (see doc comment) } } // Proceed with the themes of the parent view if ($view->parent) { $parentCacheKey = $view->parent->vars[self::CACHE_KEY_VAR]; if (!isset($this->resources[$parentCacheKey])) { $this->loadResourceForBlockName($parentCacheKey, $view->parent, $blockName); } // EAGER CACHE POPULATION (see doc comment) foreach ($this->resources[$parentCacheKey] as $nestedBlockName => $resource) { if (!isset($this->resources[$cacheKey][$nestedBlockName])) { $this->resources[$cacheKey][$nestedBlockName] = $resource; } } } // Even though we loaded the themes, it can happen that none of them // contains the searched block if (!isset($this->resources[$cacheKey][$blockName])) { // Cache that we didn't find anything to speed up further accesses $this->resources[$cacheKey][$blockName] = false; } return false !== $this->resources[$cacheKey][$blockName]; } /** * Loads the resources for all blocks in a theme. * * @param string $cacheKey The cache key for storing the resource. * @param mixed $theme The theme to load the block from. This parameter * is passed by reference, because it might be necessary * to initialize the theme first. Any changes made to * this variable will be kept and be available upon * further calls to this method using the same theme. */ protected function loadResourcesFromTheme($cacheKey, &$theme) { if (!$theme instanceof \Twig_Template) { /* @var \Twig_Template $theme */ $theme = $this->environment->loadTemplate($theme); } if (null === $this->template) { // Store the first \Twig_Template instance that we find so that // we can call displayBlock() later on. It doesn't matter *which* // template we use for that, since we pass the used blocks manually // anyway. $this->template = $theme; } // Use a separate variable for the inheritance traversal, because // theme is a reference and we don't want to change it. $currentTheme = $theme; $context = $this->environment->mergeGlobals(array()); // The do loop takes care of template inheritance. // Add blocks from all templates in the inheritance tree, but avoid // overriding blocks already set. do { foreach ($currentTheme->getBlocks() as $block => $blockData) { if (!isset($this->resources[$cacheKey][$block])) { // The resource given back is the key to the bucket that // contains this block. $this->resources[$cacheKey][$block] = $blockData; } } } while (false !== $currentTheme = $currentTheme->getParent($context)); } } PKi]vqTwig/Form/TwigRenderer.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Form; use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderAdapter; use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface; use Symfony\Component\Form\FormRenderer; use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; /** * @author Bernhard Schussek */ class TwigRenderer extends FormRenderer implements TwigRendererInterface { /** * @var TwigRendererEngineInterface */ private $engine; public function __construct(TwigRendererEngineInterface $engine, $csrfTokenManager = null) { if ($csrfTokenManager instanceof CsrfProviderInterface) { $csrfTokenManager = new CsrfProviderAdapter($csrfTokenManager); } elseif (null !== $csrfTokenManager && !$csrfTokenManager instanceof CsrfTokenManagerInterface) { throw new UnexpectedTypeException($csrfTokenManager, 'CsrfProviderInterface or CsrfTokenManagerInterface'); } parent::__construct($engine, $csrfTokenManager); $this->engine = $engine; } /** * {@inheritdoc} */ public function setEnvironment(\Twig_Environment $environment) { $this->engine->setEnvironment($environment); } } PKi]Qkk#Twig/Form/TwigRendererInterface.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Form; use Symfony\Component\Form\FormRendererInterface; /** * @author Bernhard Schussek */ interface TwigRendererInterface extends FormRendererInterface { /** * Sets Twig's environment. * * @param \Twig_Environment $environment */ public function setEnvironment(\Twig_Environment $environment); } PKi]b3}})Twig/Form/TwigRendererEngineInterface.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Form; use Symfony\Component\Form\FormRendererEngineInterface; /** * @author Bernhard Schussek */ interface TwigRendererEngineInterface extends FormRendererEngineInterface { /** * Sets Twig's environment. * * @param \Twig_Environment $environment */ public function setEnvironment(\Twig_Environment $environment); } PKi]/ +Twig/TokenParser/TransChoiceTokenParser.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\TokenParser; use Symfony\Bridge\Twig\Node\TransNode; /** * Token Parser for the 'transchoice' tag. * * @author Fabien Potencier */ class TransChoiceTokenParser extends TransTokenParser { /** * Parses a token and returns a node. * * @param \Twig_Token $token A Twig_Token instance * * @return \Twig_NodeInterface A Twig_NodeInterface instance * * @throws \Twig_Error_Syntax */ public function parse(\Twig_Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); $vars = new \Twig_Node_Expression_Array(array(), $lineno); $count = $this->parser->getExpressionParser()->parseExpression(); $domain = null; $locale = null; if ($stream->test('with')) { // {% transchoice count with vars %} $stream->next(); $vars = $this->parser->getExpressionParser()->parseExpression(); } if ($stream->test('from')) { // {% transchoice count from "messages" %} $stream->next(); $domain = $this->parser->getExpressionParser()->parseExpression(); } if ($stream->test('into')) { // {% transchoice count into "fr" %} $stream->next(); $locale = $this->parser->getExpressionParser()->parseExpression(); } $stream->expect(\Twig_Token::BLOCK_END_TYPE); $body = $this->parser->subparse(array($this, 'decideTransChoiceFork'), true); if (!$body instanceof \Twig_Node_Text && !$body instanceof \Twig_Node_Expression) { throw new \Twig_Error_Syntax('A message inside a transchoice tag must be a simple text.', $body->getLine(), $stream->getFilename()); } $stream->expect(\Twig_Token::BLOCK_END_TYPE); return new TransNode($body, $domain, $count, $vars, $locale, $lineno, $this->getTag()); } public function decideTransChoiceFork($token) { return $token->test(array('endtranschoice')); } /** * Gets the tag name associated with this token parser. * * @return string The tag name */ public function getTag() { return 'transchoice'; } } PKi].)Twig/TokenParser/StopwatchTokenParser.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\TokenParser; use Symfony\Bridge\Twig\Node\StopwatchNode; /** * Token Parser for the stopwatch tag. * * @author Wouter J */ class StopwatchTokenParser extends \Twig_TokenParser { protected $stopwatchIsAvailable; public function __construct($stopwatchIsAvailable) { $this->stopwatchIsAvailable = $stopwatchIsAvailable; } public function parse(\Twig_Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); // {% stopwatch 'bar' %} $name = $this->parser->getExpressionParser()->parseExpression(); $stream->expect(\Twig_Token::BLOCK_END_TYPE); // {% endstopwatch %} $body = $this->parser->subparse(array($this, 'decideStopwatchEnd'), true); $stream->expect(\Twig_Token::BLOCK_END_TYPE); if ($this->stopwatchIsAvailable) { return new StopwatchNode($name, $body, new \Twig_Node_Expression_AssignName($this->parser->getVarName(), $token->getLine()), $lineno, $this->getTag()); } return $body; } public function decideStopwatchEnd(\Twig_Token $token) { return $token->test('endstopwatch'); } public function getTag() { return 'stopwatch'; } } PKi]>)Twig/TokenParser/FormThemeTokenParser.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\TokenParser; use Symfony\Bridge\Twig\Node\FormThemeNode; /** * Token Parser for the 'form_theme' tag. * * @author Fabien Potencier */ class FormThemeTokenParser extends \Twig_TokenParser { /** * Parses a token and returns a node. * * @param \Twig_Token $token A Twig_Token instance * * @return \Twig_NodeInterface A Twig_NodeInterface instance */ public function parse(\Twig_Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); $form = $this->parser->getExpressionParser()->parseExpression(); if ($this->parser->getStream()->test(\Twig_Token::NAME_TYPE, 'with')) { $this->parser->getStream()->next(); $resources = $this->parser->getExpressionParser()->parseExpression(); } else { $resources = new \Twig_Node_Expression_Array(array(), $stream->getCurrent()->getLine()); do { $resources->addElement($this->parser->getExpressionParser()->parseExpression()); } while (!$stream->test(\Twig_Token::BLOCK_END_TYPE)); } $stream->expect(\Twig_Token::BLOCK_END_TYPE); return new FormThemeNode($form, $resources, $lineno, $this->getTag()); } /** * Gets the tag name associated with this token parser. * * @return string The tag name */ public function getTag() { return 'form_theme'; } } PKi]%] %Twig/TokenParser/TransTokenParser.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\TokenParser; use Symfony\Bridge\Twig\Node\TransNode; /** * Token Parser for the 'trans' tag. * * @author Fabien Potencier */ class TransTokenParser extends \Twig_TokenParser { /** * Parses a token and returns a node. * * @param \Twig_Token $token A Twig_Token instance * * @return \Twig_NodeInterface A Twig_NodeInterface instance * * @throws \Twig_Error_Syntax */ public function parse(\Twig_Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); $vars = new \Twig_Node_Expression_Array(array(), $lineno); $domain = null; $locale = null; if (!$stream->test(\Twig_Token::BLOCK_END_TYPE)) { if ($stream->test('with')) { // {% trans with vars %} $stream->next(); $vars = $this->parser->getExpressionParser()->parseExpression(); } if ($stream->test('from')) { // {% trans from "messages" %} $stream->next(); $domain = $this->parser->getExpressionParser()->parseExpression(); } if ($stream->test('into')) { // {% trans into "fr" %} $stream->next(); $locale = $this->parser->getExpressionParser()->parseExpression(); } elseif (!$stream->test(\Twig_Token::BLOCK_END_TYPE)) { throw new \Twig_Error_Syntax('Unexpected token. Twig was looking for the "with", "from", or "into" keyword.', $stream->getCurrent()->getLine(), $stream->getFilename()); } } // {% trans %}message{% endtrans %} $stream->expect(\Twig_Token::BLOCK_END_TYPE); $body = $this->parser->subparse(array($this, 'decideTransFork'), true); if (!$body instanceof \Twig_Node_Text && !$body instanceof \Twig_Node_Expression) { throw new \Twig_Error_Syntax('A message inside a trans tag must be a simple text.', $body->getLine(), $stream->getFilename()); } $stream->expect(\Twig_Token::BLOCK_END_TYPE); return new TransNode($body, $domain, null, $vars, $locale, $lineno, $this->getTag()); } public function decideTransFork($token) { return $token->test(array('endtrans')); } /** * Gets the tag name associated with this token parser. * * @return string The tag name */ public function getTag() { return 'trans'; } } PKi]ʶ̭2Twig/TokenParser/TransDefaultDomainTokenParser.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\TokenParser; use Symfony\Bridge\Twig\Node\TransDefaultDomainNode; /** * Token Parser for the 'trans_default_domain' tag. * * @author Fabien Potencier */ class TransDefaultDomainTokenParser extends \Twig_TokenParser { /** * Parses a token and returns a node. * * @param \Twig_Token $token A Twig_Token instance * * @return \Twig_NodeInterface A Twig_NodeInterface instance */ public function parse(\Twig_Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); $this->parser->getStream()->expect(\Twig_Token::BLOCK_END_TYPE); return new TransDefaultDomainNode($expr, $token->getLine(), $this->getTag()); } /** * Gets the tag name associated with this token parser. * * @return string The tag name */ public function getTag() { return 'trans_default_domain'; } } PKi]  8Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\NodeVisitor; use Symfony\Bridge\Twig\Node\TransNode; use Symfony\Bridge\Twig\Node\TransDefaultDomainNode; /** * TranslationDefaultDomainNodeVisitor. * * @author Fabien Potencier */ class TranslationDefaultDomainNodeVisitor implements \Twig_NodeVisitorInterface { /** * @var Scope */ private $scope; /** * Constructor. */ public function __construct() { $this->scope = new Scope(); } /** * {@inheritdoc} */ public function enterNode(\Twig_NodeInterface $node, \Twig_Environment $env) { if ($node instanceof \Twig_Node_Block || $node instanceof \Twig_Node_Module) { $this->scope = $this->scope->enter(); } if ($node instanceof TransDefaultDomainNode) { if ($node->getNode('expr') instanceof \Twig_Node_Expression_Constant) { $this->scope->set('domain', $node->getNode('expr')); return $node; } else { $var = $env->getParser()->getVarName(); $name = new \Twig_Node_Expression_AssignName($var, $node->getLine()); $this->scope->set('domain', new \Twig_Node_Expression_Name($var, $node->getLine())); return new \Twig_Node_Set(false, new \Twig_Node(array($name)), new \Twig_Node(array($node->getNode('expr'))), $node->getLine()); } } if (!$this->scope->has('domain')) { return $node; } if ($node instanceof \Twig_Node_Expression_Filter && in_array($node->getNode('filter')->getAttribute('value'), array('trans', 'transchoice'))) { $ind = 'trans' === $node->getNode('filter')->getAttribute('value') ? 1 : 2; $arguments = $node->getNode('arguments'); if (!$arguments->hasNode($ind)) { if (!$arguments->hasNode($ind - 1)) { $arguments->setNode($ind - 1, new \Twig_Node_Expression_Array(array(), $node->getLine())); } $arguments->setNode($ind, $this->scope->get('domain')); } } elseif ($node instanceof TransNode) { if (null === $node->getNode('domain')) { $node->setNode('domain', $this->scope->get('domain')); } } return $node; } /** * {@inheritdoc} */ public function leaveNode(\Twig_NodeInterface $node, \Twig_Environment $env) { if ($node instanceof TransDefaultDomainNode) { return false; } if ($node instanceof \Twig_Node_Block || $node instanceof \Twig_Node_Module) { $this->scope = $this->scope->leave(); } return $node; } /** * {@inheritdoc} */ public function getPriority() { return -10; } } PKi]tA+Twig/NodeVisitor/TranslationNodeVisitor.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\NodeVisitor; use Symfony\Bridge\Twig\Node\TransNode; /** * TranslationNodeVisitor extracts translation messages. * * @author Fabien Potencier */ class TranslationNodeVisitor implements \Twig_NodeVisitorInterface { const UNDEFINED_DOMAIN = '_undefined'; private $enabled = false; private $messages = array(); public function enable() { $this->enabled = true; $this->messages = array(); } public function disable() { $this->enabled = false; $this->messages = array(); } public function getMessages() { return $this->messages; } /** * {@inheritdoc} */ public function enterNode(\Twig_NodeInterface $node, \Twig_Environment $env) { if (!$this->enabled) { return $node; } if ( $node instanceof \Twig_Node_Expression_Filter && 'trans' === $node->getNode('filter')->getAttribute('value') && $node->getNode('node') instanceof \Twig_Node_Expression_Constant ) { // extract constant nodes with a trans filter $this->messages[] = array( $node->getNode('node')->getAttribute('value'), $this->getReadDomainFromArguments($node->getNode('arguments'), 1), ); } elseif ( $node instanceof \Twig_Node_Expression_Filter && 'transchoice' === $node->getNode('filter')->getAttribute('value') && $node->getNode('node') instanceof \Twig_Node_Expression_Constant ) { // extract constant nodes with a trans filter $this->messages[] = array( $node->getNode('node')->getAttribute('value'), $this->getReadDomainFromArguments($node->getNode('arguments'), 2), ); } elseif ($node instanceof TransNode) { // extract trans nodes $this->messages[] = array( $node->getNode('body')->getAttribute('data'), $this->getReadDomainFromNode($node->getNode('domain')), ); } return $node; } /** * {@inheritdoc} */ public function leaveNode(\Twig_NodeInterface $node, \Twig_Environment $env) { return $node; } /** * {@inheritdoc} */ public function getPriority() { return 0; } /** * @param \Twig_Node $arguments * @param int $index * * @return string|null */ private function getReadDomainFromArguments(\Twig_Node $arguments, $index) { if ($arguments->hasNode('domain')) { $argument = $arguments->getNode('domain'); } elseif ($arguments->hasNode($index)) { $argument = $arguments->getNode($index); } else { return null; } return $this->getReadDomainFromNode($argument); } /** * @param \Twig_Node $node * * @return string|null */ private function getReadDomainFromNode(\Twig_Node $node = null) { if (null === $node) { return null; } if ($node instanceof \Twig_Node_Expression_Constant) { return $node->getAttribute('value'); } return self::UNDEFINED_DOMAIN; } } PKi])[n n Twig/NodeVisitor/Scope.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\NodeVisitor; /** * @author Jean-François Simon */ class Scope { /** * @var Scope|null */ private $parent; /** * @var Scope[] */ private $children; /** * @var array */ private $data = array(); /** * @var boolean */ private $left = false; /** * @param Scope $parent */ public function __construct(Scope $parent = null) { $this->parent = $parent; } /** * Opens a new child scope. * * @return Scope */ public function enter() { $child = new self($this); $this->children[] = $child; return $child; } /** * Closes current scope and returns parent one. * * @return Scope|null */ public function leave() { $this->left = true; return $this->parent; } /** * Stores data into current scope. * * @param string $key * @param mixed $value * * @throws \LogicException * * @return Scope Current scope */ public function set($key, $value) { if ($this->left) { throw new \LogicException('Left scope is not mutable.'); } $this->data[$key] = $value; return $this; } /** * Tests if a data is visible from current scope. * * @param string $key * * @return boolean */ public function has($key) { if (array_key_exists($key, $this->data)) { return true; } if (null === $this->parent) { return false; } return $this->parent->has($key); } /** * Returns data visible from current scope. * * @param string $key * @param mixed $default * * @return mixed */ public function get($key, $default = null) { if (array_key_exists($key, $this->data)) { return $this->data[$key]; } if (null === $this->parent) { return $default; } return $this->parent->get($key, $default); } } PKi]^Twig/Node/RenderBlockNode.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Node; /** * Compiles a call to {@link FormRendererInterface::renderBlock()}. * * The function name is used as block name. For example, if the function name * is "foo", the block "foo" will be rendered. * * @author Bernhard Schussek */ class RenderBlockNode extends \Twig_Node_Expression_Function { public function compile(\Twig_Compiler $compiler) { $compiler->addDebugInfo($this); $arguments = iterator_to_array($this->getNode('arguments')); $compiler->write('$this->env->getExtension(\'form\')->renderer->renderBlock('); if (isset($arguments[0])) { $compiler->subcompile($arguments[0]); $compiler->raw(', \'' . $this->getAttribute('name') . '\''); if (isset($arguments[1])) { $compiler->raw(', '); $compiler->subcompile($arguments[1]); } } $compiler->raw(')'); } } PKi]ʦ\G G Twig/Node/TransNode.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Node; /** * @author Fabien Potencier */ class TransNode extends \Twig_Node { public function __construct(\Twig_NodeInterface $body, \Twig_NodeInterface $domain = null, \Twig_Node_Expression $count = null, \Twig_Node_Expression $vars = null, \Twig_Node_Expression $locale = null, $lineno = 0, $tag = null) { parent::__construct(array('count' => $count, 'body' => $body, 'domain' => $domain, 'vars' => $vars, 'locale' => $locale), array(), $lineno, $tag); } /** * Compiles the node to PHP. * * @param \Twig_Compiler $compiler A Twig_Compiler instance */ public function compile(\Twig_Compiler $compiler) { $compiler->addDebugInfo($this); $vars = $this->getNode('vars'); $defaults = new \Twig_Node_Expression_Array(array(), -1); if ($vars instanceof \Twig_Node_Expression_Array) { $defaults = $this->getNode('vars'); $vars = null; } list($msg, $defaults) = $this->compileString($this->getNode('body'), $defaults); $method = null === $this->getNode('count') ? 'trans' : 'transChoice'; $compiler ->write('echo $this->env->getExtension(\'translator\')->getTranslator()->'.$method.'(') ->subcompile($msg) ; $compiler->raw(', '); if (null !== $this->getNode('count')) { $compiler ->subcompile($this->getNode('count')) ->raw(', ') ; } if (null !== $vars) { $compiler ->raw('array_merge(') ->subcompile($defaults) ->raw(', ') ->subcompile($this->getNode('vars')) ->raw(')') ; } else { $compiler->subcompile($defaults); } $compiler->raw(', '); if (null === $this->getNode('domain')) { $compiler->repr('messages'); } else { $compiler->subcompile($this->getNode('domain')); } if (null !== $this->getNode('locale')) { $compiler ->raw(', ') ->subcompile($this->getNode('locale')) ; } $compiler->raw(");\n"); } protected function compileString(\Twig_NodeInterface $body, \Twig_Node_Expression_Array $vars) { if ($body instanceof \Twig_Node_Expression_Constant) { $msg = $body->getAttribute('value'); } elseif ($body instanceof \Twig_Node_Text) { $msg = $body->getAttribute('data'); } else { return array($body, $vars); } preg_match_all('/(?getLine()); if (!$vars->hasElement($key)) { $vars->addElement(new \Twig_Node_Expression_Name($var, $body->getLine()), $key); } } return array(new \Twig_Node_Expression_Constant(str_replace('%%', '%', trim($msg)), $body->getLine()), $vars); } } PKi]PIAA$Twig/Node/TransDefaultDomainNode.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Node; /** * @author Fabien Potencier */ class TransDefaultDomainNode extends \Twig_Node { public function __construct(\Twig_Node_Expression $expr, $lineno = 0, $tag = null) { parent::__construct(array('expr' => $expr), array(), $lineno, $tag); } /** * Compiles the node to PHP. * * @param \Twig_Compiler $compiler A Twig_Compiler instance */ public function compile(\Twig_Compiler $compiler) { // noop as this node is just a marker for TranslationDefaultDomainNodeVisitor } } PKi] s>>Twig/Node/FormThemeNode.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Node; /** * @author Fabien Potencier */ class FormThemeNode extends \Twig_Node { public function __construct(\Twig_NodeInterface $form, \Twig_NodeInterface $resources, $lineno, $tag = null) { parent::__construct(array('form' => $form, 'resources' => $resources), array(), $lineno, $tag); } /** * Compiles the node to PHP. * * @param \Twig_Compiler $compiler A Twig_Compiler instance */ public function compile(\Twig_Compiler $compiler) { $compiler ->addDebugInfo($this) ->write('$this->env->getExtension(\'form\')->renderer->setTheme(') ->subcompile($this->getNode('form')) ->raw(', ') ->subcompile($this->getNode('resources')) ->raw(");\n"); ; } } PKi]U,ttTwig/Node/FormEnctypeNode.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Node; /** * @author Bernhard Schussek * * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use * the helper "form_start()" instead. */ class FormEnctypeNode extends SearchAndRenderBlockNode { public function compile(\Twig_Compiler $compiler) { parent::compile($compiler); // Uncomment this as soon as the deprecation note should be shown // $compiler->write('trigger_error(\'The helper form_enctype(form) is deprecated since version 2.3 and will be removed in 3.0. Use form_start(form) instead.\', E_USER_DEPRECATED)'); } } PKi]6 DZ77Twig/Node/StopwatchNode.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Node; /** * Represents a stopwatch node. * * @author Wouter J */ class StopwatchNode extends \Twig_Node { public function __construct(\Twig_NodeInterface $name, $body, \Twig_Node_Expression_AssignName $var, $lineno = 0, $tag = null) { parent::__construct(array('body' => $body, 'name' => $name, 'var' => $var), array(), $lineno, $tag); } public function compile(\Twig_Compiler $compiler) { $compiler ->addDebugInfo($this) ->write('') ->subcompile($this->getNode('var')) ->raw(' = ') ->subcompile($this->getNode('name')) ->write(";\n") ->write("\$this->env->getExtension('stopwatch')->getStopwatch()->start(") ->subcompile($this->getNode('var')) ->raw(", 'template');\n") ->subcompile($this->getNode('body')) ->write("\$this->env->getExtension('stopwatch')->getStopwatch()->stop(") ->subcompile($this->getNode('var')) ->raw(");\n") ; } } PKi], @&Twig/Node/SearchAndRenderBlockNode.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Node; /** * @author Bernhard Schussek */ class SearchAndRenderBlockNode extends \Twig_Node_Expression_Function { public function compile(\Twig_Compiler $compiler) { $compiler->addDebugInfo($this); $compiler->raw('$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock('); preg_match('/_([^_]+)$/', $this->getAttribute('name'), $matches); $label = null; $arguments = iterator_to_array($this->getNode('arguments')); $blockNameSuffix = $matches[1]; if (isset($arguments[0])) { $compiler->subcompile($arguments[0]); $compiler->raw(', \''.$blockNameSuffix.'\''); if (isset($arguments[1])) { if ('label' === $blockNameSuffix) { // The "label" function expects the label in the second and // the variables in the third argument $label = $arguments[1]; $variables = isset($arguments[2]) ? $arguments[2] : null; $lineno = $label->getLine(); if ($label instanceof \Twig_Node_Expression_Constant) { // If the label argument is given as a constant, we can either // strip it away if it is empty, or integrate it into the array // of variables at compile time. $labelIsExpression = false; // Only insert the label into the array if it is not empty if (!twig_test_empty($label->getAttribute('value'))) { $originalVariables = $variables; $variables = new \Twig_Node_Expression_Array(array(), $lineno); $labelKey = new \Twig_Node_Expression_Constant('label', $lineno); if (null !== $originalVariables) { foreach ($originalVariables->getKeyValuePairs() as $pair) { // Don't copy the original label attribute over if it exists if ((string) $labelKey !== (string) $pair['key']) { $variables->addElement($pair['value'], $pair['key']); } } } // Insert the label argument into the array $variables->addElement($label, $labelKey); } } else { // The label argument is not a constant, but some kind of // expression. This expression needs to be evaluated at runtime. // Depending on the result (whether it is null or not), the // label in the arguments should take precedence over the label // in the attributes or not. $labelIsExpression = true; } } else { // All other functions than "label" expect the variables // in the second argument $label = null; $variables = $arguments[1]; $labelIsExpression = false; } if (null !== $variables || $labelIsExpression) { $compiler->raw(', '); if (null !== $variables) { $compiler->subcompile($variables); } if ($labelIsExpression) { if (null !== $variables) { $compiler->raw(' + '); } // Check at runtime whether the label is empty. // If not, add it to the array at runtime. $compiler->raw('(twig_test_empty($_label_ = '); $compiler->subcompile($label); $compiler->raw(') ? array() : array("label" => $_label_))'); } } } } $compiler->raw(")"); } } PKi]$KKTwig/autoloader.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Doctrine\Common\Persistence\AbstractManagerRegistry; /** * References Doctrine connections and entity/document managers. * * @author Lukas Kahwe Smith */ abstract class ManagerRegistry extends AbstractManagerRegistry implements ContainerAwareInterface { /** * @var ContainerInterface */ protected $container; /** * @inheritdoc */ protected function getService($name) { return $this->container->get($name); } /** * @inheritdoc */ protected function resetService($name) { $this->container->set($name, null); } /** * @inheritdoc */ public function setContainer(ContainerInterface $container = null) { $this->container = $container; } } PKi]؈$Doctrine/Test/DoctrineTestHelper.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\Test; use Doctrine\Common\Annotations\AnnotationReader; use Doctrine\ORM\Mapping\Driver\AnnotationDriver; use Doctrine\ORM\EntityManager; /** * Provides utility functions needed in tests. * * @author Bernhard Schussek */ class DoctrineTestHelper { /** * Returns an entity manager for testing. * * @return EntityManager */ public static function createTestEntityManager() { if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) { \PHPUnit_Framework_TestCase::markTestSkipped('This test requires SQLite support in your environment'); } $config = new \Doctrine\ORM\Configuration(); $config->setEntityNamespaces(array('SymfonyTestsDoctrine' => 'Symfony\Bridge\Doctrine\Tests\Fixtures')); $config->setAutoGenerateProxyClasses(true); $config->setProxyDir(\sys_get_temp_dir()); $config->setProxyNamespace('SymfonyTests\Doctrine'); $config->setMetadataDriverImpl(new AnnotationDriver(new AnnotationReader())); $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $params = array( 'driver' => 'pdo_sqlite', 'memory' => true, ); return EntityManager::create($params, $config); } /** * This class cannot be instantiated. */ private function __construct() { } } PKi]*+JJ:Doctrine/DependencyInjection/AbstractDoctrineExtension.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\DependencyInjection; use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\Config\Resource\FileResource; /** * This abstract classes groups common code that Doctrine Object Manager extensions (ORM, MongoDB, CouchDB) need. * * @author Benjamin Eberlei */ abstract class AbstractDoctrineExtension extends Extension { /** * Used inside metadata driver method to simplify aggregation of data. * * @var array */ protected $aliasMap = array(); /** * Used inside metadata driver method to simplify aggregation of data. * * @var array */ protected $drivers = array(); /** * @param array $objectManager A configured object manager. * @param ContainerBuilder $container A ContainerBuilder instance * * @throws \InvalidArgumentException */ protected function loadMappingInformation(array $objectManager, ContainerBuilder $container) { if ($objectManager['auto_mapping']) { // automatically register bundle mappings foreach (array_keys($container->getParameter('kernel.bundles')) as $bundle) { if (!isset($objectManager['mappings'][$bundle])) { $objectManager['mappings'][$bundle] = array( 'mapping' => true, 'is_bundle' => true, ); } } } foreach ($objectManager['mappings'] as $mappingName => $mappingConfig) { if (null !== $mappingConfig && false === $mappingConfig['mapping']) { continue; } $mappingConfig = array_replace(array( 'dir' => false, 'type' => false, 'prefix' => false, ), (array) $mappingConfig); $mappingConfig['dir'] = $container->getParameterBag()->resolveValue($mappingConfig['dir']); // a bundle configuration is detected by realizing that the specified dir is not absolute and existing if (!isset($mappingConfig['is_bundle'])) { $mappingConfig['is_bundle'] = !is_dir($mappingConfig['dir']); } if ($mappingConfig['is_bundle']) { $bundle = null; foreach ($container->getParameter('kernel.bundles') as $name => $class) { if ($mappingName === $name) { $bundle = new \ReflectionClass($class); break; } } if (null === $bundle) { throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled.', $mappingName)); } $mappingConfig = $this->getMappingDriverBundleConfigDefaults($mappingConfig, $bundle, $container); if (!$mappingConfig) { continue; } } $this->assertValidMappingConfiguration($mappingConfig, $objectManager['name']); $this->setMappingDriverConfig($mappingConfig, $mappingName); $this->setMappingDriverAlias($mappingConfig, $mappingName); } } /** * Register the alias for this mapping driver. * * Aliases can be used in the Query languages of all the Doctrine object managers to simplify writing tasks. * * @param array $mappingConfig * @param string $mappingName */ protected function setMappingDriverAlias($mappingConfig, $mappingName) { if (isset($mappingConfig['alias'])) { $this->aliasMap[$mappingConfig['alias']] = $mappingConfig['prefix']; } else { $this->aliasMap[$mappingName] = $mappingConfig['prefix']; } } /** * Register the mapping driver configuration for later use with the object managers metadata driver chain. * * @param array $mappingConfig * @param string $mappingName * * @throws \InvalidArgumentException */ protected function setMappingDriverConfig(array $mappingConfig, $mappingName) { if (is_dir($mappingConfig['dir'])) { $this->drivers[$mappingConfig['type']][$mappingConfig['prefix']] = realpath($mappingConfig['dir']); } else { throw new \InvalidArgumentException(sprintf('Invalid Doctrine mapping path given. Cannot load Doctrine mapping/bundle named "%s".', $mappingName)); } } /** * If this is a bundle controlled mapping all the missing information can be autodetected by this method. * * Returns false when autodetection failed, an array of the completed information otherwise. * * @param array $bundleConfig * @param \ReflectionClass $bundle * @param ContainerBuilder $container A ContainerBuilder instance * * @return array|false */ protected function getMappingDriverBundleConfigDefaults(array $bundleConfig, \ReflectionClass $bundle, ContainerBuilder $container) { $bundleDir = dirname($bundle->getFilename()); if (!$bundleConfig['type']) { $bundleConfig['type'] = $this->detectMetadataDriver($bundleDir, $container); } if (!$bundleConfig['type']) { // skip this bundle, no mapping information was found. return false; } if (!$bundleConfig['dir']) { if (in_array($bundleConfig['type'], array('annotation', 'staticphp'))) { $bundleConfig['dir'] = $bundleDir.'/'.$this->getMappingObjectDefaultName(); } else { $bundleConfig['dir'] = $bundleDir.'/'.$this->getMappingResourceConfigDirectory(); } } else { $bundleConfig['dir'] = $bundleDir.'/'.$bundleConfig['dir']; } if (!$bundleConfig['prefix']) { $bundleConfig['prefix'] = $bundle->getNamespaceName().'\\'.$this->getMappingObjectDefaultName(); } return $bundleConfig; } /** * Register all the collected mapping information with the object manager by registering the appropriate mapping drivers. * * @param array $objectManager * @param ContainerBuilder $container A ContainerBuilder instance */ protected function registerMappingDrivers($objectManager, ContainerBuilder $container) { // configure metadata driver for each bundle based on the type of mapping files found if ($container->hasDefinition($this->getObjectManagerElementName($objectManager['name'].'_metadata_driver'))) { $chainDriverDef = $container->getDefinition($this->getObjectManagerElementName($objectManager['name'].'_metadata_driver')); } else { $chainDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.driver_chain.class%')); $chainDriverDef->setPublic(false); } foreach ($this->drivers as $driverType => $driverPaths) { $mappingService = $this->getObjectManagerElementName($objectManager['name'].'_'.$driverType.'_metadata_driver'); if ($container->hasDefinition($mappingService)) { $mappingDriverDef = $container->getDefinition($mappingService); $args = $mappingDriverDef->getArguments(); if ($driverType == 'annotation') { $args[1] = array_merge(array_values($driverPaths), $args[1]); } else { $args[0] = array_merge(array_values($driverPaths), $args[0]); } $mappingDriverDef->setArguments($args); } elseif ($driverType == 'annotation') { $mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), array( new Reference($this->getObjectManagerElementName('metadata.annotation_reader')), array_values($driverPaths) )); } else { $mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), array( array_values($driverPaths) )); } $mappingDriverDef->setPublic(false); if (false !== strpos($mappingDriverDef->getClass(), 'yml') || false !== strpos($mappingDriverDef->getClass(), 'xml')) { $mappingDriverDef->setArguments(array(array_flip($driverPaths))); $mappingDriverDef->addMethodCall('setGlobalBasename', array('mapping')); } $container->setDefinition($mappingService, $mappingDriverDef); foreach ($driverPaths as $prefix => $driverPath) { $chainDriverDef->addMethodCall('addDriver', array(new Reference($mappingService), $prefix)); } } $container->setDefinition($this->getObjectManagerElementName($objectManager['name'].'_metadata_driver'), $chainDriverDef); } /** * Assertion if the specified mapping information is valid. * * @param array $mappingConfig * @param string $objectManagerName * * @throws \InvalidArgumentException */ protected function assertValidMappingConfiguration(array $mappingConfig, $objectManagerName) { if (!$mappingConfig['type'] || !$mappingConfig['dir'] || !$mappingConfig['prefix']) { throw new \InvalidArgumentException(sprintf('Mapping definitions for Doctrine manager "%s" require at least the "type", "dir" and "prefix" options.', $objectManagerName)); } if (!is_dir($mappingConfig['dir'])) { throw new \InvalidArgumentException(sprintf('Specified non-existing directory "%s" as Doctrine mapping source.', $mappingConfig['dir'])); } if (!in_array($mappingConfig['type'], array('xml', 'yml', 'annotation', 'php', 'staticphp'))) { throw new \InvalidArgumentException(sprintf('Can only configure "xml", "yml", "annotation", "php" or '. '"staticphp" through the DoctrineBundle. Use your own bundle to configure other metadata drivers. '. 'You can register them by adding a new driver to the '. '"%s" service definition.', $this->getObjectManagerElementName($objectManagerName.'.metadata_driver') )); } } /** * Detects what metadata driver to use for the supplied directory. * * @param string $dir A directory path * @param ContainerBuilder $container A ContainerBuilder instance * * @return string|null A metadata driver short name, if one can be detected */ protected function detectMetadataDriver($dir, ContainerBuilder $container) { // add the closest existing directory as a resource $configPath = $this->getMappingResourceConfigDirectory(); $resource = $dir.'/'.$configPath; while (!is_dir($resource)) { $resource = dirname($resource); } $container->addResource(new FileResource($resource)); $extension = $this->getMappingResourceExtension(); if (($files = glob($dir.'/'.$configPath.'/*.'.$extension.'.xml')) && count($files)) { return 'xml'; } elseif (($files = glob($dir.'/'.$configPath.'/*.'.$extension.'.yml')) && count($files)) { return 'yml'; } elseif (($files = glob($dir.'/'.$configPath.'/*.'.$extension.'.php')) && count($files)) { return 'php'; } // add the directory itself as a resource $container->addResource(new FileResource($dir)); if (is_dir($dir.'/'.$this->getMappingObjectDefaultName())) { return 'annotation'; } return null; } /** * Loads a configured object manager metadata, query or result cache driver. * * @param array $objectManager A configured object manager. * @param ContainerBuilder $container A ContainerBuilder instance. * @param string $cacheName * * @throws \InvalidArgumentException In case of unknown driver type. */ protected function loadObjectManagerCacheDriver(array $objectManager, ContainerBuilder $container, $cacheName) { $cacheDriver = $objectManager[$cacheName.'_driver']; $cacheDriverService = $this->getObjectManagerElementName($objectManager['name'].'_'.$cacheName); switch ($cacheDriver['type']) { case 'service': $container->setAlias($cacheDriverService, new Alias($cacheDriver['id'], false)); return; case 'memcache': $memcacheClass = !empty($cacheDriver['class']) ? $cacheDriver['class'] : '%'.$this->getObjectManagerElementName('cache.memcache.class').'%'; $memcacheInstanceClass = !empty($cacheDriver['instance_class']) ? $cacheDriver['instance_class'] : '%'.$this->getObjectManagerElementName('cache.memcache_instance.class').'%'; $memcacheHost = !empty($cacheDriver['host']) ? $cacheDriver['host'] : '%'.$this->getObjectManagerElementName('cache.memcache_host').'%'; $memcachePort = !empty($cacheDriver['port']) || (isset($cacheDriver['port']) && $cacheDriver['port'] === 0) ? $cacheDriver['port'] : '%'.$this->getObjectManagerElementName('cache.memcache_port').'%'; $cacheDef = new Definition($memcacheClass); $memcacheInstance = new Definition($memcacheInstanceClass); $memcacheInstance->addMethodCall('connect', array( $memcacheHost, $memcachePort )); $container->setDefinition($this->getObjectManagerElementName(sprintf('%s_memcache_instance', $objectManager['name'])), $memcacheInstance); $cacheDef->addMethodCall('setMemcache', array(new Reference($this->getObjectManagerElementName(sprintf('%s_memcache_instance', $objectManager['name']))))); break; case 'memcached': $memcachedClass = !empty($cacheDriver['class']) ? $cacheDriver['class'] : '%'.$this->getObjectManagerElementName('cache.memcached.class').'%'; $memcachedInstanceClass = !empty($cacheDriver['instance_class']) ? $cacheDriver['instance_class'] : '%'.$this->getObjectManagerElementName('cache.memcached_instance.class').'%'; $memcachedHost = !empty($cacheDriver['host']) ? $cacheDriver['host'] : '%'.$this->getObjectManagerElementName('cache.memcached_host').'%'; $memcachedPort = !empty($cacheDriver['port']) ? $cacheDriver['port'] : '%'.$this->getObjectManagerElementName('cache.memcached_port').'%'; $cacheDef = new Definition($memcachedClass); $memcachedInstance = new Definition($memcachedInstanceClass); $memcachedInstance->addMethodCall('addServer', array( $memcachedHost, $memcachedPort )); $container->setDefinition($this->getObjectManagerElementName(sprintf('%s_memcached_instance', $objectManager['name'])), $memcachedInstance); $cacheDef->addMethodCall('setMemcached', array(new Reference($this->getObjectManagerElementName(sprintf('%s_memcached_instance', $objectManager['name']))))); break; case 'redis': $redisClass = !empty($cacheDriver['class']) ? $cacheDriver['class'] : '%'.$this->getObjectManagerElementName('cache.redis.class').'%'; $redisInstanceClass = !empty($cacheDriver['instance_class']) ? $cacheDriver['instance_class'] : '%'.$this->getObjectManagerElementName('cache.redis_instance.class').'%'; $redisHost = !empty($cacheDriver['host']) ? $cacheDriver['host'] : '%'.$this->getObjectManagerElementName('cache.redis_host').'%'; $redisPort = !empty($cacheDriver['port']) ? $cacheDriver['port'] : '%'.$this->getObjectManagerElementName('cache.redis_port').'%'; $cacheDef = new Definition($redisClass); $redisInstance = new Definition($redisInstanceClass); $redisInstance->addMethodCall('connect', array( $redisHost, $redisPort )); $container->setDefinition($this->getObjectManagerElementName(sprintf('%s_redis_instance', $objectManager['name'])), $redisInstance); $cacheDef->addMethodCall('setRedis', array(new Reference($this->getObjectManagerElementName(sprintf('%s_redis_instance', $objectManager['name']))))); break; case 'apc': case 'array': case 'xcache': case 'wincache': case 'zenddata': $cacheDef = new Definition('%'.$this->getObjectManagerElementName(sprintf('cache.%s.class', $cacheDriver['type'])).'%'); break; default: throw new \InvalidArgumentException(sprintf('"%s" is an unrecognized Doctrine cache driver.', $cacheDriver['type'])); } $cacheDef->setPublic(false); if (!isset($cacheDriver['namespace'])) { // generate a unique namespace for the given application $cacheDriver['namespace'] = 'sf2'.$this->getMappingResourceExtension().'_'.$objectManager['name'].'_'.hash('sha256',($container->getParameter('kernel.root_dir').$container->getParameter('kernel.environment'))); } $cacheDef->addMethodCall('setNamespace', array($cacheDriver['namespace'])); $container->setDefinition($cacheDriverService, $cacheDef); } /** * Prefixes the relative dependency injection container path with the object manager prefix. * * @example $name is 'entity_manager' then the result would be 'doctrine.orm.entity_manager' * * @param string $name * * @return string */ abstract protected function getObjectManagerElementName($name); /** * Noun that describes the mapped objects such as Entity or Document. * * Will be used for autodetection of persistent objects directory. * * @return string */ abstract protected function getMappingObjectDefaultName(); /** * Relative path from the bundle root to the directory where mapping files reside. * * @return string */ abstract protected function getMappingResourceConfigDirectory(); /** * Extension used by the mapping files. * * @return string */ abstract protected function getMappingResourceExtension(); } PKi],DDoctrine/DependencyInjection/CompilerPass/DoctrineValidationPass.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\Config\Resource\FileResource; /** * Registers additional validators * * @author Benjamin Eberlei */ class DoctrineValidationPass implements CompilerPassInterface { /** * @var string */ private $managerType; public function __construct($managerType) { $this->managerType = $managerType; } /** * {@inheritDoc} */ public function process(ContainerBuilder $container) { $this->updateValidatorMappingFiles($container, 'xml', 'xml'); $this->updateValidatorMappingFiles($container, 'yaml', 'yml'); } /** * Gets the validation mapping files for the format and extends them with * files matching a doctrine search pattern (Resources/config/validation.orm.xml) * * @param ContainerBuilder $container * @param string $mapping * @param string $extension */ private function updateValidatorMappingFiles(ContainerBuilder $container, $mapping, $extension) { if (!$container->hasParameter('validator.mapping.loader.'.$mapping.'_files_loader.mapping_files')) { return; } $files = $container->getParameter('validator.mapping.loader.'.$mapping.'_files_loader.mapping_files'); $validationPath = 'Resources/config/validation.'.$this->managerType.'.'.$extension; foreach ($container->getParameter('kernel.bundles') as $bundle) { $reflection = new \ReflectionClass($bundle); if (is_file($file = dirname($reflection->getFilename()).'/'.$validationPath)) { $files[] = realpath($file); $container->addResource(new FileResource($file)); } } $container->setParameter('validator.mapping.loader.'.$mapping.'_files_loader.mapping_files', $files); } } PKi]~YAAVDoctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; /** * Registers event listeners and subscribers to the available doctrine connections. * * @author Jeremy Mikola * @author Alexander */ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface { private $connections; private $container; private $eventManagers; private $managerTemplate; private $tagPrefix; /** * Constructor. * * @param string $connections Parameter ID for connections * @param string $managerTemplate sprintf() template for generating the event * manager's service ID for a connection name * @param string $tagPrefix Tag prefix for listeners and subscribers */ public function __construct($connections, $managerTemplate, $tagPrefix) { $this->connections = $connections; $this->managerTemplate = $managerTemplate; $this->tagPrefix = $tagPrefix; } /** * {@inheritDoc} */ public function process(ContainerBuilder $container) { if (!$container->hasParameter($this->connections)) { return; } $taggedSubscribers = $container->findTaggedServiceIds($this->tagPrefix.'.event_subscriber'); $taggedListeners = $container->findTaggedServiceIds($this->tagPrefix.'.event_listener'); if (empty($taggedSubscribers) && empty($taggedListeners)) { return; } $this->container = $container; $this->connections = $container->getParameter($this->connections); $sortFunc = function ($a, $b) { $a = isset($a['priority']) ? $a['priority'] : 0; $b = isset($b['priority']) ? $b['priority'] : 0; return $a > $b ? -1 : 1; }; if (!empty($taggedSubscribers)) { $subscribersPerCon = $this->groupByConnection($taggedSubscribers); foreach ($subscribersPerCon as $con => $subscribers) { $em = $this->getEventManager($con); uasort($subscribers, $sortFunc); foreach ($subscribers as $id => $instance) { $em->addMethodCall('addEventSubscriber', array(new Reference($id))); } } } if (!empty($taggedListeners)) { $listenersPerCon = $this->groupByConnection($taggedListeners, true); foreach ($listenersPerCon as $con => $listeners) { $em = $this->getEventManager($con); uasort($listeners, $sortFunc); foreach ($listeners as $id => $instance) { $em->addMethodCall('addEventListener', array( array_unique($instance['event']), isset($instance['lazy']) && $instance['lazy'] ? $id : new Reference($id), )); } } } } private function groupByConnection(array $services, $isListener = false) { $grouped = array(); foreach ($allCons = array_keys($this->connections) as $con) { $grouped[$con] = array(); } foreach ($services as $id => $instances) { foreach ($instances as $instance) { if ($isListener) { if (!isset($instance['event'])) { throw new \InvalidArgumentException(sprintf('Doctrine event listener "%s" must specify the "event" attribute.', $id)); } $instance['event'] = array($instance['event']); if (isset($instance['lazy']) && $instance['lazy']) { $this->container->getDefinition($id)->setPublic(true); } } $cons = isset($instance['connection']) ? array($instance['connection']) : $allCons; foreach ($cons as $con) { if (!isset($grouped[$con])) { throw new \RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: %s', $con, $id, implode(', ', array_keys($this->connections)))); } if ($isListener && isset($grouped[$con][$id])) { $grouped[$con][$id]['event'] = array_merge($grouped[$con][$id]['event'], $instance['event']); } else { $grouped[$con][$id] = $instance; } } } } return $grouped; } private function getEventManager($name) { if (null === $this->eventManagers) { $this->eventManagers = array(); foreach ($this->connections as $n => $id) { $this->eventManagers[$n] = $this->container->getDefinition(sprintf($this->managerTemplate, $n)); } } return $this->eventManagers[$name]; } } PKi]㛕BDoctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass; use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; /** * Base class for the doctrine bundles to provide a compiler pass class that * helps to register doctrine mappings. * * The compiler pass is meant to register the mappings with the metadata * chain driver corresponding to one of the object managers. * * For concrete implementations that are easy to use, see the * RegisterXyMappingsPass classes in the DoctrineBundle resp. * DoctrineMongodbBundle, DoctrineCouchdbBundle and DoctrinePhpcrBundle. * * @author David Buchmann */ abstract class RegisterMappingsPass implements CompilerPassInterface { /** * DI object for the driver to use, either a service definition for a * private service or a reference for a public service. * @var Definition|Reference */ protected $driver; /** * List of namespaces handled by the driver * @var string[] */ protected $namespaces; /** * List of potential container parameters that hold the object manager name * to register the mappings with the correct metadata driver, for example * array('acme.manager', 'doctrine.default_entity_manager') * @var string[] */ protected $managerParameters; /** * Naming pattern of the metadata chain driver service ids, for example * 'doctrine.orm.%s_metadata_driver' * @var string */ protected $driverPattern; /** * A name for a parameter in the container. If set, this compiler pass will * only do anything if the parameter is present. (But regardless of the * value of that parameter. * @var string */ protected $enabledParameter; /** * @param Definition|Reference $driver driver DI definition or reference * @param string[] $namespaces list of namespaces handled by $driver * @param string[] $managerParameters list of container parameters * that could hold the manager name * @param string $driverPattern pattern to get the metadata driver service names * @param string $enabledParameter service container parameter that must be * present to enable the mapping. Set to false * to not do any check, optional. */ public function __construct($driver, array $namespaces, array $managerParameters, $driverPattern, $enabledParameter = false) { $this->driver = $driver; $this->namespaces = $namespaces; $this->managerParameters = $managerParameters; $this->driverPattern = $driverPattern; $this->enabledParameter = $enabledParameter; } /** * Register mappings with the metadata drivers. * * @param ContainerBuilder $container */ public function process(ContainerBuilder $container) { if (!$this->enabled($container)) { return; } $mappingDriverDef = $this->getDriver($container); $chainDriverDefService = $this->getChainDriverServiceName($container); $chainDriverDef = $container->getDefinition($chainDriverDefService); foreach ($this->namespaces as $namespace) { $chainDriverDef->addMethodCall('addDriver', array($mappingDriverDef, $namespace)); } } /** * Get the service name of the metadata chain driver that the mappings * should be registered with. The default implementation loops over the * managerParameters and applies the first non-empty parameter it finds to * the driverPattern. * * @param ContainerBuilder $container * * @return string a service definition name * * @throws ParameterNotFoundException if non of the managerParameters has a * non-empty value. */ protected function getChainDriverServiceName(ContainerBuilder $container) { foreach ($this->managerParameters as $param) { if ($container->hasParameter($param)) { $name = $container->getParameter($param); if ($name) { return sprintf($this->driverPattern, $name); } } } throw new ParameterNotFoundException('None of the managerParameters resulted in a valid name'); } /** * Create the service definition for the metadata driver. * * @param ContainerBuilder $container passed on in case an extending class * needs access to the container. * * @return Definition|Reference the metadata driver to add to all chain drivers */ protected function getDriver(ContainerBuilder $container) { return $this->driver; } /** * Determine whether this mapping should be activated or not. This allows * to take this decision with the container builder available. * * This default implementation checks if the class has the enabledParameter * configured and if so if that parameter is present in the container. * * @param ContainerBuilder $container * * @return boolean whether this compiler pass really should register the mappings */ protected function enabled(ContainerBuilder $container) { return !$this->enabledParameter || $container->hasParameter($this->enabledParameter); } } PKi]*DDoctrine/DependencyInjection/Security/UserProvider/EntityFactory.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\DependencyInjection\Security\UserProvider; use Symfony\Component\Config\Definition\Builder\NodeDefinition; use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\UserProvider\UserProviderFactoryInterface; use Symfony\Component\DependencyInjection\DefinitionDecorator; use Symfony\Component\DependencyInjection\ContainerBuilder; /** * EntityFactory creates services for Doctrine user provider. * * @author Fabien Potencier * @author Christophe Coevoet */ class EntityFactory implements UserProviderFactoryInterface { private $key; private $providerId; public function __construct($key, $providerId) { $this->key = $key; $this->providerId = $providerId; } public function create(ContainerBuilder $container, $id, $config) { $container ->setDefinition($id, new DefinitionDecorator($this->providerId)) ->addArgument($config['class']) ->addArgument($config['property']) ->addArgument($config['manager_name']) ; } public function getKey() { return $this->key; } public function addConfiguration(NodeDefinition $node) { $node ->children() ->scalarNode('class')->isRequired()->cannotBeEmpty()->end() ->scalarNode('property')->defaultNull()->end() ->scalarNode('manager_name')->defaultNull()->end() ->end() ; } } PKi]+çxAA0Doctrine/DataCollector/DoctrineDataCollector.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\DataCollector; use Doctrine\Common\Persistence\ManagerRegistry; use Doctrine\DBAL\Logging\DebugStack; use Doctrine\DBAL\Types\Type; use Symfony\Component\HttpKernel\DataCollector\DataCollector; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; /** * DoctrineDataCollector. * * @author Fabien Potencier */ class DoctrineDataCollector extends DataCollector { private $registry; private $connections; private $managers; private $loggers = array(); public function __construct(ManagerRegistry $registry) { $this->registry = $registry; $this->connections = $registry->getConnectionNames(); $this->managers = $registry->getManagerNames(); } /** * Adds the stack logger for a connection. * * @param string $name * @param DebugStack $logger */ public function addLogger($name, DebugStack $logger) { $this->loggers[$name] = $logger; } /** * {@inheritdoc} */ public function collect(Request $request, Response $response, \Exception $exception = null) { $queries = array(); foreach ($this->loggers as $name => $logger) { $queries[$name] = $this->sanitizeQueries($name, $logger->queries); } $this->data = array( 'queries' => $queries, 'connections' => $this->connections, 'managers' => $this->managers, ); } public function getManagers() { return $this->data['managers']; } public function getConnections() { return $this->data['connections']; } public function getQueryCount() { return array_sum(array_map('count', $this->data['queries'])); } public function getQueries() { return $this->data['queries']; } public function getTime() { $time = 0; foreach ($this->data['queries'] as $queries) { foreach ($queries as $query) { $time += $query['executionMS']; } } return $time; } /** * {@inheritdoc} */ public function getName() { return 'db'; } private function sanitizeQueries($connectionName, $queries) { foreach ($queries as $i => $query) { $queries[$i] = $this->sanitizeQuery($connectionName, $query); } return $queries; } private function sanitizeQuery($connectionName, $query) { $query['explainable'] = true; $query['params'] = (array) $query['params']; foreach ($query['params'] as $j => &$param) { if (isset($query['types'][$j])) { // Transform the param according to the type $type = $query['types'][$j]; if (is_string($type)) { $type = Type::getType($type); } if ($type instanceof Type) { $query['types'][$j] = $type->getBindingType(); $param = $type->convertToDatabaseValue($param, $this->registry->getConnection($connectionName)->getDatabasePlatform()); } } list($param, $explainable) = $this->sanitizeParam($param); if (!$explainable) { $query['explainable'] = false; } } return $query; } /** * Sanitizes a param. * * The return value is an array with the sanitized value and a boolean * indicating if the original value was kept (allowing to use the sanitized * value to explain the query). * * @param mixed $var * * @return array */ private function sanitizeParam($var) { if (is_object($var)) { return array(sprintf('Object(%s)', get_class($var)), false); } if (is_array($var)) { $a = array(); $original = true; foreach ($var as $k => $v) { list($value, $orig) = $this->sanitizeParam($v); $original = $original && $orig; $a[$k] = $value; } return array($a, $original); } if (is_resource($var)) { return array(sprintf('Resource(%s)', get_resource_type($var)), false); } return array($var, true); } } PKi]X+)Doctrine/CacheWarmer/ProxyCacheWarmer.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\CacheWarmer; use Doctrine\Common\Persistence\ManagerRegistry; use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; /** * The proxy generator cache warmer generates all entity proxies. * * In the process of generating proxies the cache for all the metadata is primed also, * since this information is necessary to build the proxies in the first place. * * @author Benjamin Eberlei */ class ProxyCacheWarmer implements CacheWarmerInterface { private $registry; /** * Constructor. * * @param ManagerRegistry $registry A ManagerRegistry instance */ public function __construct(ManagerRegistry $registry) { $this->registry = $registry; } /** * This cache warmer is not optional, without proxies fatal error occurs! * * @return false */ public function isOptional() { return false; } /** * {@inheritdoc} */ public function warmUp($cacheDir) { foreach ($this->registry->getManagers() as $em) { // we need the directory no matter the proxy cache generation strategy if (!is_dir($proxyCacheDir = $em->getConfiguration()->getProxyDir())) { if (false === @mkdir($proxyCacheDir, 0777, true)) { throw new \RuntimeException(sprintf('Unable to create the Doctrine Proxy directory "%s".', $proxyCacheDir)); } } elseif (!is_writable($proxyCacheDir)) { throw new \RuntimeException(sprintf('The Doctrine Proxy directory "%s" is not writeable for the current system user.', $proxyCacheDir)); } // if proxies are autogenerated we don't need to generate them in the cache warmer if ($em->getConfiguration()->getAutoGenerateProxyClasses()) { continue; } $classes = $em->getMetadataFactory()->getAllMetadata(); $em->getProxyFactory()->generateProxyClasses($classes); } } } PKi]Ta==3Doctrine/ExpressionLanguage/DoctrineParserCache.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\ExpressionLanguage; use Doctrine\Common\Cache\Cache; use Symfony\Component\ExpressionLanguage\ParsedExpression; use Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface; /** * @author Adrien Brault */ class DoctrineParserCache implements ParserCacheInterface { /** * @var Cache */ private $cache; public function __construct(Cache $cache) { $this->cache = $cache; } /** * {@inheritdoc} */ public function fetch($key) { if (false === $value = $this->cache->fetch($key)) { return null; } return $value; } /** * {@inheritdoc} */ public function save($key, ParsedExpression $expression) { $this->cache->save($key, $expression); } } PKi]S;,:#Doctrine/Form/Type/DoctrineType.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\Form\Type; use Doctrine\Common\Persistence\ManagerRegistry; use Symfony\Component\Form\Exception\RuntimeException; use Doctrine\Common\Persistence\ObjectManager; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList; use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface; use Symfony\Bridge\Doctrine\Form\EventListener\MergeDoctrineCollectionListener; use Symfony\Bridge\Doctrine\Form\DataTransformer\CollectionToArrayTransformer; use Symfony\Component\Form\AbstractType; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolverInterface; use Symfony\Component\PropertyAccess\PropertyAccess; use Symfony\Component\PropertyAccess\PropertyAccessorInterface; abstract class DoctrineType extends AbstractType { /** * @var ManagerRegistry */ protected $registry; /** * @var array */ private $choiceListCache = array(); /** * @var PropertyAccessorInterface */ private $propertyAccessor; public function __construct(ManagerRegistry $registry, PropertyAccessorInterface $propertyAccessor = null) { $this->registry = $registry; $this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor(); } public function buildForm(FormBuilderInterface $builder, array $options) { if ($options['multiple']) { $builder ->addEventSubscriber(new MergeDoctrineCollectionListener()) ->addViewTransformer(new CollectionToArrayTransformer(), true) ; } } public function setDefaultOptions(OptionsResolverInterface $resolver) { $choiceListCache =& $this->choiceListCache; $registry = $this->registry; $propertyAccessor = $this->propertyAccessor; $type = $this; $loader = function (Options $options) use ($type) { if (null !== $options['query_builder']) { return $type->getLoader($options['em'], $options['query_builder'], $options['class']); } return null; }; $choiceList = function (Options $options) use (&$choiceListCache, $propertyAccessor) { // Support for closures $propertyHash = is_object($options['property']) ? spl_object_hash($options['property']) : $options['property']; $choiceHashes = $options['choices']; // Support for recursive arrays if (is_array($choiceHashes)) { // A second parameter ($key) is passed, so we cannot use // spl_object_hash() directly (which strictly requires // one parameter) array_walk_recursive($choiceHashes, function (&$value) { $value = spl_object_hash($value); }); } elseif ($choiceHashes instanceof \Traversable) { $hashes = array(); foreach ($choiceHashes as $value) { $hashes[] = spl_object_hash($value); } $choiceHashes = $hashes; } $preferredChoiceHashes = $options['preferred_choices']; if (is_array($preferredChoiceHashes)) { array_walk_recursive($preferredChoiceHashes, function (&$value) { $value = spl_object_hash($value); }); } // Support for custom loaders (with query builders) $loaderHash = is_object($options['loader']) ? spl_object_hash($options['loader']) : $options['loader']; // Support for closures $groupByHash = is_object($options['group_by']) ? spl_object_hash($options['group_by']) : $options['group_by']; $hash = hash('sha256', json_encode(array( spl_object_hash($options['em']), $options['class'], $propertyHash, $loaderHash, $choiceHashes, $preferredChoiceHashes, $groupByHash ))); if (!isset($choiceListCache[$hash])) { $choiceListCache[$hash] = new EntityChoiceList( $options['em'], $options['class'], $options['property'], $options['loader'], $options['choices'], $options['preferred_choices'], $options['group_by'], $propertyAccessor ); } return $choiceListCache[$hash]; }; $emNormalizer = function (Options $options, $em) use ($registry) { /* @var ManagerRegistry $registry */ if (null !== $em) { return $registry->getManager($em); } $em = $registry->getManagerForClass($options['class']); if (null === $em) { throw new RuntimeException(sprintf( 'Class "%s" seems not to be a managed Doctrine entity. ' . 'Did you forget to map it?', $options['class'] )); } return $em; }; $resolver->setDefaults(array( 'em' => null, 'property' => null, 'query_builder' => null, 'loader' => $loader, 'choices' => null, 'choice_list' => $choiceList, 'group_by' => null, )); $resolver->setRequired(array('class')); $resolver->setNormalizers(array( 'em' => $emNormalizer, )); $resolver->setAllowedTypes(array( 'loader' => array('null', 'Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface'), )); } /** * Return the default loader object. * * @param ObjectManager $manager * @param mixed $queryBuilder * @param string $class * * @return EntityLoaderInterface */ abstract public function getLoader(ObjectManager $manager, $queryBuilder, $class); public function getParent() { return 'choice'; } } PKi]憝!Doctrine/Form/Type/EntityType.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\Form\Type; use Doctrine\Common\Persistence\ObjectManager; use Symfony\Bridge\Doctrine\Form\ChoiceList\ORMQueryBuilderLoader; class EntityType extends DoctrineType { /** * Return the default loader object. * * @param ObjectManager $manager * @param mixed $queryBuilder * @param string $class * @return ORMQueryBuilderLoader */ public function getLoader(ObjectManager $manager, $queryBuilder, $class) { return new ORMQueryBuilderLoader( $queryBuilder, $manager, $class ); } public function getName() { return 'entity'; } } PKi]CiPP>Doctrine/Form/DataTransformer/CollectionToArrayTransformer.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\Form\DataTransformer; use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Form\DataTransformerInterface; use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\ArrayCollection; /** * @author Bernhard Schussek */ class CollectionToArrayTransformer implements DataTransformerInterface { /** * Transforms a collection into an array. * * @param Collection $collection A collection of entities * * @return mixed An array of entities * * @throws TransformationFailedException */ public function transform($collection) { if (null === $collection) { return array(); } // For cases when the collection getter returns $collection->toArray() // in order to prevent modifications of the returned collection if (is_array($collection)) { return $collection; } if (!$collection instanceof Collection) { throw new TransformationFailedException('Expected a Doctrine\Common\Collections\Collection object.'); } return $collection->toArray(); } /** * Transforms choice keys into entities. * * @param mixed $array An array of entities * * @return Collection A collection of entities */ public function reverseTransform($array) { if ('' === $array || null === $array) { $array = array(); } else { $array = (array) $array; } return new ArrayCollection($array); } } PKi]`. qpp(Doctrine/Form/DoctrineOrmTypeGuesser.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\Form; use Doctrine\Common\Persistence\ManagerRegistry; use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\ORM\Mapping\MappingException as LegacyMappingException; use Symfony\Component\Form\FormTypeGuesserInterface; use Symfony\Component\Form\Guess\Guess; use Symfony\Component\Form\Guess\TypeGuess; use Symfony\Component\Form\Guess\ValueGuess; use Doctrine\Common\Util\ClassUtils; class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface { protected $registry; private $cache = array(); public function __construct(ManagerRegistry $registry) { $this->registry = $registry; } /** * {@inheritDoc} */ public function guessType($class, $property) { if (!$ret = $this->getMetadata($class)) { return new TypeGuess('text', array(), Guess::LOW_CONFIDENCE); } list($metadata, $name) = $ret; if ($metadata->hasAssociation($property)) { $multiple = $metadata->isCollectionValuedAssociation($property); $mapping = $metadata->getAssociationMapping($property); return new TypeGuess('entity', array('em' => $name, 'class' => $mapping['targetEntity'], 'multiple' => $multiple), Guess::HIGH_CONFIDENCE); } switch ($metadata->getTypeOfField($property)) { case 'array': return new TypeGuess('collection', array(), Guess::MEDIUM_CONFIDENCE); case 'boolean': return new TypeGuess('checkbox', array(), Guess::HIGH_CONFIDENCE); case 'datetime': case 'vardatetime': case 'datetimetz': return new TypeGuess('datetime', array(), Guess::HIGH_CONFIDENCE); case 'date': return new TypeGuess('date', array(), Guess::HIGH_CONFIDENCE); case 'time': return new TypeGuess('time', array(), Guess::HIGH_CONFIDENCE); case 'decimal': case 'float': return new TypeGuess('number', array(), Guess::MEDIUM_CONFIDENCE); case 'integer': case 'bigint': case 'smallint': return new TypeGuess('integer', array(), Guess::MEDIUM_CONFIDENCE); case 'string': return new TypeGuess('text', array(), Guess::MEDIUM_CONFIDENCE); case 'text': return new TypeGuess('textarea', array(), Guess::MEDIUM_CONFIDENCE); default: return new TypeGuess('text', array(), Guess::LOW_CONFIDENCE); } } /** * {@inheritDoc} */ public function guessRequired($class, $property) { $classMetadatas = $this->getMetadata($class); if (!$classMetadatas) { return null; } /** @var ClassMetadataInfo $classMetadata */ $classMetadata = $classMetadatas[0]; // Check whether the field exists and is nullable or not if ($classMetadata->hasField($property)) { if (!$classMetadata->isNullable($property)) { return new ValueGuess(true, Guess::HIGH_CONFIDENCE); } return new ValueGuess(false, Guess::MEDIUM_CONFIDENCE); } // Check whether the association exists, is a to-one association and its // join column is nullable or not if ($classMetadata->isAssociationWithSingleJoinColumn($property)) { $mapping = $classMetadata->getAssociationMapping($property); if (!isset($mapping['joinColumns'][0]['nullable'])) { // The "nullable" option defaults to true, in that case the // field should not be required. return new ValueGuess(false, Guess::HIGH_CONFIDENCE); } return new ValueGuess(!$mapping['joinColumns'][0]['nullable'], Guess::HIGH_CONFIDENCE); } return null; } /** * {@inheritDoc} */ public function guessMaxLength($class, $property) { $ret = $this->getMetadata($class); if ($ret && $ret[0]->hasField($property) && !$ret[0]->hasAssociation($property)) { $mapping = $ret[0]->getFieldMapping($property); if (isset($mapping['length'])) { return new ValueGuess($mapping['length'], Guess::HIGH_CONFIDENCE); } if (in_array($ret[0]->getTypeOfField($property), array('decimal', 'float'))) { return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE); } } } /** * {@inheritDoc} */ public function guessPattern($class, $property) { $ret = $this->getMetadata($class); if ($ret && $ret[0]->hasField($property) && !$ret[0]->hasAssociation($property)) { if (in_array($ret[0]->getTypeOfField($property), array('decimal', 'float'))) { return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE); } } } protected function getMetadata($class) { // normalize class name $class = ClassUtils::getRealClass(ltrim($class, '\\')); if (array_key_exists($class, $this->cache)) { return $this->cache[$class]; } $this->cache[$class] = null; foreach ($this->registry->getManagers() as $name => $em) { try { return $this->cache[$class] = array($em->getClassMetadata($class), $name); } catch (MappingException $e) { // not an entity or mapped super class } catch (LegacyMappingException $e) { // not an entity or mapped super class, using Doctrine ORM 2.2 } } } } PKi] ?x77-Doctrine/Form/ChoiceList/EntityChoiceList.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\Form\ChoiceList; use Symfony\Component\Form\Exception\RuntimeException; use Symfony\Component\Form\Exception\StringCastException; use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList; use Doctrine\Common\Persistence\ObjectManager; use Symfony\Component\PropertyAccess\PropertyAccessorInterface; /** * A choice list presenting a list of Doctrine entities as choices * * @author Bernhard Schussek */ class EntityChoiceList extends ObjectChoiceList { /** * @var ObjectManager */ private $em; /** * @var string */ private $class; /** * @var \Doctrine\Common\Persistence\Mapping\ClassMetadata */ private $classMetadata; /** * Contains the query builder that builds the query for fetching the * entities * * This property should only be accessed through queryBuilder. * * @var EntityLoaderInterface */ private $entityLoader; /** * The identifier field, if the identifier is not composite * * @var array */ private $idField = null; /** * Whether to use the identifier for index generation * * @var Boolean */ private $idAsIndex = false; /** * Whether to use the identifier for value generation * * @var Boolean */ private $idAsValue = false; /** * Whether the entities have already been loaded. * * @var Boolean */ private $loaded = false; /** * The preferred entities. * * @var array */ private $preferredEntities = array(); /** * Creates a new entity choice list. * * @param ObjectManager $manager An EntityManager instance * @param string $class The class name * @param string $labelPath The property path used for the label * @param EntityLoaderInterface $entityLoader An optional query builder * @param array $entities An array of choices * @param array $preferredEntities An array of preferred choices * @param string $groupPath A property path pointing to the property used * to group the choices. Only allowed if * the choices are given as flat array. * @param PropertyAccessorInterface $propertyAccessor The reflection graph for reading property paths. */ public function __construct(ObjectManager $manager, $class, $labelPath = null, EntityLoaderInterface $entityLoader = null, $entities = null, array $preferredEntities = array(), $groupPath = null, PropertyAccessorInterface $propertyAccessor = null) { $this->em = $manager; $this->entityLoader = $entityLoader; $this->classMetadata = $manager->getClassMetadata($class); $this->class = $this->classMetadata->getName(); $this->loaded = is_array($entities) || $entities instanceof \Traversable; $this->preferredEntities = $preferredEntities; $identifier = $this->classMetadata->getIdentifierFieldNames(); if (1 === count($identifier)) { $this->idField = $identifier[0]; $this->idAsValue = true; if (in_array($this->classMetadata->getTypeOfField($this->idField), array('integer', 'smallint', 'bigint'))) { $this->idAsIndex = true; } } if (!$this->loaded) { // Make sure the constraints of the parent constructor are // fulfilled $entities = array(); } parent::__construct($entities, $labelPath, $preferredEntities, $groupPath, null, $propertyAccessor); } /** * Returns the list of entities * * @return array * * @see Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface */ public function getChoices() { if (!$this->loaded) { $this->load(); } return parent::getChoices(); } /** * Returns the values for the entities * * @return array * * @see Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface */ public function getValues() { if (!$this->loaded) { $this->load(); } return parent::getValues(); } /** * Returns the choice views of the preferred choices as nested array with * the choice groups as top-level keys. * * @return array * * @see Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface */ public function getPreferredViews() { if (!$this->loaded) { $this->load(); } return parent::getPreferredViews(); } /** * Returns the choice views of the choices that are not preferred as nested * array with the choice groups as top-level keys. * * @return array * * @see Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface */ public function getRemainingViews() { if (!$this->loaded) { $this->load(); } return parent::getRemainingViews(); } /** * Returns the entities corresponding to the given values. * * @param array $values * * @return array * * @see Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface */ public function getChoicesForValues(array $values) { // Performance optimization // Also prevents the generation of "WHERE id IN ()" queries through the // entity loader. At least with MySQL and on the development machine // this was tested on, no exception was thrown for such invalid // statements, consequently no test fails when this code is removed. // https://github.com/symfony/symfony/pull/8981#issuecomment-24230557 if (empty($values)) { return array(); } if (!$this->loaded) { // Optimize performance in case we have an entity loader and // a single-field identifier if ($this->idAsValue && $this->entityLoader) { $unorderedEntities = $this->entityLoader->getEntitiesByIds($this->idField, $values); $entitiesByValue = array(); $entities = array(); // Maintain order and indices from the given $values // An alternative approach to the following loop is to add the // "INDEX BY" clause to the Doctrine query in the loader, // but I'm not sure whether that's doable in a generic fashion. foreach ($unorderedEntities as $entity) { $value = $this->fixValue(current($this->getIdentifierValues($entity))); $entitiesByValue[$value] = $entity; } foreach ($values as $i => $value) { if (isset($entitiesByValue[$value])) { $entities[$i] = $entitiesByValue[$value]; } } return $entities; } $this->load(); } return parent::getChoicesForValues($values); } /** * Returns the values corresponding to the given entities. * * @param array $entities * * @return array * * @see Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface */ public function getValuesForChoices(array $entities) { // Performance optimization if (empty($entities)) { return array(); } if (!$this->loaded) { // Optimize performance for single-field identifiers. We already // know that the IDs are used as values // Attention: This optimization does not check choices for existence if ($this->idAsValue) { $values = array(); foreach ($entities as $i => $entity) { if ($entity instanceof $this->class) { // Make sure to convert to the right format $values[$i] = $this->fixValue(current($this->getIdentifierValues($entity))); } } return $values; } $this->load(); } return parent::getValuesForChoices($entities); } /** * Returns the indices corresponding to the given entities. * * @param array $entities * * @return array * * @see Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface * * @deprecated Deprecated since version 2.4, to be removed in 3.0. */ public function getIndicesForChoices(array $entities) { // Performance optimization if (empty($entities)) { return array(); } if (!$this->loaded) { // Optimize performance for single-field identifiers. We already // know that the IDs are used as indices // Attention: This optimization does not check choices for existence if ($this->idAsIndex) { $indices = array(); foreach ($entities as $i => $entity) { if ($entity instanceof $this->class) { // Make sure to convert to the right format $indices[$i] = $this->fixIndex(current($this->getIdentifierValues($entity))); } } return $indices; } $this->load(); } return parent::getIndicesForChoices($entities); } /** * Returns the entities corresponding to the given values. * * @param array $values * * @return array * * @see Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface * * @deprecated Deprecated since version 2.4, to be removed in 3.0. */ public function getIndicesForValues(array $values) { // Performance optimization if (empty($values)) { return array(); } if (!$this->loaded) { // Optimize performance for single-field identifiers. // Attention: This optimization does not check values for existence if ($this->idAsIndex && $this->idAsValue) { return $this->fixIndices($values); } $this->load(); } return parent::getIndicesForValues($values); } /** * Creates a new unique index for this entity. * * If the entity has a single-field identifier, this identifier is used. * * Otherwise a new integer is generated. * * @param mixed $entity The choice to create an index for * * @return integer|string A unique index containing only ASCII letters, * digits and underscores. */ protected function createIndex($entity) { if ($this->idAsIndex) { return $this->fixIndex(current($this->getIdentifierValues($entity))); } return parent::createIndex($entity); } /** * Creates a new unique value for this entity. * * If the entity has a single-field identifier, this identifier is used. * * Otherwise a new integer is generated. * * @param mixed $entity The choice to create a value for * * @return integer|string A unique value without character limitations. */ protected function createValue($entity) { if ($this->idAsValue) { return (string) current($this->getIdentifierValues($entity)); } return parent::createValue($entity); } /** * {@inheritdoc} */ protected function fixIndex($index) { $index = parent::fixIndex($index); // If the ID is a single-field integer identifier, it is used as // index. Replace any leading minus by underscore to make it a valid // form name. if ($this->idAsIndex && $index < 0) { $index = strtr($index, '-', '_'); } return $index; } /** * Loads the list with entities. */ private function load() { if ($this->entityLoader) { $entities = $this->entityLoader->getEntities(); } else { $entities = $this->em->getRepository($this->class)->findAll(); } try { // The second parameter $labels is ignored by ObjectChoiceList parent::initialize($entities, array(), $this->preferredEntities); } catch (StringCastException $e) { throw new StringCastException(str_replace('argument $labelPath', 'option "property"', $e->getMessage()), null, $e); } $this->loaded = true; } /** * Returns the values of the identifier fields of an entity. * * Doctrine must know about this entity, that is, the entity must already * be persisted or added to the identity map before. Otherwise an * exception is thrown. * * @param object $entity The entity for which to get the identifier * * @return array The identifier values * * @throws RuntimeException If the entity does not exist in Doctrine's identity map */ private function getIdentifierValues($entity) { if (!$this->em->contains($entity)) { throw new RuntimeException( 'Entities passed to the choice field must be managed. Maybe ' . 'persist them in the entity manager?' ); } $this->em->initializeObject($entity); return $this->classMetadata->getIdentifierValues($entity); } } PKi]GCt 2Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\Form\ChoiceList; use Symfony\Component\Form\Exception\UnexpectedTypeException; use Doctrine\ORM\QueryBuilder; use Doctrine\DBAL\Connection; use Doctrine\ORM\EntityManager; /** * Getting Entities through the ORM QueryBuilder */ class ORMQueryBuilderLoader implements EntityLoaderInterface { /** * Contains the query builder that builds the query for fetching the * entities * * This property should only be accessed through queryBuilder. * * @var QueryBuilder */ private $queryBuilder; /** * Construct an ORM Query Builder Loader * * @param QueryBuilder|\Closure $queryBuilder * @param EntityManager $manager * @param string $class * * @throws UnexpectedTypeException */ public function __construct($queryBuilder, $manager = null, $class = null) { // If a query builder was passed, it must be a closure or QueryBuilder // instance if (!($queryBuilder instanceof QueryBuilder || $queryBuilder instanceof \Closure)) { throw new UnexpectedTypeException($queryBuilder, 'Doctrine\ORM\QueryBuilder or \Closure'); } if ($queryBuilder instanceof \Closure) { if (!$manager instanceof EntityManager) { throw new UnexpectedTypeException($manager, 'Doctrine\ORM\EntityManager'); } $queryBuilder = $queryBuilder($manager->getRepository($class)); if (!$queryBuilder instanceof QueryBuilder) { throw new UnexpectedTypeException($queryBuilder, 'Doctrine\ORM\QueryBuilder'); } } $this->queryBuilder = $queryBuilder; } /** * {@inheritDoc} */ public function getEntities() { return $this->queryBuilder->getQuery()->execute(); } /** * {@inheritDoc} */ public function getEntitiesByIds($identifier, array $values) { $qb = clone ($this->queryBuilder); $alias = current($qb->getRootAliases()); $parameter = 'ORMQueryBuilderLoader_getEntitiesByIds_'.$identifier; $where = $qb->expr()->in($alias.'.'.$identifier, ':'.$parameter); // Guess type $entity = current($qb->getRootEntities()); $metadata = $qb->getEntityManager()->getClassMetadata($entity); if (in_array($metadata->getTypeOfField($identifier), array('integer', 'bigint', 'smallint'))) { $parameterType = Connection::PARAM_INT_ARRAY; } else { $parameterType = Connection::PARAM_STR_ARRAY; } return $qb->andWhere($where) ->getQuery() ->setParameter($parameter, $values, $parameterType) ->getResult(); } } PKi]!%d==2Doctrine/Form/ChoiceList/EntityLoaderInterface.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\Form\ChoiceList; /** * Custom loader for entities in the choice list. * * @author Benjamin Eberlei */ interface EntityLoaderInterface { /** * Returns an array of entities that are valid choices in the corresponding choice list. * * @return array The entities. */ public function getEntities(); /** * Returns an array of entities matching the given identifiers. * * @param string $identifier The identifier field of the object. This method * is not applicable for fields with multiple * identifiers. * @param array $values The values of the identifiers. * * @return array The entities. */ public function getEntitiesByIds($identifier, array $values); } PKi]0?Doctrine/Form/EventListener/MergeDoctrineCollectionListener.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\Form\EventListener; use Doctrine\Common\Collections\Collection; use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * Merge changes from the request to a Doctrine\Common\Collections\Collection instance. * * This works with ORM, MongoDB and CouchDB instances of the collection interface. * * @author Bernhard Schussek * * @see Doctrine\Common\Collections\Collection */ class MergeDoctrineCollectionListener implements EventSubscriberInterface { public static function getSubscribedEvents() { // Higher priority than core MergeCollectionListener so that this one // is called before return array(FormEvents::SUBMIT => array('onBind', 10)); } public function onBind(FormEvent $event) { $collection = $event->getForm()->getData(); $data = $event->getData(); // If all items were removed, call clear which has a higher // performance on persistent collections if ($collection instanceof Collection && count($data) === 0) { $collection->clear(); } } } PKi] 9,&Doctrine/Form/DoctrineOrmExtension.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\Form; use Doctrine\Common\Persistence\ManagerRegistry; use Symfony\Component\Form\AbstractExtension; use Symfony\Component\PropertyAccess\PropertyAccess; class DoctrineOrmExtension extends AbstractExtension { protected $registry; public function __construct(ManagerRegistry $registry) { $this->registry = $registry; } protected function loadTypes() { return array( new Type\EntityType($this->registry, PropertyAccess::createPropertyAccessor()), ); } protected function loadTypeGuesser() { return new DoctrineOrmTypeGuesser($this->registry); } } PKi]lf/qq.Doctrine/DataFixtures/ContainerAwareLoader.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\DataFixtures; use Doctrine\Common\DataFixtures\FixtureInterface; use Doctrine\Common\DataFixtures\Loader; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Doctrine data fixtures loader that injects the service container into * fixture objects that implement ContainerAwareInterface. * * Note: Use of this class requires the Doctrine data fixtures extension, which * is a suggested dependency for Symfony. */ class ContainerAwareLoader extends Loader { /** * @var ContainerInterface */ private $container; /** * Constructor. * * @param ContainerInterface $container A ContainerInterface instance */ public function __construct(ContainerInterface $container) { $this->container = $container; } /** * {@inheritdoc} */ public function addFixture(FixtureInterface $fixture) { if ($fixture instanceof ContainerAwareInterface) { $fixture->setContainer($this->container); } parent::addFixture($fixture); } } PKi].Doctrine/HttpFoundation/DbalSessionHandler.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\HttpFoundation; use Doctrine\DBAL\Platforms\MySqlPlatform; use Doctrine\DBAL\Driver\Connection; /** * DBAL based session storage. * * @author Fabien Potencier * @author Johannes M. Schmitt */ class DbalSessionHandler implements \SessionHandlerInterface { /** * @var Connection */ private $con; /** * @var string */ private $tableName; /** * Constructor. * * @param Connection $con An instance of Connection. * @param string $tableName Table name. */ public function __construct(Connection $con, $tableName = 'sessions') { $this->con = $con; $this->tableName = $tableName; } /** * {@inheritdoc} */ public function open($path = null, $name = null) { return true; } /** * {@inheritdoc} */ public function close() { // do nothing return true; } /** * {@inheritdoc} */ public function destroy($id) { try { $this->con->executeQuery("DELETE FROM {$this->tableName} WHERE sess_id = :id", array( 'id' => $id, )); } catch (\PDOException $e) { throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data: %s', $e->getMessage()), 0, $e); } return true; } /** * {@inheritdoc} */ public function gc($lifetime) { try { $this->con->executeQuery("DELETE FROM {$this->tableName} WHERE sess_time < :time", array( 'time' => time() - $lifetime, )); } catch (\PDOException $e) { throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data: %s', $e->getMessage()), 0, $e); } return true; } /** * {@inheritdoc} */ public function read($id) { try { $data = $this->con->executeQuery("SELECT sess_data FROM {$this->tableName} WHERE sess_id = :id", array( 'id' => $id, ))->fetchColumn(); if (false !== $data) { return base64_decode($data); } // session does not exist, create it $this->createNewSession($id); return ''; } catch (\PDOException $e) { throw new \RuntimeException(sprintf('PDOException was thrown when trying to read the session data: %s', $e->getMessage()), 0, $e); } } /** * {@inheritdoc} */ public function write($id, $data) { $platform = $this->con->getDatabasePlatform(); // this should maybe be abstracted in Doctrine DBAL if ($platform instanceof MySqlPlatform) { $sql = "INSERT INTO {$this->tableName} (sess_id, sess_data, sess_time) VALUES (%1\$s, %2\$s, %3\$d) " ."ON DUPLICATE KEY UPDATE sess_data = VALUES(sess_data), sess_time = CASE WHEN sess_time = %3\$d THEN (VALUES(sess_time) + 1) ELSE VALUES(sess_time) END"; } else { $sql = "UPDATE {$this->tableName} SET sess_data = %2\$s, sess_time = %3\$d WHERE sess_id = %1\$s"; } try { $rowCount = $this->con->exec(sprintf( $sql, $this->con->quote($id), //session data can contain non binary safe characters so we need to encode it $this->con->quote(base64_encode($data)), time() )); if (!$rowCount) { // No session exists in the database to update. This happens when we have called // session_regenerate_id() $this->createNewSession($id, $data); } } catch (\PDOException $e) { throw new \RuntimeException(sprintf('PDOException was thrown when trying to write the session data: %s', $e->getMessage()), 0, $e); } return true; } /** * Creates a new session with the given $id and $data * * @param string $id * @param string $data * * @return Boolean */ private function createNewSession($id, $data = '') { $this->con->exec(sprintf("INSERT INTO {$this->tableName} (sess_id, sess_data, sess_time) VALUES (%s, %s, %d)", $this->con->quote($id), //session data can contain non binary safe characters so we need to encode it $this->con->quote(base64_encode($data)), time() )); return true; } } PKi]4Doctrine/HttpFoundation/DbalSessionHandlerSchema.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\HttpFoundation; use Doctrine\DBAL\Schema\Schema; /** * DBAL Session Storage Schema. * * @author Johannes M. Schmitt */ final class DbalSessionHandlerSchema extends Schema { private $tableName; public function __construct($tableName = 'sessions') { parent::__construct(); $this->tableName = $tableName; $this->addSessionTable(); } public function addToSchema(Schema $schema) { foreach ($this->getTables() as $table) { $schema->_addTable($table); } } private function addSessionTable() { $table = $this->createTable($this->tableName); $table->addColumn('sess_id', 'string'); $table->addColumn('sess_data', 'text')->setNotNull(true); $table->addColumn('sess_time', 'integer')->setNotNull(true)->setUnsigned(true); $table->setPrimaryKey(array('sess_id')); } } PKi]qm m Doctrine/RegistryInterface.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine; use Doctrine\Common\Persistence\ManagerRegistry as ManagerRegistryInterface; use Doctrine\ORM\Configuration; use Doctrine\ORM\EntityManager; /** * References Doctrine connections and entity managers. * * @author Fabien Potencier */ interface RegistryInterface extends ManagerRegistryInterface { /** * Gets the default entity manager name. * * @return string The default entity manager name */ public function getDefaultEntityManagerName(); /** * Gets a named entity manager. * * @param string $name The entity manager name (null for the default one) * * @return EntityManager */ public function getEntityManager($name = null); /** * Gets an array of all registered entity managers * * @return array An array of EntityManager instances */ public function getEntityManagers(); /** * Resets a named entity manager. * * This method is useful when an entity manager has been closed * because of a rollbacked transaction AND when you think that * it makes sense to get a new one to replace the closed one. * * Be warned that you will get a brand new entity manager as * the existing one is not useable anymore. This means that any * other object with a dependency on this entity manager will * hold an obsolete reference. You can inject the registry instead * to avoid this problem. * * @param string $name The entity manager name (null for the default one) * * @return EntityManager */ public function resetEntityManager($name = null); /** * Resolves a registered namespace alias to the full namespace. * * This method looks for the alias in all registered entity managers. * * @param string $alias The alias * * @return string The full namespace * * @see Configuration::getEntityNamespace */ public function getEntityNamespace($alias); /** * Gets all connection names. * * @return array An array of connection names */ public function getEntityManagerNames(); /** * Gets the entity manager associated with a given class. * * @param string $class A Doctrine Entity class name * * @return EntityManager|null */ public function getEntityManagerForClass($class); } PKi]OlQ99'Doctrine/ContainerAwareEventManager.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine; use Doctrine\Common\EventArgs; use Doctrine\Common\EventManager; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Allows lazy loading of listener services. * * @author Johannes M. Schmitt */ class ContainerAwareEventManager extends EventManager { /** * Map of registered listeners. * => * * @var array */ private $listeners = array(); private $initialized = array(); private $container; public function __construct(ContainerInterface $container) { $this->container = $container; } /** * Dispatches an event to all registered listeners. * * @param string $eventName The name of the event to dispatch. The name of the event is * the name of the method that is invoked on listeners. * @param EventArgs $eventArgs The event arguments to pass to the event handlers/listeners. * If not supplied, the single empty EventArgs instance is used. * @return boolean */ public function dispatchEvent($eventName, EventArgs $eventArgs = null) { if (isset($this->listeners[$eventName])) { $eventArgs = $eventArgs === null ? EventArgs::getEmptyInstance() : $eventArgs; $initialized = isset($this->initialized[$eventName]); foreach ($this->listeners[$eventName] as $hash => $listener) { if (!$initialized && is_string($listener)) { $this->listeners[$eventName][$hash] = $listener = $this->container->get($listener); } $listener->$eventName($eventArgs); } $this->initialized[$eventName] = true; } } /** * Gets the listeners of a specific event or all listeners. * * @param string $event The name of the event. * * @return array The event listeners for the specified event, or all event listeners. */ public function getListeners($event = null) { return $event ? $this->listeners[$event] : $this->listeners; } /** * Checks whether an event has any registered listeners. * * @param string $event * * @return boolean TRUE if the specified event has any listeners, FALSE otherwise. */ public function hasListeners($event) { return isset($this->listeners[$event]) && $this->listeners[$event]; } /** * Adds an event listener that listens on the specified events. * * @param string|array $events The event(s) to listen on. * @param object|string $listener The listener object. * * @throws \RuntimeException */ public function addEventListener($events, $listener) { if (is_string($listener)) { if ($this->initialized) { throw new \RuntimeException('Adding lazy-loading listeners after construction is not supported.'); } $hash = '_service_'.$listener; } else { // Picks the hash code related to that listener $hash = spl_object_hash($listener); } foreach ((array) $events as $event) { // Overrides listener if a previous one was associated already // Prevents duplicate listeners on same event (same instance only) $this->listeners[$event][$hash] = $listener; } } /** * Removes an event listener from the specified events. * * @param string|array $events * @param object|string $listener */ public function removeEventListener($events, $listener) { if (is_string($listener)) { $hash = '_service_'.$listener; } else { // Picks the hash code related to that listener $hash = spl_object_hash($listener); } foreach ((array) $events as $event) { // Check if actually have this listener associated if (isset($this->listeners[$event][$hash])) { unset($this->listeners[$event][$hash]); } } } } PKi] Xxo Doctrine/Logger/DbalLogger.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\Logger; use Psr\Log\LoggerInterface; use Symfony\Component\Stopwatch\Stopwatch; use Doctrine\DBAL\Logging\SQLLogger; /** * DbalLogger. * * @author Fabien Potencier */ class DbalLogger implements SQLLogger { const MAX_STRING_LENGTH = 32; const BINARY_DATA_VALUE = '(binary value)'; protected $logger; protected $stopwatch; /** * Constructor. * * @param LoggerInterface $logger A LoggerInterface instance * @param Stopwatch $stopwatch A Stopwatch instance */ public function __construct(LoggerInterface $logger = null, Stopwatch $stopwatch = null) { $this->logger = $logger; $this->stopwatch = $stopwatch; } /** * {@inheritdoc} */ public function startQuery($sql, array $params = null, array $types = null) { if (null !== $this->stopwatch) { $this->stopwatch->start('doctrine', 'doctrine'); } if (is_array($params)) { foreach ($params as $index => $param) { if (!is_string($params[$index])) { continue; } // non utf-8 strings break json encoding if (!preg_match('#[\p{L}\p{N} ]#u', $params[$index])) { $params[$index] = self::BINARY_DATA_VALUE; continue; } // detect if the too long string must be shorten if (function_exists('mb_detect_encoding') && false !== $encoding = mb_detect_encoding($params[$index])) { if (self::MAX_STRING_LENGTH < mb_strlen($params[$index], $encoding)) { $params[$index] = mb_substr($params[$index], 0, self::MAX_STRING_LENGTH - 6, $encoding).' [...]'; continue; } } else { if (self::MAX_STRING_LENGTH < strlen($params[$index])) { $params[$index] = substr($params[$index], 0, self::MAX_STRING_LENGTH - 6).' [...]'; continue; } } } } if (null !== $this->logger) { $this->log($sql, null === $params ? array() : $params); } } /** * {@inheritdoc} */ public function stopQuery() { if (null !== $this->stopwatch) { $this->stopwatch->stop('doctrine'); } } /** * Logs a message. * * @param string $message A message to log * @param array $params The context */ protected function log($message, array $params) { $this->logger->debug($message, $params); } } PKi]QГ/Doctrine/Validator/Constraints/UniqueEntity.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\Validator\Constraints; use Symfony\Component\Validator\Constraint; /** * Constraint for the Unique Entity validator * * @Annotation * @author Benjamin Eberlei */ class UniqueEntity extends Constraint { public $message = 'This value is already used.'; public $service = 'doctrine.orm.validator.unique'; public $em = null; public $repositoryMethod = 'findBy'; public $fields = array(); public $errorPath = null; public $ignoreNull = true; public function getRequiredOptions() { return array('fields'); } /** * The validator must be defined as a service with this name. * * @return string */ public function validatedBy() { return $this->service; } /** * {@inheritDoc} */ public function getTargets() { return self::CLASS_CONSTRAINT; } public function getDefaultOption() { return 'fields'; } } PKi]:d8Doctrine/Validator/Constraints/UniqueEntityValidator.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\Validator\Constraints; use Doctrine\Common\Persistence\ManagerRegistry; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Exception\ConstraintDefinitionException; use Symfony\Component\Validator\ConstraintValidator; /** * Unique Entity Validator checks if one or a set of fields contain unique values. * * @author Benjamin Eberlei */ class UniqueEntityValidator extends ConstraintValidator { /** * @var ManagerRegistry */ private $registry; /** * @param ManagerRegistry $registry */ public function __construct(ManagerRegistry $registry) { $this->registry = $registry; } /** * @param object $entity * @param Constraint $constraint * * @throws UnexpectedTypeException * @throws ConstraintDefinitionException */ public function validate($entity, Constraint $constraint) { if (!is_array($constraint->fields) && !is_string($constraint->fields)) { throw new UnexpectedTypeException($constraint->fields, 'array'); } if (null !== $constraint->errorPath && !is_string($constraint->errorPath)) { throw new UnexpectedTypeException($constraint->errorPath, 'string or null'); } $fields = (array) $constraint->fields; if (0 === count($fields)) { throw new ConstraintDefinitionException('At least one field has to be specified.'); } if ($constraint->em) { $em = $this->registry->getManager($constraint->em); if (!$em) { throw new ConstraintDefinitionException(sprintf('Object manager "%s" does not exist.', $constraint->em)); } } else { $em = $this->registry->getManagerForClass(get_class($entity)); if (!$em) { throw new ConstraintDefinitionException(sprintf('Unable to find the object manager associated with an entity of class "%s".', get_class($entity))); } } $class = $em->getClassMetadata(get_class($entity)); /* @var $class \Doctrine\Common\Persistence\Mapping\ClassMetadata */ $criteria = array(); foreach ($fields as $fieldName) { if (!$class->hasField($fieldName) && !$class->hasAssociation($fieldName)) { throw new ConstraintDefinitionException(sprintf("The field '%s' is not mapped by Doctrine, so it cannot be validated for uniqueness.", $fieldName)); } $criteria[$fieldName] = $class->reflFields[$fieldName]->getValue($entity); if ($constraint->ignoreNull && null === $criteria[$fieldName]) { return; } if (null !== $criteria[$fieldName] && $class->hasAssociation($fieldName)) { /* Ensure the Proxy is initialized before using reflection to * read its identifiers. This is necessary because the wrapped * getter methods in the Proxy are being bypassed. */ $em->initializeObject($criteria[$fieldName]); $relatedClass = $em->getClassMetadata($class->getAssociationTargetClass($fieldName)); $relatedId = $relatedClass->getIdentifierValues($criteria[$fieldName]); if (count($relatedId) > 1) { throw new ConstraintDefinitionException( "Associated entities are not allowed to have more than one identifier field to be " . "part of a unique constraint in: ".$class->getName()."#".$fieldName ); } $criteria[$fieldName] = array_pop($relatedId); } } $repository = $em->getRepository(get_class($entity)); $result = $repository->{$constraint->repositoryMethod}($criteria); /* If the result is a MongoCursor, it must be advanced to the first * element. Rewinding should have no ill effect if $result is another * iterator implementation. */ if ($result instanceof \Iterator) { $result->rewind(); } elseif (is_array($result)) { reset($result); } /* If no entity matched the query criteria or a single entity matched, * which is the same as the entity being validated, the criteria is * unique. */ if (0 === count($result) || (1 === count($result) && $entity === ($result instanceof \Iterator ? $result->current() : current($result)))) { return; } $errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $fields[0]; $this->context->addViolationAt($errorPath, $constraint->message, array(), $criteria[$fields[0]]); } } PKi](y*Doctrine/Validator/DoctrineInitializer.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\Validator; use Doctrine\Common\Persistence\ManagerRegistry; use Symfony\Component\Validator\ObjectInitializerInterface; /** * Automatically loads proxy object before validation. * * @author Fabien Potencier */ class DoctrineInitializer implements ObjectInitializerInterface { protected $registry; public function __construct(ManagerRegistry $registry) { $this->registry = $registry; } public function initialize($object) { $manager = $this->registry->getManagerForClass(get_class($object)); if (null !== $manager) { $manager->initializeObject($object); } } } PKi]W&v-Doctrine/Security/User/EntityUserProvider.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\Security\User; use Doctrine\Common\Persistence\ManagerRegistry; use Symfony\Component\Security\Core\Exception\UnsupportedUserException; use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; use Symfony\Component\Security\Core\User\UserProviderInterface; use Symfony\Component\Security\Core\User\UserInterface; /** * Wrapper around a Doctrine ObjectManager. * * Provides easy to use provisioning for Doctrine entity users. * * @author Fabien Potencier * @author Johannes M. Schmitt */ class EntityUserProvider implements UserProviderInterface { private $class; private $repository; private $property; private $metadata; public function __construct(ManagerRegistry $registry, $class, $property = null, $managerName = null) { $em = $registry->getManager($managerName); $this->class = $class; $this->metadata = $em->getClassMetadata($class); if (false !== strpos($this->class, ':')) { $this->class = $this->metadata->getName(); } $this->repository = $em->getRepository($class); $this->property = $property; } /** * {@inheritdoc} */ public function loadUserByUsername($username) { if (null !== $this->property) { $user = $this->repository->findOneBy(array($this->property => $username)); } else { if (!$this->repository instanceof UserProviderInterface) { throw new \InvalidArgumentException(sprintf('The Doctrine repository "%s" must implement UserProviderInterface.', get_class($this->repository))); } $user = $this->repository->loadUserByUsername($username); } if (null === $user) { throw new UsernameNotFoundException(sprintf('User "%s" not found.', $username)); } return $user; } /** * {@inheritDoc} */ public function refreshUser(UserInterface $user) { if (!$user instanceof $this->class) { throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_class($user))); } if ($this->repository instanceof UserProviderInterface) { $refreshedUser = $this->repository->refreshUser($user); } else { // The user must be reloaded via the primary key as all other data // might have changed without proper persistence in the database. // That's the case when the user has been changed by a form with // validation errors. if (!$id = $this->metadata->getIdentifierValues($user)) { throw new \InvalidArgumentException("You cannot refresh a user ". "from the EntityUserProvider that does not contain an identifier. ". "The user object has to be serialized with its own identifier " . "mapped by Doctrine." ); } $refreshedUser = $this->repository->find($id); if (null === $refreshedUser) { throw new UsernameNotFoundException(sprintf('User with id %s not found', json_encode($id))); } } return $refreshedUser; } /** * {@inheritDoc} */ public function supportsClass($class) { return $class === $this->class || is_subclass_of($class, $this->class); } } PKi]6Doctrine/Security/RememberMe/DoctrineTokenProvider.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\Security\RememberMe; use Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface; use Symfony\Component\Security\Core\Authentication\RememberMe\PersistentTokenInterface; use Symfony\Component\Security\Core\Authentication\RememberMe\PersistentToken; use Symfony\Component\Security\Core\Exception\TokenNotFoundException; use Doctrine\DBAL\Connection; use Doctrine\DBAL\Types\Type as DoctrineType; use PDO, DateTime; /** * This class provides storage for the tokens that is set in "remember me" * cookies. This way no password secrets will be stored in the cookies on * the client machine, and thus the security is improved. * * This depends only on doctrine in order to get a database connection * and to do the conversion of the datetime column. * * In order to use this class, you need the following table in your database: * CREATE TABLE `rememberme_token` ( * `series` char(88) UNIQUE PRIMARY KEY NOT NULL, * `value` char(88) NOT NULL, * `lastUsed` datetime NOT NULL, * `class` varchar(100) NOT NULL, * `username` varchar(200) NOT NULL * ); */ class DoctrineTokenProvider implements TokenProviderInterface { /** * Doctrine DBAL database connection * F.ex. service id: doctrine.dbal.default_connection * * @var \Doctrine\DBAL\Connection */ private $conn; /** * new DoctrineTokenProvider for the RememberMe authentication service * * @param \Doctrine\DBAL\Connection $conn */ public function __construct(Connection $conn) { $this->conn = $conn; } /** * {@inheritdoc} */ public function loadTokenBySeries($series) { $sql = 'SELECT class, username, value, lastUsed' . ' FROM rememberme_token WHERE series=:series'; $paramValues = array('series' => $series); $paramTypes = array('series' => PDO::PARAM_STR); $stmt = $this->conn->executeQuery($sql, $paramValues, $paramTypes); $row = $stmt->fetch(PDO::FETCH_ASSOC); if ($row) { return new PersistentToken($row['class'], $row['username'], $series, $row['value'], new DateTime($row['lastUsed']) ); } throw new TokenNotFoundException('No token found.'); } /** * {@inheritdoc} */ public function deleteTokenBySeries($series) { $sql = 'DELETE FROM rememberme_token WHERE series=:series'; $paramValues = array('series' => $series); $paramTypes = array('series' => PDO::PARAM_STR); $this->conn->executeUpdate($sql, $paramValues, $paramTypes); } /** * {@inheritdoc} */ public function updateToken($series, $tokenValue, DateTime $lastUsed) { $sql = 'UPDATE rememberme_token SET value=:value, lastUsed=:lastUsed' . ' WHERE series=:series'; $paramValues = array('value' => $tokenValue, 'lastUsed' => $lastUsed, 'series' => $series); $paramTypes = array('value' => PDO::PARAM_STR, 'lastUsed' => DoctrineType::DATETIME, 'series' => PDO::PARAM_STR); $updated = $this->conn->executeUpdate($sql, $paramValues, $paramTypes); if ($updated < 1) { throw new TokenNotFoundException('No token found.'); } } /** * {@inheritdoc} */ public function createNewToken(PersistentTokenInterface $token) { $sql = 'INSERT INTO rememberme_token' . ' (class, username, series, value, lastUsed)' . ' VALUES (:class, :username, :series, :value, :lastUsed)'; $paramValues = array('class' => $token->getClass(), 'username' => $token->getUsername(), 'series' => $token->getSeries(), 'value' => $token->getTokenValue(), 'lastUsed' => $token->getLastUsed()); $paramTypes = array('class' => PDO::PARAM_STR, 'username' => PDO::PARAM_STR, 'series' => PDO::PARAM_STR, 'value' => PDO::PARAM_STR, 'lastUsed' => DoctrineType::DATETIME); $this->conn->executeUpdate($sql, $paramValues, $paramTypes); } } PKi]eOODoctrine/autoloader.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Monolog\Processor; use Monolog\Processor\WebProcessor as BaseWebProcessor; use Symfony\Component\HttpKernel\Event\GetResponseEvent; /** * WebProcessor override to read from the HttpFoundation's Request * * @author Jordi Boggiano */ class WebProcessor extends BaseWebProcessor { public function __construct() { // Pass an empty array as the default null value would access $_SERVER parent::__construct(array()); } public function onKernelRequest(GetResponseEvent $event) { if ($event->isMasterRequest()) { $this->serverData = $event->getRequest()->server->all(); } } } PKi]; Monolog/Logger.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Monolog; use Monolog\Logger as BaseLogger; use Symfony\Component\HttpKernel\Log\LoggerInterface; use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; /** * Logger. * * @author Fabien Potencier */ class Logger extends BaseLogger implements LoggerInterface, DebugLoggerInterface { /** * @deprecated since 2.2, to be removed in 3.0. Use emergency() which is PSR-3 compatible. */ public function emerg($message, array $context = array()) { return parent::addRecord(BaseLogger::EMERGENCY, $message, $context); } /** * @deprecated since 2.2, to be removed in 3.0. Use critical() which is PSR-3 compatible. */ public function crit($message, array $context = array()) { return parent::addRecord(BaseLogger::CRITICAL, $message, $context); } /** * @deprecated since 2.2, to be removed in 3.0. Use error() which is PSR-3 compatible. */ public function err($message, array $context = array()) { return parent::addRecord(BaseLogger::ERROR, $message, $context); } /** * @deprecated since 2.2, to be removed in 3.0. Use warning() which is PSR-3 compatible. */ public function warn($message, array $context = array()) { return parent::addRecord(BaseLogger::WARNING, $message, $context); } /** * @see Symfony\Component\HttpKernel\Log\DebugLoggerInterface */ public function getLogs() { if ($logger = $this->getDebugLogger()) { return $logger->getLogs(); } return array(); } /** * @see Symfony\Component\HttpKernel\Log\DebugLoggerInterface */ public function countErrors() { if ($logger = $this->getDebugLogger()) { return $logger->countErrors(); } return 0; } /** * Returns a DebugLoggerInterface instance if one is registered with this logger. * * @return DebugLoggerInterface|null A DebugLoggerInterface instance or null if none is registered */ private function getDebugLogger() { foreach ($this->handlers as $handler) { if ($handler instanceof DebugLoggerInterface) { return $handler; } } } } PKi]b11&Monolog/Formatter/ConsoleFormatter.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Monolog\Formatter; use Monolog\Formatter\LineFormatter; use Monolog\Logger; /** * Formats incoming records for console output by coloring them depending on log level. * * @author Tobias Schultze */ class ConsoleFormatter extends LineFormatter { const SIMPLE_FORMAT = "%start_tag%[%datetime%] %channel%.%level_name%:%end_tag% %message% %context% %extra%\n"; /** * {@inheritdoc} */ public function format(array $record) { if ($record['level'] >= Logger::ERROR) { $record['start_tag'] = ''; $record['end_tag'] = ''; } elseif ($record['level'] >= Logger::NOTICE) { $record['start_tag'] = ''; $record['end_tag'] = ''; } elseif ($record['level'] >= Logger::INFO) { $record['start_tag'] = ''; $record['end_tag'] = ''; } else { $record['start_tag'] = ''; $record['end_tag'] = ''; } return parent::format($record); } } PKi]"II$Monolog/Handler/ChromePhpHandler.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Monolog\Handler; use Monolog\Handler\ChromePHPHandler as BaseChromePhpHandler; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; /** * ChromePhpHandler. * * @author Christophe Coevoet */ class ChromePhpHandler extends BaseChromePhpHandler { /** * @var array */ private $headers = array(); /** * @var Response */ private $response; /** * Adds the headers to the response once it's created */ public function onKernelResponse(FilterResponseEvent $event) { if (!$event->isMasterRequest()) { return; } if (!preg_match('{\bChrome/\d+[\.\d+]*\b}', $event->getRequest()->headers->get('User-Agent'))) { $this->sendHeaders = false; $this->headers = array(); return; } $this->response = $event->getResponse(); foreach ($this->headers as $header => $content) { $this->response->headers->set($header, $content); } $this->headers = array(); } /** * {@inheritDoc} */ protected function sendHeader($header, $content) { if (!$this->sendHeaders) { return; } if ($this->response) { $this->response->headers->set($header, $content); } else { $this->headers[$header] = $content; } } /** * Override default behavior since we check it in onKernelResponse */ protected function headersAccepted() { return true; } } PKi]*vv&Monolog/Handler/SwiftMailerHandler.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Monolog\Handler; use Monolog\Handler\SwiftMailerHandler as BaseSwiftMailerHandler; use Symfony\Component\HttpKernel\Event\PostResponseEvent; /** * Extended SwiftMailerHandler that flushes mail queue if necessary * * @author Philipp Kräutli */ class SwiftMailerHandler extends BaseSwiftMailerHandler { protected $transport; protected $instantFlush = false; /** * @param \Swift_Transport $transport */ public function setTransport(\Swift_Transport $transport) { $this->transport = $transport; } /** * After the kernel has been terminated we will always flush messages * * @param PostResponseEvent $event */ public function onKernelTerminate(PostResponseEvent $event) { $this->instantFlush = true; } /** * {@inheritdoc} */ protected function send($content, array $records) { parent::send($content, $records); if ($this->instantFlush) { $this->flushMemorySpool(); } } /** * Flushes the mail queue if a memory spool is used */ private function flushMemorySpool() { $mailerTransport = $this->mailer->getTransport(); if (!$mailerTransport instanceof \Swift_Transport_SpoolTransport) { return; } $spool = $mailerTransport->getSpool(); if (!$spool instanceof \Swift_MemorySpool) { return; } if (null === $this->transport) { throw new \Exception('No transport available to flush mail queue'); } $spool->flushQueue($this->transport); } } PKi]y"Monolog/Handler/ConsoleHandler.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Monolog\Handler; use Monolog\Handler\AbstractProcessingHandler; use Monolog\Logger; use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter; use Symfony\Component\Console\ConsoleEvents; use Symfony\Component\Console\Event\ConsoleCommandEvent; use Symfony\Component\Console\Event\ConsoleTerminateEvent; use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * Writes logs to the console output depending on its verbosity setting. * * It is disabled by default and gets activated as soon as a command is executed. * Instead of listening to the console events, the output can also be set manually. * * The minimum logging level at which this handler will be triggered depends on the * verbosity setting of the console output. The default mapping is: * - OutputInterface::VERBOSITY_NORMAL will show all WARNING and higher logs * - OutputInterface::VERBOSITY_VERBOSE (-v) will show all NOTICE and higher logs * - OutputInterface::VERBOSITY_VERY_VERBOSE (-vv) will show all INFO and higher logs * - OutputInterface::VERBOSITY_DEBUG (-vvv) will show all DEBUG and higher logs, i.e. all logs * * This mapping can be customized with the $verbosityLevelMap constructor parameter. * * @author Tobias Schultze */ class ConsoleHandler extends AbstractProcessingHandler implements EventSubscriberInterface { /** * @var OutputInterface|null */ private $output; /** * @var array */ private $verbosityLevelMap = array( OutputInterface::VERBOSITY_NORMAL => Logger::WARNING, OutputInterface::VERBOSITY_VERBOSE => Logger::NOTICE, OutputInterface::VERBOSITY_VERY_VERBOSE => Logger::INFO, OutputInterface::VERBOSITY_DEBUG => Logger::DEBUG ); /** * Constructor. * * @param OutputInterface|null $output The console output to use (the handler remains disabled when passing null * until the output is set, e.g. by using console events) * @param Boolean $bubble Whether the messages that are handled can bubble up the stack * @param array $verbosityLevelMap Array that maps the OutputInterface verbosity to a minimum logging * level (leave empty to use the default mapping) */ public function __construct(OutputInterface $output = null, $bubble = true, array $verbosityLevelMap = array()) { parent::__construct(Logger::DEBUG, $bubble); $this->output = $output; if ($verbosityLevelMap) { $this->verbosityLevelMap = $verbosityLevelMap; } } /** * {@inheritdoc} */ public function isHandling(array $record) { return $this->updateLevel() && parent::isHandling($record); } /** * {@inheritdoc} */ public function handle(array $record) { // we have to update the logging level each time because the verbosity of the // console output might have changed in the meantime (it is not immutable) return $this->updateLevel() && parent::handle($record); } /** * Sets the console output to use for printing logs. * * @param OutputInterface $output The console output to use */ public function setOutput(OutputInterface $output) { $this->output = $output; } /** * Disables the output. */ public function close() { $this->output = null; parent::close(); } /** * Before a command is executed, the handler gets activated and the console output * is set in order to know where to write the logs. * * @param ConsoleCommandEvent $event */ public function onCommand(ConsoleCommandEvent $event) { $this->setOutput($event->getOutput()); } /** * After a command has been executed, it disables the output. * * @param ConsoleTerminateEvent $event */ public function onTerminate(ConsoleTerminateEvent $event) { $this->close(); } /** * {@inheritdoc} */ public static function getSubscribedEvents() { return array( ConsoleEvents::COMMAND => 'onCommand', ConsoleEvents::TERMINATE => 'onTerminate' ); } /** * {@inheritdoc} */ protected function write(array $record) { if ($record['level'] >= Logger::ERROR && $this->output instanceof ConsoleOutputInterface) { $this->output->getErrorOutput()->write((string) $record['formatted']); } else { $this->output->write((string) $record['formatted']); } } /** * {@inheritdoc} */ protected function getDefaultFormatter() { return new ConsoleFormatter(); } /** * Updates the logging level based on the verbosity setting of the console output. * * @return Boolean Whether the handler is enabled and verbosity is not set to quiet. */ private function updateLevel() { if (null === $this->output || OutputInterface::VERBOSITY_QUIET === $verbosity = $this->output->getVerbosity()) { return false; } if (isset($this->verbosityLevelMap[$verbosity])) { $this->setLevel($this->verbosityLevelMap[$verbosity]); } else { $this->setLevel(Logger::DEBUG); } return true; } } PKi]մ"Monolog/Handler/FirePHPHandler.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Monolog\Handler; use Monolog\Handler\FirePHPHandler as BaseFirePHPHandler; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpFoundation\Response; /** * FirePHPHandler. * * @author Jordi Boggiano */ class FirePHPHandler extends BaseFirePHPHandler { /** * @var array */ private $headers = array(); /** * @var Response */ private $response; /** * Adds the headers to the response once it's created */ public function onKernelResponse(FilterResponseEvent $event) { if (!$event->isMasterRequest()) { return; } if (!preg_match('{\bFirePHP/\d+\.\d+\b}', $event->getRequest()->headers->get('User-Agent')) && !$event->getRequest()->headers->has('X-FirePHP-Version')) { $this->sendHeaders = false; $this->headers = array(); return; } $this->response = $event->getResponse(); foreach ($this->headers as $header => $content) { $this->response->headers->set($header, $content); } $this->headers = array(); } /** * {@inheritDoc} */ protected function sendHeader($header, $content) { if (!$this->sendHeaders) { return; } if ($this->response) { $this->response->headers->set($header, $content); } else { $this->headers[$header] = $content; } } /** * Override default behavior since we check the user agent in onKernelResponse */ protected function headersAccepted() { return true; } } PKi]Zv Monolog/Handler/DebugHandler.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Monolog\Handler; use Monolog\Logger; use Monolog\Handler\TestHandler; use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; /** * DebugLogger. * * @author Jordi Boggiano */ class DebugHandler extends TestHandler implements DebugLoggerInterface { /** * {@inheritdoc} */ public function getLogs() { $records = array(); foreach ($this->records as $record) { $records[] = array( 'timestamp' => $record['datetime']->getTimestamp(), 'message' => $record['message'], 'priority' => $record['level'], 'priorityName' => $record['level_name'], 'context' => $record['context'], ); } return $records; } /** * {@inheritdoc} */ public function countErrors() { $cnt = 0; $levels = array(Logger::ERROR, Logger::CRITICAL, Logger::ALERT, Logger::EMERGENCY); foreach ($levels as $level) { if (isset($this->recordsByLevel[$level])) { $cnt += count($this->recordsByLevel[$level]); } } return $cnt; } } PKi]4NNMonolog/autoloader.phpnu[Twig/Extension/HttpKernelExtension.phpnu[PKi]| Twig/Extension/YamlExtension.phpnu[PKi]  _Twig/Extension/CodeExtension.phpnu[PKi])UU"bTwig/Translation/TwigExtractor.phpnu[PKi]<  Twig/Form/TwigRendererEngine.phpnu[PKi]vqTwig/Form/TwigRenderer.phpnu[PKi]Qkk#CTwig/Form/TwigRendererInterface.phpnu[PKi]b3}})Twig/Form/TwigRendererEngineInterface.phpnu[PKi]/ +Twig/TokenParser/TransChoiceTokenParser.phpnu[PKi].) Twig/TokenParser/StopwatchTokenParser.phpnu[PKi]>)fTwig/TokenParser/FormThemeTokenParser.phpnu[PKi]%] %Twig/TokenParser/TransTokenParser.phpnu[PKi]ʶ̭2Twig/TokenParser/TransDefaultDomainTokenParser.phpnu[PKi]  8 Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.phpnu[PKi]tA+OTwig/NodeVisitor/TranslationNodeVisitor.phpnu[PKi])[n n (Twig/NodeVisitor/Scope.phpnu[PKi]^f2Twig/Node/RenderBlockNode.phpnu[PKi]ʦ\G G k7Twig/Node/TransNode.phpnu[PKi]PIAA$DTwig/Node/TransDefaultDomainNode.phpnu[PKi] s>>HTwig/Node/FormThemeNode.phpnu[PKi]U,ttMTwig/Node/FormEnctypeNode.phpnu[PKi]6 DZ77PTwig/Node/StopwatchNode.phpnu[PKi], @&ZVTwig/Node/SearchAndRenderBlockNode.phpnu[PKi]$KK@hTwig/autoloader.phpnu[PKi]̳֨iDoctrine/ManagerRegistry.phpnu[PKi]؈$nDoctrine/Test/DoctrineTestHelper.phpnu[PKi]*+JJ:uDoctrine/DependencyInjection/AbstractDoctrineExtension.phpnu[PKi],DDoctrine/DependencyInjection/CompilerPass/DoctrineValidationPass.phpnu[PKi]~YAAVvDoctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.phpnu[PKi]㛕B=Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.phpnu[PKi]*DDDoctrine/DependencyInjection/Security/UserProvider/EntityFactory.phpnu[PKi]+çxAA0Doctrine/DataCollector/DoctrineDataCollector.phpnu[PKi]X+)>Doctrine/CacheWarmer/ProxyCacheWarmer.phpnu[PKi]Ta==3Doctrine/ExpressionLanguage/DoctrineParserCache.phpnu[PKi]S;,:#1 Doctrine/Form/Type/DoctrineType.phpnu[PKi]憝!z:Doctrine/Form/Type/EntityType.phpnu[PKi]CiPP>q>Doctrine/Form/DataTransformer/CollectionToArrayTransformer.phpnu[PKi]`. qpp(/FDoctrine/Form/DoctrineOrmTypeGuesser.phpnu[PKi] ?x77-]Doctrine/Form/ChoiceList/EntityChoiceList.phpnu[PKi]GCt 2Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.phpnu[PKi]!%d==2(Doctrine/Form/ChoiceList/EntityLoaderInterface.phpnu[PKi]0?ǦDoctrine/Form/EventListener/MergeDoctrineCollectionListener.phpnu[PKi] 9,&Doctrine/Form/DoctrineOrmExtension.phpnu[PKi]lf/qq.ưDoctrine/DataFixtures/ContainerAwareLoader.phpnu[PKi].Doctrine/HttpFoundation/DbalSessionHandler.phpnu[PKi]4Doctrine/HttpFoundation/DbalSessionHandlerSchema.phpnu[PKi]qm m Doctrine/RegistryInterface.phpnu[PKi]OlQ99'Doctrine/ContainerAwareEventManager.phpnu[PKi] Xxo RDoctrine/Logger/DbalLogger.phpnu[PKi]QГ/;Doctrine/Validator/Constraints/UniqueEntity.phpnu[PKi]:d8tDoctrine/Validator/Constraints/UniqueEntityValidator.phpnu[PKi](y*Doctrine/Validator/DoctrineInitializer.phpnu[PKi]W&v-Doctrine/Security/User/EntityUserProvider.phpnu[PKi]6#Doctrine/Security/RememberMe/DoctrineTokenProvider.phpnu[PKi]eOO)7Doctrine/autoloader.phpnu[PKi],"8Monolog/Processor/WebProcessor.phpnu[PKi]; <Monolog/Logger.phpnu[PKi]b11&FMonolog/Formatter/ConsoleFormatter.phpnu[PKi]"II$aLMonolog/Handler/ChromePhpHandler.phpnu[PKi]*vv&SMonolog/Handler/SwiftMailerHandler.phpnu[PKi]y"[Monolog/Handler/ConsoleHandler.phpnu[PKi]մ"rMonolog/Handler/FirePHPHandler.phpnu[PKi]Zv zMonolog/Handler/DebugHandler.phpnu[PKi]4NNMonolog/autoloader.phpnu[PKIIx