コード例 #1
0
ファイル: StateView.php プロジェクト: Thoronir42/G-archive
 public function __construct(States $states, Colors $colors)
 {
     parent::__construct();
     $this->states = $states;
     $this->ordered = $this->states->findBy([], ['sequence' => 'ASC']);
     $this->colors = $colors;
 }
コード例 #2
0
ファイル: Initialiser.php プロジェクト: Thoronir42/G-archive
 private function addState($order, $label)
 {
     $previous = $this->states->findOneBy(['label' => $label]);
     if ($previous) {
         $this->messages[] = "~ State '{$label}' already exists and was not added.";
         return;
     }
     $state = new State();
     $state->sequence = $order;
     $state->label = $label;
     $this->states->save($state, false);
     $this->messages[] = "+ Addomg state '{$label}'.";
 }
コード例 #3
0
 public function handleSort()
 {
     $order = $this->getParameter('sort');
     foreach ($order as $sequence => $id) {
         /** @var State $state */
         $state = $this->states->find($id);
         $state->sequence = $sequence + 1;
         $this->states->save($state, false);
     }
     $this->states->flush();
 }