An exception has been thrown during the rendering of a template (“A “__toString()”
我在继续操作时遇到了这个错误
tutorial.symblog.co.uk[第 4 部分]
An exception has been thrown during the rendering of a template (“A”__toString()” method was not found on the objects of type”Blogger//BlogBundle//Entity//Blog” passed to the choice field. To read a custom getter instead, set the option”property” to the desired property path.”)
in BloggerBlogBundle:Blog:show.html.twig at line 23.
有人对此有所了解吗?
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
// src/Blogger/BlogBundle/Entity/Blog.php
namespace Blogger//BlogBundle//Entity; use Doctrine//ORM//Mapping as ORM; use Doctrine//Common//Collections//ArrayCollection; /** * @ORM//Entity(repositoryClass="Blogger//BlogBundle//Entity/ epository//BlogRepositorya€?a€?") * @ORM//Table(name="blog") * @ORM//HasLifecycleCallbacks() */ class Blog { //………. public function __toString() { return $this->getTitle(); } } |
只需在
1
2 3 4 5 6 7 8 |
class Blog {
//… function __toString() { |
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/268530.html