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