This repository has been archived by the owner on Jan 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add delete rows request and minor fixes * changed README.md and CHANGELOG.md * add clear table request * move WhereCondition to new namespace * recreate WhereCondition in old namespace to not break backward compatibility * modify CHANGELOG.md * add rows count request * add get table summary and details
- Loading branch information
Showing
32 changed files
with
1,746 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/Enum/DataTablesDeleteRowsPostRequest/FilterOperator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Citilink\ExpertSenderApi\Enum\DataTablesDeleteRowsPostRequest; | ||
|
||
use MyCLabs\Enum\Enum; | ||
|
||
/** | ||
* Filter operator | ||
* | ||
* @method static FilterOperator EQ() | ||
* @method static FilterOperator GT() | ||
* @method static FilterOperator LT() | ||
* @method static FilterOperator GE() | ||
* @method static FilterOperator LE() | ||
* | ||
* @author Nikita Sapogov <[email protected]> | ||
*/ | ||
class FilterOperator extends Enum | ||
{ | ||
/** | ||
* Equals | ||
*/ | ||
const EQ = 'EQ'; | ||
|
||
/** | ||
* Greater than | ||
*/ | ||
const GT = 'GT'; | ||
|
||
/** | ||
* Less than | ||
*/ | ||
const LT = 'LT'; | ||
|
||
/** | ||
* Greater or equals | ||
*/ | ||
const GE = 'GE'; | ||
|
||
/** | ||
* Less or equals | ||
*/ | ||
const LE = 'LE'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Citilink\ExpertSenderApi\Model\DataTablesDeleteRowsPostRequest; | ||
|
||
use Citilink\ExpertSenderApi\Enum\DataTablesDeleteRowsPostRequest\FilterOperator; | ||
use Webmozart\Assert\Assert; | ||
|
||
/** | ||
* Filter for delete many rows | ||
* | ||
* @author Nikita Sapogov <[email protected]> | ||
*/ | ||
class Filter | ||
{ | ||
/** | ||
* @var string Name | ||
*/ | ||
private $name; | ||
|
||
/** | ||
* @var string Value | ||
*/ | ||
private $value; | ||
|
||
/** | ||
* @var FilterOperator Operator | ||
*/ | ||
private $operator; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param string $name Name | ||
* @param FilterOperator $operator Operator | ||
* @param int|string|float $value Value | ||
*/ | ||
public function __construct(string $name, FilterOperator $operator, $value) | ||
{ | ||
Assert::notEmpty($name); | ||
Assert::scalar($value); | ||
$this->name = $name; | ||
$this->value = strval($value); | ||
$this->operator = $operator; | ||
} | ||
|
||
/** | ||
* Get name | ||
* | ||
* @return string Name | ||
*/ | ||
public function getName(): string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
/** | ||
* Get value | ||
* | ||
* @return string Value | ||
*/ | ||
public function getValue(): string | ||
{ | ||
return $this->value; | ||
} | ||
|
||
/** | ||
* Get operator | ||
* | ||
* @return FilterOperator Operator | ||
*/ | ||
public function getOperator(): FilterOperator | ||
{ | ||
return $this->operator; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,74 +4,27 @@ | |
namespace Citilink\ExpertSenderApi\Model\DataTablesGetDataPostRequest; | ||
|
||
use Citilink\ExpertSenderApi\Enum\DataTablesGetDataPostRequest\Operator; | ||
use Webmozart\Assert\Assert; | ||
|
||
/** | ||
* Where condition for get table data | ||
* Where condition | ||
* | ||
* @deprecated Use {@see \Citilink\ExpertSenderApi\Model\WhereCondition} instead | ||
* | ||
* @author Nikita Sapogov <[email protected]> | ||
*/ | ||
class WhereCondition | ||
class WhereCondition extends \Citilink\ExpertSenderApi\Model\WhereCondition | ||
{ | ||
/** | ||
* @var string Column name | ||
*/ | ||
private $columnName; | ||
|
||
/** | ||
* @var Operator Operator | ||
*/ | ||
private $operator; | ||
|
||
/** | ||
* @var string Value | ||
*/ | ||
private $value; | ||
|
||
/** | ||
* Constructor | ||
* Constructor. | ||
* | ||
* @param string $columnName Column name | ||
* @param Operator $operator Operator | ||
* @param string|int|float $value Value | ||
* @param float|int|string $value Value | ||
*/ | ||
public function __construct(string $columnName, Operator $operator, $value) | ||
public function __construct($columnName, Operator $operator, $value) | ||
{ | ||
Assert::scalar($value); | ||
Assert::notEmpty($columnName); | ||
Assert::notEmpty($value); | ||
$this->columnName = $columnName; | ||
$this->operator = $operator; | ||
$this->value = strval($value); | ||
} | ||
@trigger_error('use \Citilink\ExpertSenderApi\Model\WhereCondition instead', E_USER_DEPRECATED); | ||
|
||
/** | ||
* Get column name | ||
* | ||
* @return string Column name | ||
*/ | ||
public function getColumnName(): string | ||
{ | ||
return $this->columnName; | ||
} | ||
|
||
/** | ||
* Get operator | ||
* | ||
* @return Operator Operator | ||
*/ | ||
public function getOperator(): Operator | ||
{ | ||
return $this->operator; | ||
} | ||
|
||
/** | ||
* Get value | ||
* | ||
* @return string Value | ||
*/ | ||
public function getValue(): string | ||
{ | ||
return $this->value; | ||
parent::__construct($columnName, $operator, $value); | ||
} | ||
} |
Oops, something went wrong.