コード例 #1
0
 /**
  * Update an existing condition from JSON structure
  *
  * @param  \Innova\PathBundle\Entity\Step               $step               Parent step of the condition
  * @param  \Innova\PathBundle\Entity\StepCondition      $condition          Current condition to edit
  * @return \Innova\PathBundle\Entity\StepCondition                          Edited condition
  */
 public function editStepCondition(Step $step, StepCondition $condition)
 {
     // Update condition properties
     $condition->setStep($step);
     // Save modifications
     $this->om->persist($condition);
     return $condition;
 }
コード例 #2
0
 /**
  * Clean criteriagroups data which no long exist in the current condition
  *
  * @param array $neededCriteriagroup
  * @param array $existingCriteriagroup
  * @param StepCondition $stepCondition
  * @return PublishingManager
  */
 protected function cleanCriteriagroup(array $neededCriteriagroup = array(), array $existingCriteriagroup = array(), StepCondition $stepCondition)
 {
     //echo "inside cleanCriteriagroup<br>\n";
     $toRemove = array_filter($existingCriteriagroup, function (Criteriagroup $current) use($neededCriteriagroup) {
         //echo "inside cleanCriteriagroup closure<br>\n";
         $removeCriteriagroup = true;
         foreach ($neededCriteriagroup as $data) {
             if ($current->getId() == $data->getId()) {
                 $removeCriteriagroup = false;
                 break;
             }
         }
         return $removeCriteriagroup;
     });
     foreach ($toRemove as $criteriagroupToRemove) {
         $stepCondition->removeCriteriagroup($criteriagroupToRemove);
         $this->om->remove($criteriagroupToRemove);
     }
     return $this;
 }
コード例 #3
0
ファイル: Step.php プロジェクト: claroline/distribution
 /**
  * Set condition.
  *
  * @param \Innova\PathBundle\Entity\StepCondition $condition
  *
  * @return Step
  */
 public function setCondition(StepCondition $condition = null)
 {
     if ($condition !== $this->condition) {
         $this->condition = $condition;
         if (null !== $condition) {
             $condition->setStep($this);
         }
     }
     return $this;
 }
コード例 #4
0
 /**
  * Clean Criteria Gorups which no longer exist in the current Condition.
  *
  * @param \Innova\PathBundle\Entity\StepCondition $condition
  * @param array                                   $neededGroups
  * @param array                                   $existingGoups
  *
  * @return \Innova\PathBundle\Manager\Condition\StepConditionManager
  */
 public function cleanCriteriaGroups(StepCondition $condition, array $neededGroups = [], array $existingGoups = [])
 {
     $toRemove = array_filter($existingGoups, function (Criteriagroup $current) use($neededGroups) {
         $removeGroup = true;
         foreach ($neededGroups as $group) {
             if ($current->getId() == $group->getId()) {
                 $removeGroup = false;
                 break;
             }
         }
         return $removeGroup;
     });
     foreach ($toRemove as $groupToRemove) {
         $condition->removeCriteriagroup($groupToRemove);
         $this->om->remove($groupToRemove);
     }
     return $this;
 }
コード例 #5
0
ファイル: Step.php プロジェクト: CPASimUSante/PathBundle
 /**
  * Set condition
  *
  * @param \Innova\PathBundle\Entity\StepCondition $condition
  *
  * @return Step
  */
 public function setCondition(\Innova\PathBundle\Entity\StepCondition $condition = null)
 {
     if ($condition !== $this->condition) {
         $this->condition = $condition;
         if (null !== $condition) {
             $condition->setStep($this);
         }
     }
     return $this;
 }