Rejected or canceled reservations, comments
This commit is contained in:
@ -4,6 +4,7 @@ namespace Incoviba\Repository\Venta;
|
||||
use DateTimeInterface;
|
||||
use DateInterval;
|
||||
use Incoviba\Common\Define;
|
||||
use Incoviba\Common\Implement\Exception\EmptyResult;
|
||||
use Incoviba\Exception\Model\InvalidState;
|
||||
use PDO;
|
||||
use Incoviba\Common;
|
||||
@ -29,7 +30,7 @@ class Reservation extends Common\Ideal\Repository
|
||||
|
||||
public function create(?array $data = null): Model\Venta\Reservation
|
||||
{
|
||||
$map = (new Common\Implement\Repository\MapperParser())
|
||||
$map = (new Common\Implement\Repository\MapperParser(['comments']))
|
||||
->register('project_id', (new Common\Implement\Repository\Mapper())
|
||||
->setProperty('project')
|
||||
->setFunction(function($data) {
|
||||
@ -114,13 +115,16 @@ class Reservation extends Common\Ideal\Repository
|
||||
|
||||
/**
|
||||
* @param int $project_id
|
||||
* @param int $state
|
||||
* @param int|string $state
|
||||
* @return array
|
||||
* @throws Common\Implement\Exception\EmptyResult
|
||||
* @throws EmptyResult
|
||||
* @throws InvalidState
|
||||
*/
|
||||
public function fetchState(int $project_id, int $state): array
|
||||
public function fetchState(int $project_id, int|string $state): array
|
||||
{
|
||||
if (is_string($state)) {
|
||||
$state = Model\Venta\Reservation\State\Type::from($state)->value;
|
||||
}
|
||||
if (!in_array($state, Model\Venta\Reservation\State\Type::getTypes())) {
|
||||
throw new InvalidState();
|
||||
}
|
||||
|
Reference in New Issue
Block a user