| 1 | <?php |
||
| 17 | class InsertCommand extends TableCommand implements ContextualCommandInterface |
||
| 18 | { |
||
| 19 | use ContextTrait; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var array |
||
| 23 | */ |
||
| 24 | private $data = []; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Set when command is executed. |
||
| 28 | * |
||
| 29 | * @var null|mixed |
||
| 30 | */ |
||
| 31 | private $insertID = null; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param Table $table |
||
| 35 | * @param array $data |
||
| 36 | */ |
||
| 37 | public function __construct(Table $table, array $data = []) |
||
| 42 | |||
| 43 | /** |
||
| 44 | * {@inheritdoc} |
||
| 45 | */ |
||
| 46 | public function isEmpty(): bool |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Insert values, context not included. |
||
| 53 | * |
||
| 54 | * @return array |
||
| 55 | */ |
||
| 56 | public function getData(): array |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Get inserted row id. |
||
| 63 | * |
||
| 64 | * @return mixed|null |
||
| 65 | */ |
||
| 66 | public function getInsertID() |
||
| 70 | |||
| 71 | /** |
||
| 72 | * @return mixed|null |
||
| 73 | */ |
||
| 74 | public function primaryKey() |
||
| 78 | |||
| 79 | /** |
||
| 80 | * Inserting data into associated table. |
||
| 81 | */ |
||
| 82 | public function execute() |
||
| 87 | } |
||
| 88 |