Symfony2无法保存到数据库中

时间:2015-12-11 13:12:37

标签: php symfony doctrine

我在Symfony2控制器中保存到数据库时遇到了一个奇怪的问题。这是代码:

Call to undefined method Symfony\Bundle\DoctrineBundle\Registry::getManager()

我收到以下错误:

$em = $this->get("doctrine.orm.entity_manager");

我可以通过将$ em更改为:

来解决此问题
ObjectManager does not support filters

但后来我收到了这个错误并且不知道为什么(500错误):

vendor/gedmo-doctrine-extensions/lib/Gedmo/Sluggable/SluggableListener.php at line 523
throw new \Gedmo\Exception\InvalidArgumentException("ObjectManager does not support filters");

任何想法为什么?

如果有人帮助安装了Gedmo Doctrine Extension,则错误指向:

// get DOM element generated by Bootstrap
var bs_element = document.getElementById(element.getAttribute('aria-describedby'));
var offset_height = 10;
// get computed popup height and add some offset
var popup_height = bs_element.offsetHeight + offset_height;
var clicked_pixel = evt.pixel;
// how much space (height) left between clicked pixel and top
var height_left = clicked_pixel[1] - popup_height;
var view = map.getView();
// get the actual center
var center = view.getCenter();

if (height_left < 0) {
  var center_px = map.getPixelFromCoordinate(center);
  var new_center_px = [
    center_px[0],
    center_px[1] + height_left
  ];

  map.beforeRender(ol.animation.pan({
    source: center,
    start: Date.now(),
    duration: 300
  }));
  view.setCenter(map.getCoordinateFromPixel(new_center_px));
}

1 个答案:

答案 0 :(得分:0)

我假设您是从控制器调用管理器,所以我认为您可能忘记让您的类扩展Controller。

class myClass extends Controller
{
    // Your code
}