*/ abstract class DAO extends EntityDAO { use EntityWithParent; /** * Get the parent object ID column name */ abstract public function getParentColumn(): string; /** * Instantiate a new DataObject */ public function newDataObject(): Section { return App::make(Section::class); } /** * Get the number of sections matching the configured query */ public function getCount(Collector $query): int { return $query ->getQueryBuilder() ->select($this->primaryKeyColumn) ->count(); } /** * Get a list of sections ids matching the configured query * * @return Collection */ public function getIds(Collector $query): Collection { return $query ->getQueryBuilder() ->select($this->primaryKeyColumn) ->pluck($this->primaryKeyColumn); } /** * Get a collection of sections matching the configured query * @return LazyCollection */ public function getMany(Collector $query): LazyCollection { $rows = $query ->getQueryBuilder() ->get(); return LazyCollection::make(function () use ($rows) { foreach ($rows as $row) { yield $row->{$this->primaryKeyColumn} => $this->fromRow($row); } }); } public function insert(Section $section): int { return parent::_insert($section); } public function update(Section $section) { parent::_update($section); } public function delete(Section $section) { parent::_delete($section); } }