Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

add ComparatorInterface to allow custom Comparator implementation #152

Closed
wants to merge 1 commit into from

4 participants

@travisbot

This pull request passes (merged 2b84652b into cb0cda2).

lib/Doctrine/DBAL/Schema/Comparator.php
@@ -100,7 +100,7 @@ public function compare(Schema $fromSchema, Schema $toSchema)
foreach ($toSchema->getSequences() as $sequence) {
$sequenceName = $sequence->getShortestName($toSchema->getName());
- if ( ! $fromSchema->hasSequence($sequenceName)) {
+ if (!$fromSchema->hasSequence($sequenceName)) {
@stof
stof added a note

this change is wrong according to the Doctrine coding standards. Please don't change the CS of the existing code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
lib/Doctrine/DBAL/Schema/Comparator.php
@@ -261,7 +261,7 @@ private function detectColumnRenamings(TableDiff $tableDifferences)
}
}
- foreach ($renameCandidates as $candidateColumns) {
+ foreach ($renameCandidates as $candidate => $candidateColumns) {
@stof
stof added a note

why adding a useless variable ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
lib/Doctrine/DBAL/Schema/ComparatorInterface.php
((15 lines not shown))
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace Doctrine\DBAL\Schema;
+
+/**
+ * Compare to Schemas and return an instance of SchemaDiff
+ *
+ * @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @version $Revision$
@stof
stof added a note

this annotation should be removed as it will not be replaced anyway

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

This pull request passes (merged 6c12c20e into cb0cda2).

lib/Doctrine/DBAL/Schema/ComparatorInterface.php
((10 lines not shown))
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace Doctrine\DBAL\Schema;
+
+/**
+ * Compare to Schemas and return an instance of SchemaDiff
+ *
+ * @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
@beberlei Owner

Please remove the copyright and license tags here. They don't apply to this code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
lib/Doctrine/DBAL/Schema/Comparator.php
@@ -78,7 +78,7 @@ public function compare(Schema $fromSchema, Schema $toSchema)
$tableName = $table->getShortestName($fromSchema->getName());
$table = $fromSchema->getTable($tableName);
- if ( ! $toSchema->hasTable($tableName) ) {
+ if (!$toSchema->hasTable($tableName) ) {
@beberlei Owner

please revert this to ( ! $toSchema with spaces, also the two occurances below.

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

This pull request fails (merged 7517418d into cb0cda2).

@travisbot

This pull request fails (merged 3b5da550 into 4030787).

@travisbot

This pull request fails (merged f829dd06 into 4030787).

@travisbot

This pull request fails (merged 8cc00bb into 4030787).

@beberlei
Owner

Can you explain what you need this for? I think we are missing an opportunity here to fix a bug or a problem that you are having an not telling us about :-)

@catacgc
@beberlei
Owner

what do you mean with relations? Foreign keys? In that case you just need a custom platform which has supportsForeignKeys = false.

@catacgc
@beberlei
Owner

Yes i want to avoid extension points if they only lead to people not talking and/or contributing back and fixing their "bugs" on their own.

@beberlei
Owner
class MyPlatform extends MySQLPlatform
{
    public function supportsForeignKeys() { return false; }
}

Then:

DriverManager::getConnection(array('platform' => new MyPlatform()));
@beberlei beberlei closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
2  lib/Doctrine/DBAL/Schema/Comparator.php
@@ -30,7 +30,7 @@
* @version $Revision$
* @author Benjamin Eberlei <kontakt@beberlei.de>
*/
-class Comparator
+class Comparator implements ComparatorInterface
{
/**
* @param Schema $fromSchema
View
45 lib/Doctrine/DBAL/Schema/ComparatorInterface.php
@@ -0,0 +1,45 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace Doctrine\DBAL\Schema;
+
+/**
+ * Compare to Schemas and return an instance of SchemaDiff
+ *
+ * @link www.doctrine-project.org
+ * @since 2.2
+ *
+ * @author Catalin Costache
+ */
+interface ComparatorInterface
+{
+ /**
+ * Returns a SchemaDiff object containing the differences between the schemas $fromSchema and $toSchema.
+ *
+ * The returned diferences are returned in such a way that they contain the
+ * operations to change the schema stored in $fromSchema to the schema that is
+ * stored in $toSchema.
+ *
+ * @param Schema $fromSchema
+ * @param Schema $toSchema
+ *
+ * @return SchemaDiff
+ */
+ function compare(Schema $fromSchema, Schema $toSchema);
+}
Something went wrong with that request. Please try again.