Twig_Error_Runtime在呈现模板期间抛出了异常

时间:2018-04-09 19:37:09

标签: symfony symfony-3.4 symfony2-easyadmin

  

类Proxies的对象_CG __ \ AppBundle \ Entity \ Formation无法转换为float

在vendor \ easycorp \ easyadmin-bundle \ src \ Resources \ views \ default \ field_integer.html.twig(第4行)

    {% if field_options.format %}
    {{ field_options.format|format(value) }}
{% else %}
    {{ value|number_format }}
{% endif %}

错误是通过在我的实体中为我的外键注释掉我的getter和setter而修复的,我试图设置它们,因为它们在我的easy-admin Bundle中显示无法访问

实体代码:

/**
 * Questions
 *
 * @ORM\Table(name="questions", indexes={@ORM\Index(name="question_form_id", columns={"formid"})})
 * @ORM\Entity
 */

/**
 * @var \AppBundle\Entity\Formation
 *
 * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Formation")
 * @ORM\JoinColumns({
 *   @ORM\JoinColumn(name="formid", referencedColumnName="Form_id")
 * })
 */
private $formid;

getter and setters:

/**
 * @return Formation
 */
public function getFormid()
{
    return $this->formid;
}

/**
 * @param Formation $formid
 */
public function setFormid($formid)
{
    $this->formid = $formid;
}

1 个答案:

答案 0 :(得分:0)

修正了问题,function processScroll() { clearTimeout(trackTimer2); trackTimer2 = setTimeout(function() { //Track the Page - pagetoload, pageToTrack, direction var test = displayManager.trackingPage(nextToLoad.nextToLoad, nextToLoad.page, nextToLoad.direction) console.log(test + " test") if (test) { var something = (function() { return function() { if (!executed) { executed = true; // do something console.log("Something running " + " tl: " + nextToLoad.nextToLoad + " tp: " + nextToLoad.page); // DisplayManager.prototype.loadIt(nextToLoad.nextToLoad, nextToLoad.page); App.service("util").sendEvent("page-change", { current: nextToLoad.nextToLoad, previous: nextToLoad.nextToLoad }); } }; })(); something(); } }, 60); DisplayManager.prototype.setIndicatorStatus(false); } $('#' + displayManager.getScrollableContentId()).on('scroll.tracker', function(event) { if (!executed) { clearTimeout(trackTimer); trackTimer = setTimeout( processScroll();, 200); } }); DisplayManager.prototype.trackingPage = function(pageToLoad, pageToTrack, pageDirection) { var zoom_level = this.getZoom(); var mainViewHeight = $('#main-view').height(); var pageTop = $('#page-' + pageToTrack).offset().top; var pageHeight = $('#page-' + pageToTrack).height() * zoom_level; var pg_bottom = pageHeight + pageTop; var variance = 1.2; //Variable need for ipad screen if (App.getIsIpad()) { variance = 0.9 }; var mv_percentLimitBottom = variance * mainViewHeight; var mv_percentLimitTop = 0.0922 * mainViewHeight; var holder = {}; console.log("%%Pg: " + pageToTrack); console.log("%%pg_bottom: " + pg_bottom + "<= " + "mv_percentLimitBottom: " + mv_percentLimitBottom); if (pageDirection === 'upward') { if (pageTop >= mv_percentLimitTop) { DisplayManager.prototype.showLoadIndicator(pageToLoad, pageDirection); return true; } } } else if (pageDirection === 'downward') { if (pg_bottom <= mv_percentLimitBottom) { DisplayManager.prototype.showLoadIndicator(pageToLoad, pageDirection); return true; } } } 使用了错误的列,抱歉。