Symfony 2.8 OutOfBoundsException Дочерний элемент "0" не существует - PullRequest
0 голосов
/ 08 февраля 2020

Я ищу небольшое указание о том, как начать отладку следующей ошибки.

Возникла проблема с менее чем 1% отправленных форм, поэтому я пытаюсь воспроизвести ошибка.

Я с удовольствием выполняю работу на ногах, но сейчас я спотыкаюсь в темноте.

[2020-01-09 08:12:38] request.INFO: Matched route "observationreport_create". {"route_parameters":{"_controller":"Sugar\\IncidentBundle\\Controller\\ObservationReportController::createAction","_route":"observationreport_create"},"request_uri":"https://##########.com/public/observation/"} []
[2020-01-09 08:12:38] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2020-01-09 08:12:38] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Form\Exception\OutOfBoundsException: "Child "0" does not exist." at /var/www/app/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php line 976 {"exception":"[object] (Symfony\\Component\\Form\\Exception\\OutOfBoundsException(code: 0): Child \"0\" does not exist. at /var/www/app/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php:976)"} []
{% extends '::base.html.twig' %} 

{% block breadcrumbs %}
<div class="row page-titles hidden-print">
    <div class="col-lg-12">
        <h3 class="text-themecolor m-b-0 m-t-0">Health & Safety</h3>
        <ol class="breadcrumb">
            <li class="breadcrumb-item">
                Observation Reports
            </li>
            <li class="breadcrumb-item active">New Observation</li>
        </ol>
    </div>
</div>
{% endblock %}

{% block javascripts %}
    <script src="{{ asset('/bundles/sugarincident/js/script.js') }}"></script>
{% endblock %}

{% block body %}
<div class="row">
    <div class="col-lg-12">
        <div class="card card-outline-info">
            <div class="card-header">
                <h4 class="m-b-0 text-white">Observation Details</h4>
            </div>
            <div class="card-body">
            {{ form_start(form, {'attr':{'novalidate':'novalidate'}}) }}
                <div class="form-body">

                    <h3 class="box-title">When/Where did it Occur</h3>
                    <hr class="m-t-0 m-b-40">

                    <div class="row">

                        <div class="col-sm-6">
                            {{ form_row(form.location, {'attr':{'data-live-search':'true'}}) }}
                        </div>

                        <div class="col-sm-6">
                            {{ form_row(form.department, {'attr':{'data-live-search':'true'}}) }}
                        </div>

                        <div class="col-sm-6">
                            {{ form_row(form.date) }}
                        </div>

                        <div class="col-sm-6">
                            {{ form_row(form.reporter_name) }}
                        </div>

                        {% if form.incident_type is defined %}
                        <div class="col-sm-6">
                            {{ form_row(form.incident_type, {'attr':{'data-live-search':'true'}}) }}
                        </div>
                        {% endif %}

                        {% if form.location_type is defined %}
                        <div class="col-sm-6">
                            {{ form_row(form.location_type, {'attr':{'data-live-search':'true'}}) }}
                        </div>
                        {% endif %}

                        {% if form.escalate is defined %}
                        <div class="col-sm-6">
                            {{ form_row(form.escalate) }}
                        </div>
                        {% endif %}

                    </div>

                    <h3 class="box-title">What/How did it Happen</h3>
                    <hr class="m-t-0 m-b-40">

                    <div class="row">
                        <div class="col-sm-12">
                            {{ form_row(form.name) }}
                        </div>
                        <div class="col-sm-12">
                            {{ form_row(form.description) }}
                        </div>
                        <div class="col-sm-12">
                            {{ form_row(form.correctiveAction) }}
                        </div>
                    </div>

                    <h3 class="box-title">Files</h3>
                    <hr class="m-t-0 m-b-40">

                    <div class="row collapsable-collection">
                        <div class="col-sm-12">
                            <ul class="incident_files_new list-unstyled row" data-prototype="{{ form_widget(form.incident_files.vars.prototype)|e }}">
                                {% for file in form.incident_files %}
                                    <div class="col-lg-6 m-b-30">
                                        <li class="collection-list-element ribbon-wrapper" data-index="{{ loop.index-1 }}">
                                            <div class="form-collection-label ribbon ribbon-success d-none d-sm-block"><p><strong>File #{{ loop.index }}</strong></p></div>
                                            {{ form_row(file.handle) }}
                                            {{ form_row(file.category) }}
                                            {{ form_row(file.file, {'label':'Update File'}) }}
                                        </li>
                                    </div>
                                {% endfor %}
                            </ul>
                            {% do form.incident_files.setRendered %}
                        </div>
                    </div>

                </div>

                <div class="form-actions">
                    {% do form.submit.setRendered %}
                    <button type="submit" class="btn btn-success waves-effect waves-light"> <i class="fa fa-check"></i> Save</button>
                    <a class="btn btn-inverse waves-effect waves-light" href="{{ path('observationreport_new') }}">Cancel</a>
                </div>

            </div>
        </div>
        {{ form_end(form) }}
    </div>
</div>

{% endblock %}
  • PHP Версия = > 5.5.9-1ubuntu4.26
  • mysql Ver 14.14 Distrib 5.5.62, для debian- linux -gnu (x86_64) с использованием readline 6.3
  • Symfony 2.8

Если у кого-то есть подсказки, по запросу можно вставить больше кода.

...