Schema events #82

Merged
merged 27 commits into from Dec 19, 2011

Conversation

Projects
None yet
3 participants
Contributor

jsor commented Dec 9, 2011

Trigger schema related events to allow custom create/drop/update queries.

lib/Doctrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php
+ /**
+ * @var Column
+ */
+ private $_column = null;
@stof

stof Dec 9, 2011

Member

@beberlei are you still using underscores for private properties or not ?

lib/Doctrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php
@@ -0,0 +1,118 @@
+<?php
+/*
+ * $Id$
@stof

stof Dec 9, 2011

Member

this should be omitted. It makes no sense in a git world as it is some SVN stuff.

@jsor

jsor Dec 9, 2011

Contributor

Fixed

lib/Doctrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.com
+ * @since 2.2
+ * @version $Revision$
@stof

stof Dec 9, 2011

Member

the version should be removed too

@jsor

jsor Dec 9, 2011

Contributor

Fixed

+ public function getSql()
+ {
+ return $this->_sql;
+ }
@stof

stof Dec 9, 2011

Member

some methods should probably be moved to the parent class as they are duplicated in all child classes

+ /**
+ * @var \Doctrine\DBAL\Connection
+ */
+ private $_connection = null;
@stof

stof Dec 9, 2011

Member

why does it contain the connection when all other new events contain the platform ?

@jsor

jsor Dec 9, 2011

Contributor

This where the schema is created from the database and additional queries might be required.Example: https://github.com/jsor/doctrine-spatial-sandbox/blob/master/src/Doctrine/Spatial/SpatialDBALEventSubscriber.php#L276

lib/Doctrine/DBAL/Event/SchemaColumnDefinitionEventArgs.php
+ */
+ public function getDatabase()
+ {
+ return $this->_platform;
@stof

stof Dec 9, 2011

Member

this seems wrong

@jsor

jsor Dec 9, 2011

Contributor

Fixed

lib/Doctrine/DBAL/Event/SchemaDropTableEventArgs.php
+ $this->_table = $table;
+ } else {
+ throw new \InvalidArgumentException('SchemaCreateTableEventArgs expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
+ }
@stof

stof Dec 9, 2011

Member

I would write it

<?php
if (!$table instanceof Table && !is_string($table)) {
    throw new \InvalidArgumentException('SchemaCreateTableEventArgs expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
}

$this->_table = $table;
$this->_platform = $platform;
@jsor

jsor Dec 9, 2011

Contributor

Fixed

Owner

beberlei commented Dec 12, 2011

Started evaluating this.

beberlei added a commit that referenced this pull request Dec 19, 2011

@beberlei beberlei merged commit a9eb7b4 into doctrine:master Dec 19, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment