for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the BenGorFile package.
*
* (c) Beñat Espiña <[email protected]>
* (c) Gorka Laucirica <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace BenGorFile\File\Infrastructure\Persistence\Sql;
use BenGorFile\File\Domain\Model\FileName;
/**
* @author Mikel Etxebarria <[email protected]>
class SqlByNameSpecification implements SqlQuerySpecification
{
private $name;
public function __construct(FileName $aName)
$this->name = $aName;
}
public function buildQuery()
$query = 'SELECT * FROM file f WHERE f.name = :name AND f.extension = :extension';
$parameters = [":name" => $this->name->name(), ":extension" => $this->name->extension()];
return [$query, $parameters];