Permalink
Fetching contributors…
Cannot retrieve contributors at this time
99 lines (83 sloc) 1.85 KB
<?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;
}
}