Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 添加双向关系多对多symfony2_Php_Symfony - Fatal编程技术网

Php 添加双向关系多对多symfony2

Php 添加双向关系多对多symfony2,php,symfony,Php,Symfony,我的包中的两个实体之间存在多对多关系。 我想使这种关系具有双向性。 问题是,在此之后,我将在一个实体上添加一个将另一个实体用作参数的请求: 这在实体A的存储库中 public function findType($type,$superior) { $qb = $this->_em->createQueryBuilder(); $qb->select('a') ->from('xxxBundle:Profile', 'a') ->wher

我的包中的两个实体之间存在多对多关系。 我想使这种关系具有双向性。 问题是,在此之后,我将在一个实体上添加一个将另一个实体用作参数的请求:

这在实体A的存储库中

public function findType($type,$superior)
{

$qb = $this->_em->createQueryBuilder();

  $qb->select('a')
     ->from('xxxBundle:Profile', 'a')
     ->where('a.type = :type')
     ->andwhere('a.entityB = :superior')
     ->setParameter('superior', $superior) 
     ->setParameter('type', $type);


  $entities=$qb->getQuery()->getResult();
  return $entities;
}
我得到以下例外

[Semantical Error] line 0, col 84 near 'entityB = :s': Error: Invalid PathExpression. StateFieldPathExpression or SingleValuedAssociationField expected. 

有什么想法吗????

那么
$type
变量是什么样子的呢?我按照@cheesemacfly建议的链接修复了这个错误,但现在的问题是实体没有保存到数据库中。