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