コード例 #1
0
ファイル: FacetManager.php プロジェクト: ngydat/CoreBundle
 /**
  * Creates a new field for a facet
  *
  * @param PanelFacet $facet
  * @param string     $name
  * @param integer    $type
  */
 public function addField(PanelFacet $panelFacet, $name, $type)
 {
     $this->om->startFlushSuite();
     $fieldFacet = new FieldFacet();
     $fieldFacet->setPanelFacet($panelFacet);
     $fieldFacet->setName($name);
     $fieldFacet->setType($type);
     $fieldFacet->setPosition($this->om->count('Claroline\\CoreBundle\\Entity\\Facet\\FieldFacet'));
     $this->initFieldPermissions($fieldFacet);
     $this->om->persist($fieldFacet);
     $this->om->endFlushSuite();
     return $fieldFacet;
 }
コード例 #2
0
 public function reorderChoices(FieldFacet $field)
 {
     $choices = $field->getFieldFacetChoices();
     $order = 0;
     foreach ($choices as $choice) {
         $field->setPosition($order);
         ++$order;
         $this->om->persist($choice);
     }
     $this->om->flush();
 }