关联字段“ AppBundle \ Entity \ ChequeosRevision#$ idrevision”的类型为“ AppBundle \ Entity \ InfoRevision”的期望值,改为“ integer”。
我遇到了这个问题,我无法在数据库上插入,我让诸如decfault控制器部件,实体和orm之类的文件
默认代码,开机自检信息
*entityManager = $this->getDoctrine()->getManager('model_app');
$chequeo = new ChequeosRevision();
$chequeo->setidRevision($id2);
$chequeo->setOk($ok);
$chequeo->setNok($nok);
$chequeo->setSosp($sospechoso);
$chequeo->setNum($num);
$chequeo->setNcheck($nombre);
$chequeo->setNa($na);
$chequeo->setRep($repeat);
$entityManager->persist($chequeo);
$entityManager->flush();
Next part entity 1
<code>
/**
* @var \AppBundle\Entity\InfoRevision
*
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\InfoRevision")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="idrevision", referencedColumnName="id")
* })
*/
private $idrevision;
/**
* Set idrevision.
*
* @param int $idrevision
*
* @return ChequeosRevision
*/
public function setidRevision($idrevision)
{
$this->idrevision = $idrevision;
return $this;
}
</code>
and the orm
enter code here
<code>
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="AppBundle\Entity\ChequeosRevision" table="chequeos_revision">
<indexes>
<index name="idrevision" columns="idrevision"/>
</indexes>
<id name="id" type="integer" column="id">
<generator strategy="IDENTITY"/>
</id>
<field name="ok" type="boolean" column="ok" nullable="false"/>
<field name="nok" type="boolean" column="nok" nullable="false"/>
<field name="sosp" type="boolean" column="sosp" nullable="false"/>
<field name="num" type="boolean" column="num" nullable="false"/>
<field name="ncheck" type="string" column="ncheck" length="255" nullable="false">
<options>
<option name="fixed"/>
</options>
</field>
<field name="na" type="boolean" column="na" nullable="false"/>
<field name="rep" type="boolean" column="rep" nullable="false"/>
<many-to-one field="idrevision" target-entity="InfoRevision" fetch="LAZY">
<join-columns>
<join-column name="idrevision" referenced-column-name="id"/>
</join-columns>
</many-to-one>
</entity>
</doctrine-mapping>
</code>*