我有以下实体类
<?php
namespace EvolisClientRequest\Model\Entities;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*/
class Email
{
/**
* @var \Ramsey\Uuid\Uuid
* @ORM\Id
* @ORM\Column(type="uuid")
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class="Ramsey\Uuid\Doctrine\UuidGenerator")
*/
protected $id;
/**
* @ORM\Column(type="string")
* @var string
*/
private $sender;
/**
* @ORM\Column(type="string")
* @var string
*/
private $subject;
/**
* @ORM\Column(type="string")
* @var string
*/
private $body;
/**
* @ORM\ManyToMany(targetEntity="Request", mappedBy="Email")
* @var Request
*/
private $request;
public function __construct(string $sender, string $subject, string $body,Request $request)
{
$this->sender = $expeditor;
$this->subject = $subject;
$this->body = $body;
$this->request = $request;
}
}
执行以下操作时会出错:
$email = $this->email_dao->create ('srjfjgn@rkgjb.com','fkj','sdfkdjhbf', new \Doctrine\Common\Collections\ArrayCollection($request_dao));
给出错误的行是:
$email = $this->email_dao->create ('srjfjgn@rkgjb.com','fkj','sdfkdjhbf', new \Doctrine\Common\Collections\ArrayCollection($request_dao));
答案 0 :(得分:0)
变量$request_dao
似乎是一个对象。
ArrayCollection
仅接受array
作为构造函数参数。