Fix LP creation: Items tree

pull/4312/head
Angel Fernando Quiroz Campos 3 years ago
parent 7e6df1e544
commit 2da837d8ea
  1. 2
      src/CourseBundle/Entity/CLp.php
  2. 9
      src/CourseBundle/Entity/CLpItem.php

@ -203,7 +203,7 @@ class CLp extends AbstractResource implements ResourceInterface, ResourceShowCou
protected int $accumulateWorkTime; protected int $accumulateWorkTime;
/** /**
* @var Collection|CLpItem[] * @var Collection
* *
* @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CLpItem", mappedBy="lp", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CLpItem", mappedBy="lp", cascade={"persist", "remove"}, orphanRemoval=true)
*/ */

@ -127,12 +127,18 @@ class CLpItem
protected ?float $prerequisiteMaxScore = null; protected ?float $prerequisiteMaxScore = null;
/** /**
* @Gedmo\TreeRoot
* @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLp", inversedBy="items", cascade={"persist", "remove"}) * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLp", inversedBy="items", cascade={"persist", "remove"})
* @ORM\JoinColumn(name="lp_id", referencedColumnName="iid", onDelete="CASCADE") * @ORM\JoinColumn(name="lp_id", referencedColumnName="iid", onDelete="CASCADE")
*/ */
protected CLp $lp; protected CLp $lp;
/**
* @Gedmo\TreeRoot
* @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLpItem")
* @ORM\JoinColumn(name="item_root", referencedColumnName="iid", onDelete="CASCADE")
*/
protected ?CLpItem $root = null;
/** /**
* @Gedmo\TreeParent * @Gedmo\TreeParent
* @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLpItem", inversedBy="children", cascade={"persist"}) * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLpItem", inversedBy="children", cascade={"persist"})
@ -141,7 +147,6 @@ class CLpItem
protected ?CLpItem $parent = null; protected ?CLpItem $parent = null;
/** /**
* @var Collection|CLpItem[]
* @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CLpItem", mappedBy="parent") * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CLpItem", mappedBy="parent")
*/ */
protected Collection $children; protected Collection $children;

Loading…
Cancel
Save