for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* API for Billing
*
* @link https://github.com/hiqdev/billing-hiapi
* @package billing-hiapi
* @license BSD-3-Clause
* @copyright Copyright (c) 2017, HiQDev (http://hiqdev.com/)
*/
namespace hiqdev\billing\hiapi\target;
use hiqdev\php\billing\target\Target;
use hiqdev\yii\DataMapper\components\ConnectionInterface;
use hiqdev\php\billing\target\TargetFactoryInterface;
use hiqdev\yii\DataMapper\query\Specification;
class TargetRepository extends \hiqdev\yii\DataMapper\repositories\BaseRepository
{
* @var TargetFactoryInterface
protected $factory;
public function __construct(
ConnectionInterface $db,
TargetFactoryInterface $factory,
array $config = []
) {
parent::__construct($config);
$this->db = $db;
$this->factory = $factory;
}
public function findOneById($id): ?Target
return $this->findOne((new Specification())->andWhere(['id' => $id]));