* pending sms display
This commit is contained in:
@@ -6,7 +6,12 @@ namespace App\Service;
|
||||
|
||||
use App\Entity\Sms;
|
||||
use App\Entity\User;
|
||||
use DateTime;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\OptimisticLockException;
|
||||
use Doctrine\ORM\ORMException;
|
||||
use Exception;
|
||||
use Zend\EventManager\EventManager;
|
||||
|
||||
class SmsStoreService
|
||||
@@ -28,8 +33,9 @@ class SmsStoreService
|
||||
* @param int $direction
|
||||
* @param array $requestData
|
||||
* @return bool
|
||||
* @throws \Doctrine\ORM\ORMException
|
||||
* @throws \Doctrine\ORM\OptimisticLockException
|
||||
* @throws ORMException
|
||||
* @throws OptimisticLockException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function storeSms(string $hashKey, int $direction, array $requestData): bool
|
||||
{
|
||||
@@ -39,7 +45,7 @@ class SmsStoreService
|
||||
$sms->setDirection($direction)
|
||||
->setContactName($requestData['contactName'])
|
||||
->setContactNumber($requestData['contactNumber'])
|
||||
->setOccuredAt(new \DateTime($normalizedDate))
|
||||
->setOccuredAt(new DateTime($normalizedDate))
|
||||
->setOwner($user)
|
||||
->setText($requestData['text']);
|
||||
$this->em->persist($sms);
|
||||
@@ -55,8 +61,8 @@ class SmsStoreService
|
||||
/**
|
||||
* @param string $hashKey
|
||||
* @return User
|
||||
* @throws \Doctrine\ORM\ORMException
|
||||
* @throws \Doctrine\ORM\OptimisticLockException
|
||||
* @throws ORMException
|
||||
* @throws OptimisticLockException
|
||||
*/
|
||||
private function ensureUserExists(string $hashKey): User
|
||||
{
|
||||
@@ -74,4 +80,13 @@ class SmsStoreService
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function getFailedImports(): array
|
||||
{
|
||||
return $this->em->getRepository(Sms::class)->findBy([
|
||||
'parsedAndHandled' => false,
|
||||
], [
|
||||
'occuredAt' => 'ASC'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user