Skip to content

Commit

Permalink
add column variable
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztof.zylka committed Mar 24, 2023
1 parent 28eeb50 commit b70d655
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Trait/TableSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ trait TableSelect {
* @throws SelectException
* @throws TableException
*/
public function find(null|array $condition = null, ?string $orderBy = null) : array {
$sql = 'SELECT ' . $this->prepareColumnListForSql() . ' FROM `' . $this->getName() . '` ' . implode(', ', $this->prepareBindData());
public function find(null|array $condition = null, ?array $columns = null, ?string $orderBy = null) : array {
$sql = 'SELECT ' . ($columns ?? $this->prepareColumnListForSql()) . ' FROM `' . $this->getName() . '` ' . implode(', ', $this->prepareBindData());

if (!is_null($condition)) {
$sql .= ' WHERE ' . (new Where())->getPrepareConditions($condition);
Expand Down Expand Up @@ -55,8 +55,8 @@ public function find(null|array $condition = null, ?string $orderBy = null) : ar
* @return array
* @throws SelectException
*/
public function findAll(null|array $condition = null, ?string $orderBy = null, ?string $limit = null, ?string $groupBy = null) : array {
$sql = 'SELECT ' . $this->prepareColumnListForSql() . ' FROM `' . $this->getName() . '` ' . implode(', ', $this->prepareBindData());
public function findAll(null|array $condition = null, ?array $columns = null, ?string $orderBy = null, ?string $limit = null, ?string $groupBy = null) : array {
$sql = 'SELECT ' . ($columns ?? $this->prepareColumnListForSql()) . ' FROM `' . $this->getName() . '` ' . implode(', ', $this->prepareBindData());

if (!is_null($condition)) {
$sql .= ' WHERE ' . (new Where())->getPrepareConditions($condition);
Expand Down

0 comments on commit b70d655

Please sign in to comment.