Пример #1
0
 /**
  * {@inheritdoc}
  *
  * @param \Illuminate\Database\ConnectionInterface   $db
  * @param \rsanchez\Deep\Collection\EntryCollection  $collection
  * @param \rsanchez\Deep\Hydrator\HydratorCollection $hydrators
  * @param string                                     $fieldtype
  * @param \rsanchez\Deep\Model\GridCol               $colModel
  * @param \rsanchez\Deep\Model\GridRow               $rowModel
  */
 public function __construct(ConnectionInterface $db, EntryCollection $collection, HydratorCollection $hydrators, $fieldtype, GridCol $colModel, GridRow $rowModel)
 {
     parent::__construct($db, $collection, $hydrators, $fieldtype);
     $this->colModel = $colModel;
     $this->rowModel = $rowModel;
     $fieldIds = $collection->getFieldIdsByFieldtype($fieldtype);
     $this->cols = $this->colModel->fieldId($fieldIds)->orderBy('col_order')->get();
     foreach ($this->cols as $col) {
         if (!isset($this->sortedCols[$col->field_id])) {
             $this->sortedCols[$col->field_id] = new GridColCollection();
         }
         $this->sortedCols[$col->field_id]->push($col);
     }
     $collection->setGridCols($this->cols);
 }
Пример #2
0
 public function testFieldIdScope()
 {
     $query = GridCol::fieldId(12)->get();
     $this->assertThat($query->fetch('col_id')->all(), new ArrayHasOnlyValuesConstraint([1, 2, 3]));
 }