Php Symfony 2:ContextErrorException:注意:serialize():";url";作为成员变量从_sleep()返回,但在中不存在
我在一个已经开始的项目中工作,我在继续,我在实体中添加属性时遇到了这个异常,这个属性是一个简单的列,从另一个实体(personnal)获取它的值,它是一个多选值,新页面的呈现没有问题,但是当我提交时,我遇到了这个异常,我添加的字段如下:Php Symfony 2:ContextErrorException:注意:serialize():";url";作为成员变量从_sleep()返回,但在中不存在,php,symfony,Php,Symfony,我在一个已经开始的项目中工作,我在继续,我在实体中添加属性时遇到了这个异常,这个属性是一个简单的列,从另一个实体(personnal)获取它的值,它是一个多选值,新页面的呈现没有问题,但是当我提交时,我遇到了这个异常,我添加的字段如下: /** * @var array * * @ORM\Column(name="responsable",type="array", nullable=true) * */ private $responsable; /** * Add re
/**
* @var array
*
* @ORM\Column(name="responsable",type="array", nullable=true)
*
*/
private $responsable;
/**
* Add responsable
*
* @param $responsable
* @return Actionreclamation
*/
public function addResponsable($responsable)
{
if (!in_array($responsable, $this->responsable, true)) {
$this->responsable[] = $responsable;
}
return $this;
}
/**
* Remove responsable
*
* @param $responsable
*/
public function removeResponsable( $responsable)
{
// $this->responsable->removeElement($responsable);
if (false !== $key = array_search($responsable, $this->responsable, true)) {
unset($this->responsable[$key]);
$this->responsable = array_values($this->responsable);
}
return $this;
}
/**
* Get responsable
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getResponsable()
{
return $this->responsable;
}
/**
* Set responsable
*
* @param array $responsable
* @return Actionreclamation
*/
public function setResponsable($responsable)
{
$this->responsable = $responsable;
return $this;
}
在表单类型中:
->add('responsable', 'entity', array(
'class' => 'UserUserBundle:Personnel',
'property' => 'nompersonnel',
'multiple' => true ))
在视图内部:
<div class="form-group">
<label class="col-md-3 control-label">Responsable</label>
<div class="col-md-6">
<div class="input-icon right">
<i class="fa"></i>
{{ form_widget(form.responsable) }}
</div>
<span class="help-block">{{ form_errors(form.responsable) }}</span>
</div>
</div>
先走一步
“编辑”
主实体名为“ActionReconvernance”,它有一个名为“responsable”的字段(简单列,与数据库中的varchar没有关系)。该字段的值是从另一个名为“Personal”的实体返回的,在视图中,我显示了“Personal”实体的值,我可以选择多个值
我解释得好吗?
thanx寻求帮助您的模型似乎已经进化,您从一个类(responsible)中删除了一个“url”属性
因此,当Dority尝试取消序列化您的值(存储为“数组”类型)时,他不知道如何处理此“url”属性…您也可以尝试以下操作:
php bin/console doctrine:mongodb:generate:hydrators
在其他字段中插入值时,我有一个apload字段,如果我将光标放在upload字段中,然后提交,我会得到此异常,如果我不碰它,我会得到相同的异常,但另一个字段的名称是“matricule”ContextErrorException:注意:serialize():“MatriculePersonal”作为成员变量从uu sleep()返回,但在C:\wamp\www\GESTIBAT0.1\vendor\doctrine\dbal\lib\doctrine\dbal\Types\ArrayType.php第38行中不存在。您可以编辑您的帖子,为您的实体添加您的条令映射信息吗?如果我需要发布一些东西来澄清问题,请告诉我,请详细说明OP有什么问题,以及这是如何解决的。Yann Eugoné说,问题是模型已经修改。我也遇到了这个问题,通过生成水合器和代理来更新水合器和代理,解决了这个问题。对我来说,它就像一个符咒:)
php bin/console doctrine:mongodb:generate:hydrators