Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
d2b0181e
Commit
d2b0181e
authored
Dec 09, 2011
by
jsor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rework schema column definition event
parent
a1b18d86
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
42 deletions
+47
-42
SchemaColumnDefinitionEventArgs.php
lib/Doctrine/DBAL/Event/SchemaColumnDefinitionEventArgs.php
+39
-34
AbstractSchemaManager.php
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
+8
-8
No files found.
lib/Doctrine/DBAL/Event/SchemaColumnDefinitionEventArgs.php
View file @
d2b0181e
...
...
@@ -26,7 +26,7 @@ use Doctrine\Common\EventArgs,
Doctrine\DBAL\Schema\Column
;
/**
* Event Arguments used when the portable
c
olumn definition is generated inside Doctrine\DBAL\Schema\AbstractSchemaManager.
* Event Arguments used when the portable
tableC
olumn definition is generated inside Doctrine\DBAL\Schema\AbstractSchemaManager.
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.com
...
...
@@ -37,10 +37,17 @@ use Doctrine\Common\EventArgs,
class
SchemaColumnDefinitionEventArgs
extends
SchemaEventArgs
{
/**
* @var
array
* @var
\Doctrine\DBAL\Schema\Column $column
*/
private
$_column
=
null
;
/**
* Raw column data as fetched from the database
*
* @var array
*/
private
$_tableColumn
=
null
;
/**
* @var string
*/
...
...
@@ -57,32 +64,49 @@ class SchemaColumnDefinitionEventArgs extends SchemaEventArgs
private
$_connection
=
null
;
/**
* @var \Doctrine\DBAL\Schema\Column $columnDefinition
* @param array $tableColumn
* @param string $table
* @param string $database
* @param \Doctrine\DBAL\Connection $conn
*/
private
$_columnDefinition
=
null
;
public
function
__construct
(
array
$tableColumn
,
$table
,
$database
,
Connection
$connection
)
{
$this
->
_tableColumn
=
$tableColumn
;
$this
->
_table
=
$table
;
$this
->
_database
=
$database
;
$this
->
_connection
=
$connection
;
}
/**
* @param type $column
* @param type $table
* @param type $database
* @param \Doctrine\DBAL\Connection $conn
* Allows to clear the column which means the column will be excluded from
* tables column list.
*
* @param null|\Doctrine\DBAL\Schema\Column $column
* @return SchemaColumnDefinitionEventArgs
*/
public
function
__construct
(
$column
,
$table
,
$database
,
Connection
$connection
)
public
function
setColumn
(
Column
$column
=
null
)
{
$this
->
_column
=
$column
;
$this
->
_table
=
$table
;
$this
->
_database
=
$database
;
$this
->
_connection
=
$connection
;
$this
->
_column
=
$column
;
return
$this
;
}
/**
* @return array
* @return array
|\Doctrine\DBAL\Schema\Column
*/
public
function
getColumn
()
{
return
$this
->
_column
;
}
/**
* @return array
*/
public
function
getTableColumn
()
{
return
$this
->
_tableColumn
;
}
/**
* @return string
*/
...
...
@@ -114,23 +138,4 @@ class SchemaColumnDefinitionEventArgs extends SchemaEventArgs
{
return
$this
->
_connection
->
getDatabasePlatform
();
}
/**
* @param \Doctrine\DBAL\Schema\Column $columnDefinition
* @return SchemaColumnDefinitionEventArgs
*/
public
function
setColumnDefinition
(
Column
$columnDefinition
)
{
$this
->
_columnDefinition
=
$columnDefinition
;
return
$this
;
}
/**
* @return \Doctrine\DBAL\Schema\Column
*/
public
function
getColumnDefinition
()
{
return
$this
->
_columnDefinition
;
}
}
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
View file @
d2b0181e
...
...
@@ -630,25 +630,25 @@ abstract class AbstractSchemaManager
$eventManager
=
$this
->
_platform
->
getEventManager
();
$list
=
array
();
foreach
(
$tableColumns
as
$key
=>
$
c
olumn
)
{
$column
Definition
=
null
;
foreach
(
$tableColumns
as
$key
=>
$
tableC
olumn
)
{
$column
=
null
;
$defaultPrevented
=
false
;
if
(
null
!==
$eventManager
&&
$eventManager
->
hasListeners
(
Events
::
onSchemaColumnDefinition
))
{
$eventArgs
=
new
SchemaColumnDefinitionEventArgs
(
$
c
olumn
,
$table
,
$database
,
$this
->
_conn
);
$eventArgs
=
new
SchemaColumnDefinitionEventArgs
(
$
tableC
olumn
,
$table
,
$database
,
$this
->
_conn
);
$eventManager
->
dispatchEvent
(
Events
::
onSchemaColumnDefinition
,
$eventArgs
);
$defaultPrevented
=
$eventArgs
->
isDefaultPrevented
();
$column
Definition
=
$eventArgs
->
getColumnDefinitio
n
();
$column
=
$eventArgs
->
getColum
n
();
}
if
(
!
$defaultPrevented
)
{
$column
Definition
=
$this
->
_getPortableTableColumnDefinition
(
$c
olumn
);
$column
=
$this
->
_getPortableTableColumnDefinition
(
$tableC
olumn
);
}
if
(
$column
Definition
)
{
$name
=
strtolower
(
$column
Definition
->
getQuotedName
(
$this
->
_platform
));
$list
[
$name
]
=
$column
Definition
;
if
(
$column
)
{
$name
=
strtolower
(
$column
->
getQuotedName
(
$this
->
_platform
));
$list
[
$name
]
=
$column
;
}
}
return
$list
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment