-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
findFromRawSql: fix COUNT with DISTINCT
- Loading branch information
1 parent
6c56e6a
commit 9e04377
Showing
4 changed files
with
77 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace TheCodingMachine\TDBM\Dao; | ||
|
||
use TheCodingMachine\TDBM\Test\Dao\Bean\AlbumBean; | ||
use TheCodingMachine\TDBM\Test\Dao\Generated\AlbumBaseDao; | ||
|
||
/** | ||
* The AlbumDao class will maintain the persistence of UserBean class into the users table. | ||
*/ | ||
class TestAlbumDao extends AlbumBaseDao | ||
{ | ||
/** | ||
* @return \TheCodingMachine\TDBM\ResultIterator|AlbumBean[] | ||
*/ | ||
public function findAllFromRawSql() | ||
{ | ||
return $this->findFromRawSql('SELECT DISTINCT albums.* FROM albums'); | ||
} | ||
|
||
/** | ||
* @return \TheCodingMachine\TDBM\ResultIterator|AlbumBean[] | ||
*/ | ||
public function findAllFromRawSqlWithCount() | ||
{ | ||
return $this->findFromRawSql( | ||
'SELECT DISTINCT albums.* FROM albums', | ||
[], | ||
'SELECT COUNT(DISTINCT albums.id) FROM albums' | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters