Skip to content

Instantly share code, notes, and snippets.

@tonydub
Forked from gquemener/Repository.php
Created August 26, 2018 21:43
Show Gist options
  • Save tonydub/5e6d9f86525b29dc05b825cc2f0be6df to your computer and use it in GitHub Desktop.
Save tonydub/5e6d9f86525b29dc05b825cc2f0be6df to your computer and use it in GitHub Desktop.
<?php
class Repository
{
public function findAll(): array
{
return $this->connection->project(
sprintf('SELECT * FROM %s', self::TABLE_NAME),
[],
function(array $row): Domain\MyObject {
return Domain\MyObject::fromState($row);
}
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment