1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- namespace Doctrine\DBAL\Event;
- use Doctrine\DBAL\Platforms\AbstractPlatform;
- use Doctrine\DBAL\Schema\Column;
- use Doctrine\DBAL\Schema\Table;
- use function array_merge;
- use function is_array;
- /**
- * Event Arguments used when SQL queries for creating tables are generated inside Doctrine\DBAL\Platform\AbstractPlatform.
- */
- class SchemaCreateTableEventArgs extends SchemaEventArgs
- {
- /** @var Table */
- private $table;
- /** @var Column[] */
- private $columns;
- /** @var mixed[] */
- private $options;
- /** @var AbstractPlatform */
- private $platform;
- /** @var string[] */
- private $sql = [];
- /**
- * @param Column[] $columns
- * @param mixed[] $options
- */
- public function __construct(Table $table, array $columns, array $options, AbstractPlatform $platform)
- {
- $this->table = $table;
- $this->columns = $columns;
- $this->options = $options;
- $this->platform = $platform;
- }
- /**
- * @return Table
- */
- public function getTable()
- {
- return $this->table;
- }
- /**
- * @return Column[]
- */
- public function getColumns()
- {
- return $this->columns;
- }
- /**
- * @return mixed[]
- */
- public function getOptions()
- {
- return $this->options;
- }
- /**
- * @return AbstractPlatform
- */
- public function getPlatform()
- {
- return $this->platform;
- }
- /**
- * @param string|string[] $sql
- *
- * @return \Doctrine\DBAL\Event\SchemaCreateTableEventArgs
- */
- public function addSql($sql)
- {
- if (is_array($sql)) {
- $this->sql = array_merge($this->sql, $sql);
- } else {
- $this->sql[] = $sql;
- }
- return $this;
- }
- /**
- * @return string[]
- */
- public function getSql()
- {
- return $this->sql;
- }
- }
|