-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
5996 - Brandingtool-specific functionality (#303)
functionality to support brandingtool-faucet
- Loading branch information
Showing
8 changed files
with
139 additions
and
6 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
21 changes: 21 additions & 0 deletions
21
src/Data/ProgrammesDb/EntityRepository/MasterBrandRepository.php
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,21 @@ | ||
<?php | ||
|
||
namespace BBC\ProgrammesPagesService\Data\ProgrammesDb\EntityRepository; | ||
|
||
use Doctrine\ORM\EntityRepository; | ||
use Doctrine\ORM\Query; | ||
|
||
class MasterBrandRepository extends EntityRepository | ||
{ | ||
public function findByMid(string $mid): ?array | ||
{ | ||
$qb = $this->createQueryBuilder('master_brand') | ||
->addSelect(['master_brand', 'network', 'service']) | ||
->leftJoin('master_brand.network', 'network') | ||
->leftJoin('network.defaultService', 'service') | ||
->andWhere('master_brand.mid = :mid') | ||
->setParameter('mid', $mid); | ||
|
||
return $qb->getQuery()->getOneOrNullResult(Query::HYDRATE_ARRAY); | ||
} | ||
} |
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
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,31 @@ | ||
<?php | ||
|
||
namespace BBC\ProgrammesPagesService\Service; | ||
|
||
use BBC\ProgrammesCachingLibrary\CacheInterface; | ||
use BBC\ProgrammesPagesService\Data\ProgrammesDb\EntityRepository\MasterBrandRepository; | ||
use BBC\ProgrammesPagesService\Domain\Entity\MasterBrand; | ||
use BBC\ProgrammesPagesService\Mapper\ProgrammesDbToDomain\MasterBrandMapper; | ||
|
||
class MasterBrandsService extends AbstractService | ||
{ | ||
/* @var MasterBrandMapper */ | ||
protected $mapper; | ||
/* @var MasterBrandRepository */ | ||
protected $repository; | ||
|
||
public function __construct( | ||
MasterBrandRepository $repository, | ||
MasterBrandMapper $mapper, | ||
CacheInterface $cache | ||
) { | ||
parent::__construct($repository, $mapper, $cache); | ||
} | ||
|
||
public function findByMid($mid): ?MasterBrand | ||
{ | ||
$result = $this->repository->findByMid($mid); | ||
|
||
return $this->mapSingleEntity($result); | ||
} | ||
} |
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