我在Doctrine和Symfony2中遇到这个错误:
无法解析类"ST\UserBundle\Entity\User"的列"id"的类型
统计
class Statistique
{
// ...
// @ORM\ManyToOne(targetEntity="ST\UserBundle\Entity\User")
// @ORM\JoinColumn(name="idPro", referencedColumnName="id")
private $user;
}
Run Code Online (Sandbox Code Playgroud)
用户
use FOS\UserBundle\Model\User as BaseUser;
// @ORM\Table(name="tiers_prov3")
class User extends BaseUser
{
/**
* @ORM\Column(name="TIE_ID", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="NONE")
*/
protected $id;
// ...
}
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚.
这是我的环境:
我有一个实体:
Object
|____ id (integer)
|____ foo (string)
|____ configurations (collection)
Run Code Online (Sandbox Code Playgroud)
该属性configurations是使用a Configuration映射的实体的集合oneToMany.无论如何,这看起来像这样:
Configuration
|____ id (integer)
|____ bar (string)
|____ name (string, nullable)
Run Code Online (Sandbox Code Playgroud)
我有一个服务来获得一个object:
该服务是一个管理许多项目对象的包.
此服务不知道哪个项目调用它.
此服务是一组过滤器,事件侦听器和SQL查询.(约2K行)
考虑一下我不能/不想更新它的get过程,我想在这里做什么.
我有一个我想在我的控制器中执行的操作,如下所示:
$objMgr = $this->get('objectManager'); //get my service I talked before
$object = $objMgr->findOneById(); //get my object
return array('object' => $object);// render template
Run Code Online (Sandbox Code Playgroud)
我有很多主题管理最终用户屏幕,每个主题都有一个twig文件:
theme1
|____ object_details.html.twig
theme2
|____ object_details.html.twig
themeX
|____ object_details.html.twig
Run Code Online (Sandbox Code Playgroud)
这些object_details.html.twig代码用于打印配置.
{% for config in object.configurations %} …Run Code Online (Sandbox Code Playgroud)