/** * @return mixed */ protected function executeAggregate() { $this->sql->addTables([$this->mapper->getTable()]); if ($this->mapper->supportsSoftDelete()) { if (!$this->withSoftDeleted) { $this->where('deleted_at')->isNull(); } elseif ($this->onlySoftDeleted) { $this->where('deleted_at')->notNull(); } } $connection = $this->manager->getConnection(); $compiler = $connection->getCompiler(); return $connection->column($compiler->select($this->sql), $compiler->getParams()); }
protected function hydrate() { if (!$this->dehidrated) { return; } $pk = $this->mapper->getPrimaryKey(); $select = new Select($this->manager->getConnection(), $this->mapper->getTable()); $columns = $select->where($pk)->is($this->rawColumns[$pk])->select()->fetchAssoc()->first(); if ($columns === false) { $this->deleted = true; return; } $this->rawColumns = $columns; $this->columns = []; $this->dehidrated = false; }