/** * {@inheritdoc} */ public function preload(array $entryIds) { $this->rows = $this->rowModel->entryId($entryIds)->orderBy('row_order')->get(); foreach ($this->rows as $row) { if (!isset($this->sortedRows[$row->entry_id][$row->field_id])) { $this->sortedRows[$row->entry_id][$row->field_id] = new MatrixRowCollection(); } $cols = isset($this->sortedCols[$row->field_id]) ? $this->sortedCols[$row->field_id] : new MatrixColCollection(); $row->setCols($cols); $this->sortedRows[$row->entry_id][$row->field_id]->push($row); } }
public function testEntryIdScope() { $query = MatrixRow::entryId(8)->get(); $this->assertThat($query->fetch('row_id')->all(), new ArrayHasOnlyValuesConstraint([2, 3])); }