1
0
Fork 0
mirror of synced 2025-04-10 04:21:01 +00:00

fix serialization annotation

This commit is contained in:
Alex Lushpai 2019-04-08 14:01:05 +03:00
parent 9e9e2c40fa
commit 9313660225
6 changed files with 55 additions and 46 deletions

View file

@ -40,9 +40,9 @@ class Delivery
private $name;
/**
* @var \RetailCrm\Mg\Bot\Model\Entity\Cost $price
* @var Cost $price
*
* @Type("\RetailCrm\Mg\Bot\Model\Entity\Cost")
* @Type("Cost")
* @Accessor(getter="getPrice",setter="setPrice")
*
* @Assert\Currency
@ -84,7 +84,7 @@ class Delivery
}
/**
* @return \RetailCrm\Mg\Bot\Model\Entity\Cost
* @return Cost
*/
public function getPrice()
{
@ -92,7 +92,7 @@ class Delivery
}
/**
* @param \RetailCrm\Mg\Bot\Model\Entity\Cost $price
* @param Cost $price
*/
public function setPrice(Cost $price)
{

View file

@ -34,8 +34,7 @@ class Order
*
* @Type("string")
* @Accessor(getter="getNumber",setter="setNumber")
*
* @Assert\NotBlank
* @SkipWhenEmpty()
*/
private $number;
@ -58,27 +57,27 @@ class Order
private $date;
/**
* @var \RetailCrm\Mg\Bot\Model\Entity\Cost $cost
* @var Cost $cost
*
* @Type("\RetailCrm\Mg\Bot\Model\Entity\Cost")
* @Type("Cost")
* @Accessor(getter="getCost",setter="setCost")
* @SkipWhenEmpty()
*/
private $cost;
/**
* @var \RetailCrm\Mg\Bot\Model\Entity\Status $status
* @var Status $status
*
* @Type("\RetailCrm\Mg\Bot\Model\Entity\Status")
* @Type("Status")
* @Accessor(getter="getStatus",setter="setStatus")
* @SkipWhenEmpty()
*/
private $status;
/**
* @var \RetailCrm\Mg\Bot\Model\Entity\Delivery $delivery
* @var Delivery $delivery
*
* @Type("\RetailCrm\Mg\Bot\Model\Entity\Delivery")
* @Type("Delivery")
* @Accessor(getter="getDelivery",setter="setDelivery")
* @SkipWhenEmpty()
*/
@ -151,7 +150,7 @@ class Order
}
/**
* @return \RetailCrm\Mg\Bot\Model\Entity\Cost
* @return Cost
*/
public function getCost()
{
@ -159,7 +158,7 @@ class Order
}
/**
* @param \RetailCrm\Mg\Bot\Model\Entity\Cost $cost
* @param Cost $cost
*/
public function setCost(Cost $cost)
{
@ -167,7 +166,7 @@ class Order
}
/**
* @return \RetailCrm\Mg\Bot\Model\Entity\Status
* @return Status
*/
public function getStatus()
{
@ -175,7 +174,7 @@ class Order
}
/**
* @param \RetailCrm\Mg\Bot\Model\Entity\Status $status
* @param Status $status
*/
public function setStatus(Status $status)
{
@ -183,7 +182,7 @@ class Order
}
/**
* @return \RetailCrm\Mg\Bot\Model\Entity\Delivery
* @return Delivery
*/
public function getDelivery()
{
@ -191,7 +190,7 @@ class Order
}
/**
* @param \RetailCrm\Mg\Bot\Model\Entity\Delivery $delivery
* @param Delivery $delivery
*/
public function setDelivery(Delivery $delivery)
{

View file

@ -57,18 +57,18 @@ class OrderItem
private $img;
/**
* @var \RetailCrm\Mg\Bot\Model\Entity\Cost $price
* @var Cost $price
*
* @Type("\RetailCrm\Mg\Bot\Model\Entity\Cost")
* @Type("Cost")
* @Accessor(getter="getPrice",setter="setPrice")
* @SkipWhenEmpty()
*/
private $price;
/**
* @var \RetailCrm\Mg\Bot\Model\Entity\Quantity $quantity
* @var Quantity $quantity
*
* @Type("\RetailCrm\Mg\Bot\Model\Entity\Quantity")
* @Type("Quantity")
* @Accessor(getter="getQuantity",setter="setQuantity)
* @SkipWhenEmpty()
*/
@ -123,7 +123,7 @@ class OrderItem
}
/**
* @return \RetailCrm\Mg\Bot\Model\Entity\Cost
* @return Cost
*/
public function getPrice()
{
@ -131,7 +131,7 @@ class OrderItem
}
/**
* @param \RetailCrm\Mg\Bot\Model\Entity\Cost $price
* @param Cost $price
*/
public function setPrice(Cost $price)
{
@ -139,7 +139,7 @@ class OrderItem
}
/**
* @return \RetailCrm\Mg\Bot\Model\Entity\Quantity
* @return Quantity
*/
public function getQuantity()
{
@ -147,7 +147,7 @@ class OrderItem
}
/**
* @param \RetailCrm\Mg\Bot\Model\Entity\Quantity $quantity
* @param Quantity $quantity
*/
public function setQuantity(Quantity $quantity)
{

View file

@ -39,18 +39,18 @@ class Payment
private $name;
/**
* @var \RetailCrm\Mg\Bot\Model\Entity\PaymentStatus $status
* @var PaymentStatus $status
*
* @Type("\RetailCrm\Mg\Bot\Model\Entity\PaymentStatus")
* @Type("PaymentStatus")
* @Accessor(getter="getStatus",setter="setStatus")
* @SkipWhenEmpty()
*/
private $status;
/**
* @var \RetailCrm\Mg\Bot\Model\Entity\Cost $amount
* @var Cost $amount
*
* @Type("\RetailCrm\Mg\Bot\Model\Entity\Cost")
* @Type("Cost")
* @Accessor(getter="getAmount",setter="setAmount")
* @SkipWhenEmpty()
*/
@ -73,7 +73,7 @@ class Payment
}
/**
* @return \RetailCrm\Mg\Bot\Model\Entity\PaymentStatus
* @return PaymentStatus
*/
public function getStatus()
{
@ -81,7 +81,7 @@ class Payment
}
/**
* @param \RetailCrm\Mg\Bot\Model\Entity\PaymentStatus $status
* @param PaymentStatus $status
*/
public function setStatus(PaymentStatus $status)
{
@ -89,7 +89,7 @@ class Payment
}
/**
* @return \RetailCrm\Mg\Bot\Model\Entity\Cost
* @return Cost
*/
public function getAmount()
{
@ -97,7 +97,7 @@ class Payment
}
/**
* @param \RetailCrm\Mg\Bot\Model\Entity\Cost $amount
* @param Cost $amount
*/
public function setAmount(Cost $amount)
{

View file

@ -34,8 +34,7 @@ class Product
*
* @Type("int")
* @Accessor(getter="getId",setter="setId")
*
* @Assert\NotBlank
* @SkipWhenEmpty()
*/
private $id;
@ -44,8 +43,7 @@ class Product
*
* @Type("string")
* @Accessor(getter="getName",setter="setName")
*
* @Assert\NotBlank
* @SkipWhenEmpty()
*/
private $name;
@ -77,18 +75,18 @@ class Product
private $img;
/**
* @var \RetailCrm\Mg\Bot\Model\Entity\Cost $cost
* @var Cost $cost
*
* @Type("\RetailCrm\Mg\Bot\Model\Entity\Cost")
* @Type("Cost")
* @Accessor(getter="getCost",setter="setCost")
* @SkipWhenEmpty()
*/
private $cost;
/**
* @var \RetailCrm\Mg\Bot\Model\Entity\Quantity $quantity
* @var Quantity $quantity
*
* @Type("\RetailCrm\Mg\Bot\Model\Entity\Quantity")
* @Type("Quantity")
* @Accessor(getter="getQuantity",setter="setQuantity)
* @SkipWhenEmpty()
*/
@ -175,7 +173,7 @@ class Product
}
/**
* @return \RetailCrm\Mg\Bot\Model\Entity\Cost
* @return Cost
*/
public function getCost()
{
@ -183,7 +181,7 @@ class Product
}
/**
* @param \RetailCrm\Mg\Bot\Model\Entity\Cost $cost
* @param Cost $cost
*/
public function setCost(Cost $cost)
{
@ -191,7 +189,7 @@ class Product
}
/**
* @return \RetailCrm\Mg\Bot\Model\Entity\Quantity
* @return Quantity
*/
public function getQuantity()
{
@ -199,7 +197,7 @@ class Product
}
/**
* @param \RetailCrm\Mg\Bot\Model\Entity\Quantity $quantity
* @param Quantity $quantity
*/
public function setQuantity(Quantity $quantity)
{

View file

@ -126,6 +126,7 @@ class Request
$response = Response::parseJSON($responseBody);
$errorMessage = !empty($response['errorMsg']) ? $response['errorMsg'] : '';
$errorMessage = !empty($response['errors']) ? $this->getErrors($response['errors']) : $errorMessage;
/**
* responses with 400 & 460 http codes contains extended error data
@ -190,4 +191,15 @@ class Request
throw new InvalidArgumentException($message);
}
}
private function getErrors(array $errors)
{
$errorString = '';
foreach ($errors as $error) {
$errorString .= $error . " ";
}
return $errorString;
}
}