1234567891011121314151617181920212223242526 |
- <?php
- namespace StatsBundle\Repository;
- class OnuRepository extends \Doctrine\ORM\EntityRepository
- {
- /**
- * @param string $customId
- *
- * @return Onu|null
- */
- public function findByCustomId($customId)
- {
- list($ponSerialNumber, $oltDeviceId, $deviceServerId) = explode('~', $customId);
- $qb = $this->createQueryBuilder('Onu')
- ->join('Onu.deviceServer', 'deviceServer')
- ->where('Onu.ponSerialNumber = :ponSerialNumber')->setParameter('ponSerialNumber', $ponSerialNumber)
- ->andWhere('Onu.oltDeviceId = :oltDeviceId')->setParameter('oltDeviceId', $oltDeviceId)
- ->andWhere('deviceServer.id = :deviceServerId')->setParameter('deviceServerId', $deviceServerId)
- ;
- return $qb->getQuery()->getOneOrNullResult();
- }
- }
|