Beispiel #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\RelationshipEntry     $model
  */
 public function __construct(ConnectionInterface $db, EntryCollection $collection, HydratorCollection $hydrators, $fieldtype, RelationshipEntry $model)
 {
     parent::__construct($db, $collection, $hydrators, $fieldtype);
     $this->model = $model;
     $this->relationshipCollection = $this->model->siblings($collection->modelKeys())->get();
     foreach ($this->relationshipCollection as $entry) {
         if (!isset($this->entries[$entry->sibling_id])) {
             $this->entries[$entry->sibling_id] = array();
         }
         $this->entries[$entry->sibling_id][] = $entry;
     }
     // add these entry IDs to the main collection
     $collection->addEntryIds($this->relationshipCollection->modelKeys());
 }
Beispiel #2
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);
 }
 /**
  * {@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\RelationshipEntry     $model
  */
 public function __construct(ConnectionInterface $db, EntryCollection $collection, HydratorCollection $hydrators, $fieldtype, RelationshipEntry $model)
 {
     parent::__construct($db, $collection, $hydrators, $fieldtype);
     $this->model = $model;
     $this->relationshipCollection = $this->model->parentEntryId($collection->modelKeys())->orderBy('order')->get();
     foreach ($this->relationshipCollection as $entry) {
         $type = $entry->grid_field_id ? 'grid' : 'entry';
         $entityId = $entry->grid_field_id ? $entry->grid_row_id : $entry->parent_id;
         $propertyId = $entry->grid_field_id ? $entry->grid_col_id : $entry->field_id;
         if (!isset($this->entries[$type][$entityId][$propertyId])) {
             $this->entries[$type][$entityId][$propertyId] = array();
         }
         $this->entries[$type][$entityId][$propertyId][] = $entry;
     }
     // add these entry IDs to the main collection
     $collection->addEntryIds($this->relationshipCollection->modelKeys());
 }
Beispiel #4
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\Repository\UploadPrefRepositoryInterface $uploadPrefRepository
  */
 public function __construct(ConnectionInterface $db, EntryCollection $collection, HydratorCollection $hydrators, $fieldtype, File $model, UploadPrefRepositoryInterface $uploadPrefRepository)
 {
     parent::__construct($db, $collection, $hydrators, $fieldtype);
     $this->model = $model;
     $this->uploadPrefRepository = $uploadPrefRepository;
 }