无法确定“AppBundle \ Entity”类中属性“技能”的访问类型

时间:2018-01-15 20:38:29

标签: symfony doctrine-orm

我在2个实体中制作了很多地图,但我有这个错误:

  

无法确定“AppBundle \ Entity \”类中属性“技能”的访问类型。

代码实体公司:

/**
           * @var SkillInterface[]
           *
           * @ORM\ManyToMany(targetEntity="Skill", inversedBy="companys", cascade={"all"})
           * @ORM\JoinTable(name="companys_has_skills",
           *   joinColumns={
           *     @ORM\JoinColumn(name="company_id", referencedColumnName="id")
           *   },
           *   inverseJoinColumns={
           *     @ORM\JoinColumn(name="skill_id", referencedColumnName="id")
           *   }
           * )
           * @Assert\Count(min = 1)
           */
          private $skills;

          public function __construct()
          {
              $this->skills = new ArrayCollection();
          }


           /**
           * Add skills.
           *
           * @param SkillInterface $skills
           *
           * @return Company
           */
          public function addSkills(\AppBundle\Entity\Skill $skills)
          {
              $this->skills[] = $skills;

              return $this;
          }

          /**
           * Remove skills.
           *
           * @param SkillInterface $skills
           */
          public function removeSkills(\AppBundle\Entity\Skill $skills)
          {
              $this->skills->removeElement($skills);
          }

          /**
           * Get skills.
           *
           * @return Collection
           */
          public function getSkills()
          {
              return $this->skills;
          }

代码实体技能:

/**
                * @var Collection
                *
                * @ORM\ManyToMany(targetEntity="Company", mappedBy="skills")
                */
               private $companys;

                /**
                * Constructor.
                */
               public function __construct()
               {
                   $this->companys = new ArrayCollection();

               }

               /**
                * Add company.
                *
                * @param \AppBundle\Entity\Company $company
                *
                * @return Skill
                */
               public function addCompany(\AppBundle\Entity\Company $company)
               {
                   $this->companys[] = $company;

                   return $this;
               }

               /**
                * Remove company.
                *
                * @param \AppBundle\Entity\Company $company
                */
               public function removeCompany(\AppBundle\Entity\Company $company)
               {
                   $this->companys->removeElement($company);
               }

               /**
                * Get companys.
                *
                * @return \Doctrine\Common\Collections\Collection
                */
               public function getCompanys()
               {
                   return $this->companys;
               }

现在我在2个实体中创建删除,添加和获取变量的功能,但我也有错误,我初始化为arrayCollection

1 个答案:

答案 0 :(得分:0)

功能名称应为removeSkill,而s不应为wsData.Range("A1:BZ1").AutoFilter 1, Criteria1:=Array(summaryData.Range("D3").Value, summaryData.Range("F3").Value, summaryData.Range("H3").Value, summaryData.Range("J3").Value, summaryData.Range("L2").Value), Operator:=xlFilterValues wsData.Range("A1:BZ1").AutoFilter 75, "Added" wsData.Range("A1:BZ1").AutoFilter 76, "Delivery Date Moved Out" wsData.Range("A1:BZ1").AutoFilter 24, "Inside LT" wsData.Range("A1:BZ1").AutoFilter 4, IIf(Trim(summaryData.Range("Q4").Value) = "", "<>", "=") & summaryData.Range("Q4").Value wsData.Range("A1:BZ1").AutoFilter 3, IIf(Trim(summaryData.Range("Q5").Value) = "", "<>", "=") & summaryData.Range("Q5").Value wsData.Range("A1:BZ1").AutoFilter 5, IIf(Trim(summaryData.Range("Q6").Value) = "", "<>", "=") & summaryData.Range("Q6").Value wsData.Range("A1:BZ1").AutoFilter 6, IIf(Trim(summaryData.Range("Q7").Value) = "", "<>", "=") & summaryData.Range("Q7").Value wsData.Range("A1:BZ1").AutoFilter 7, IIf(Trim(summaryData.Range("Q8").Value) = "", "<>", "=") & summaryData.Range("Q8").Value wsData.Range("A1:BZ1").AutoFilter 8, IIf(Trim(summaryData.Range("Q9").Value) = "", "<>", "=") & summaryData.Range("Q9").Value wsData.Range("A1:BZ1").AutoFilter 9, IIf(Trim(summaryData.Range("Q10").Value) = "", "<>", "=") & summaryData.Range("Q10").Value wsData.Range("A1:BZ1").AutoFilter 10, IIf(Trim(summaryData.Range("Q11").Value) = "", "<>", "=") & summaryData.Range("Q11").Value wsData.Range("A1:BZ1").AutoFilter 11, IIf(Trim(summaryData.Range("Q12").Value) = "", "<>", "=") & summaryData.Range("Q12").Value