* some minor fixes
This commit is contained in:
parent
11634b4402
commit
6f5e7e073e
@ -52,7 +52,7 @@
|
||||
"clear-config-cache": "php bin/clear-config-cache.php",
|
||||
"cs-check": "phpcs",
|
||||
"cs-fix": "phpcbf",
|
||||
"serve": "php -S 0.0.0.0:8080 -t public public/index.php",
|
||||
"serve": "php -S 0.0.0.0:8888 -t public public/index.php",
|
||||
"test": "phpunit --colors=always",
|
||||
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
|
||||
"upload-coverage": "coveralls -v"
|
||||
|
||||
@ -32,10 +32,10 @@ return [
|
||||
// 'day' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
|
||||
// 'hour' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
|
||||
// 'minute' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
|
||||
'month' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
|
||||
// 'month' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
|
||||
// 'quarter' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
|
||||
// 'second' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
|
||||
'year' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
|
||||
// 'year' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
|
||||
// 'sign' => Oro\ORM\Query\AST\Functions\Numeric\Sign::class,
|
||||
// 'pow' => Oro\ORM\Query\AST\Functions\Numeric\Pow::class,
|
||||
],
|
||||
@ -53,7 +53,7 @@ return [
|
||||
'event_manager' => [
|
||||
'orm_default' => [
|
||||
'subscribers' => [
|
||||
Gedmo\Timestampable\TimestampableListener::class,
|
||||
// Gedmo\Timestampable\TimestampableListener::class,
|
||||
// 'Gedmo\Tree\TreeListener',
|
||||
// 'Gedmo\SoftDeleteable\SoftDeleteableListener',
|
||||
// 'Gedmo\Translatable\TranslatableListener',
|
||||
|
||||
@ -20,7 +20,7 @@ class StoreAction extends AbstractAction
|
||||
public function create(ServerRequestInterface $request, DelegateInterface $delegate)
|
||||
{
|
||||
$hashKey = $request->getAttribute('hashKey');
|
||||
$direction = $request->getAttribute('direction','received');
|
||||
$direction = $request->getAttribute('direction');
|
||||
$mappedDirection = Sms::MAP_DIRECTIONS[$direction];
|
||||
$requestData = $this->getRequestData($request);
|
||||
$isStored = $this->smsStore->storeSms($hashKey, $mappedDirection, $requestData);
|
||||
|
||||
@ -38,6 +38,7 @@ class ConfigProvider
|
||||
],
|
||||
'factories' => [
|
||||
Action\HomePageAction::class => Action\HomePageFactory::class,
|
||||
Action\StoreAction::class => Action\StoreFactory::class,
|
||||
|
||||
Service\SmsStoreService::class => Service\SmsStoreServiceFactory::class,
|
||||
],
|
||||
|
||||
@ -12,7 +12,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
* indexes={
|
||||
* @ORM\Index(name="contact_name", columns={"contact_name"}),
|
||||
* @ORM\Index(name="contact_number", columns={"contact_number"}),
|
||||
* @ORM\Index(name="when", columns={"when"}),
|
||||
* @ORM\Index(name="occured_at", columns={"occured_at"}),
|
||||
* @ORM\Index(name="direction", columns={"direction"})
|
||||
* }
|
||||
* )
|
||||
@ -56,10 +56,10 @@ class Sms implements \JsonSerializable
|
||||
private $text;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="when", type="datetime", nullable=false)
|
||||
* @ORM\Column(name="occured_at", type="datetime", nullable=false)
|
||||
* @var \DateTime
|
||||
*/
|
||||
private $when;
|
||||
private $occuredAt;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="direction", type="integer", length=255, nullable=false)
|
||||
@ -149,18 +149,18 @@ class Sms implements \JsonSerializable
|
||||
/**
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getWhen(): \DateTime
|
||||
public function getOccuredAt(): \DateTime
|
||||
{
|
||||
return $this->when;
|
||||
return $this->occuredAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime $when
|
||||
* @param \DateTime $occuredAt
|
||||
* @return Sms
|
||||
*/
|
||||
public function setWhen(\DateTime $when): Sms
|
||||
public function setOccuredAt(\DateTime $occuredAt): Sms
|
||||
{
|
||||
$this->when = $when;
|
||||
$this->occuredAt = $occuredAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ class Sms implements \JsonSerializable
|
||||
'contactName' => $this->getContactName(),
|
||||
'contactNumber' => $this->getContactNumber(),
|
||||
'text' => $this->getText(),
|
||||
'when' => $this->getWhen(),
|
||||
'when' => $this->getOccuredAt(),
|
||||
'direction' => $this->getDirection(),
|
||||
'owner' => $this->getOwner(),
|
||||
];
|
||||
|
||||
@ -10,10 +10,8 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
* @ORM\Table(
|
||||
* name="user",
|
||||
* indexes={
|
||||
* @ORM\Index(name="contact_name", columns={"contact_name"}),
|
||||
* @ORM\Index(name="contact_number", columns={"contact_number"}),
|
||||
* @ORM\Index(name="when", columns={"when"}),
|
||||
* @ORM\Index(name="direction", columns={"direction"})
|
||||
* @ORM\Index(name="name", columns={"name"}),
|
||||
* @ORM\Index(name="hash_key", columns={"hash_key"}),
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
@ -40,7 +38,7 @@ class User implements \JsonSerializable
|
||||
private $hashKey;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Fault", mappedBy="institute")
|
||||
* @ORM\OneToMany(targetEntity="Sms", mappedBy="owner")
|
||||
* @var Sms[]|ArrayCollection
|
||||
*/
|
||||
private $smsMessages;
|
||||
|
||||
@ -27,7 +27,7 @@ class SmsStoreService
|
||||
$sms->setDirection($direction)
|
||||
->setContactName($requestData['contactName'])
|
||||
->setContactNumber($requestData['contactNumber'])
|
||||
->setWhen($requestData['when'])
|
||||
->setOccuredAt(new \DateTime($requestData['when']))
|
||||
->setOwner($user)
|
||||
->setText($requestData['text']);
|
||||
$this->em->persist($sms);
|
||||
@ -49,7 +49,7 @@ class SmsStoreService
|
||||
|
||||
if($user === null) {
|
||||
$user = new User();
|
||||
$user->setHashKey($hashKey);
|
||||
$user->setHashKey($hashKey)->setName("Unknown");
|
||||
$this->em->persist($user);
|
||||
$this->em->flush();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user