symfony映射错误:反向和拥有的side字段不存在 - 即使我在两个类中都声明了它们

I followed the symfony doc here to create bidirectional relationship between two class partgroup(OneToMany) and partsub(ManyToOne)

I get this error message when I try to validate the doctrine schema

* The association Test\MyBundle\Entity\SpareParts\OemPartPosSubText#partgrpidk refers to the inverse side field Test\MyBundle\Entity\SpareParts\OemPartPosGrpText#partgrpidk which is not defined as association.

* The association Test\MyBundle\Entity\SpareParts\OemPartPosSubText#partgrpidk refers to the inverse side field Test\MyBundle\Entity\SpareParts\OemPartPosGrpText#partgrpidk which does not exist.

And

[Mapping]  FAIL - The entity-class 'Test\MyBundle\Entity\SpareParts\OemPartPosGrpText' mapping is invalid:
* The association Test\MyBundle\Entity\SpareParts\OemPartPosGrpText#partsubidk refers to the owning side field Test\MyBundle\Entity\SpareParts\OemPartPosSubText#partsubidk which is not defined as association, but as field.

Code

I tried cache:clear

I have looked everywhere stackholder and google but could not find any resolution.

Your mappings are not correct. Proper mappings should be something like this:

/**
 * OemPartPosGrpText
 *
 * @ORM\Table(name="oem_PartPosGrpText")
 * @ORM\Entity(repositoryClass="Test\MyBundle\Entity\SpareParts\Repo\SparePartMenuRepository")
 *
 */
class OemPartPosGrpText
{

    /**
     * @var integer
     *
     * @ORM\Column(name="PartGrpIDK", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $partgrpidk;

     /**
     * @ORM\OneToMany(targetEntity="partSubText", mappedBy="partgrp")
     */
    private $partsubs;

    ...


/**
 * oemPartPosSubText
 *
 * @ORM\Table(name="oem_PartPosSubText")
 * @ORM\Entity(repositoryClass="Test\MyBundle\Entity\SpareParts\Repo\SparePartMenuRepository")
 */

 class partSubText
 {

    /**
     * @var integer
     *
     * @ORM\Column(name="PartSubIDK", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $partsubidk;

    /**
     * @ORM\ManytoOne(targetEntity="OemPartPosGrpText",inversedBy="partsubs")
     * @ORM\JoinColumn(name="PartGrpIDK", referencedColumnName="PartGrpIDK")
     */
    private $partgrp;

    ...

(I also modified your property names)