-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'remotes/dev/1.6' into 1.6
- Loading branch information
Showing
12 changed files
with
142 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/Oro/Bundle/EntityExtendBundle/Tools/ExtendSchemaUpdateRemoveNamespacedAssets.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
namespace Oro\Bundle\EntityExtendBundle\Tools; | ||
|
||
use Doctrine\DBAL\Schema\ForeignKeyConstraint; | ||
use Doctrine\DBAL\Schema\Table; | ||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\DBAL\Schema\Sequence; | ||
use Doctrine\DBAL\Schema\Visitor\AbstractVisitor; | ||
|
||
/** | ||
* This class is a copy of "Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets" and it is used in | ||
* the command "oro:entity-extend:update-schema" to prevent removing foreign keys between | ||
* extended and regular entities (for details see method "acceptForeignKey"). | ||
* | ||
* Unfortunately due a poor design of the Doctrine\ORM\Tools\SchemaTool::getSchemaFromMetadata | ||
* we have to use "class_alias" to replace "Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets" | ||
* with "Oro\Bundle\EntityExtendBundle\Tools\ExtendSchemaUpdateRemoveNamespacedAssets". | ||
* And by the same reason we cannot extend our class from "Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets". | ||
*/ | ||
class ExtendSchemaUpdateRemoveNamespacedAssets extends AbstractVisitor | ||
{ | ||
/** | ||
* @var Schema | ||
*/ | ||
private $schema; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function acceptSchema(Schema $schema) | ||
{ | ||
$this->schema = $schema; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function acceptTable(Table $table) | ||
{ | ||
if (!$table->isInDefaultNamespace($this->schema->getName())) { | ||
$this->schema->dropTable($table->getName()); | ||
} | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function acceptSequence(Sequence $sequence) | ||
{ | ||
if (!$sequence->isInDefaultNamespace($this->schema->getName())) { | ||
$this->schema->dropSequence($sequence->getName()); | ||
} | ||
} | ||
|
||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint) | ||
{ | ||
// do nothing here | ||
// we do not need to remove any foreign keys because extended entities can reference to regular entities | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,81 +5,17 @@ request: | |
offset: ~ | ||
max_results: ~ | ||
response: | ||
records_count: 9 | ||
count: 9 | ||
records_count: 1 | ||
count: 1 | ||
rest: | ||
data: | ||
- | ||
entity_name: Oro\Bundle\TestFrameworkBundle\Entity\Item | ||
record_string: [email protected] | ||
record_url: http://localhost/search/ | ||
- | ||
entity_name: Oro\Bundle\TestFrameworkBundle\Entity\Item | ||
record_string: [email protected] | ||
record_url: http://localhost/search/ | ||
- | ||
entity_name: Oro\Bundle\TestFrameworkBundle\Entity\Item | ||
record_string: [email protected] | ||
record_url: http://localhost/search/ | ||
- | ||
entity_name: Oro\Bundle\TestFrameworkBundle\Entity\Item | ||
record_string: [email protected] | ||
record_url: http://localhost/search/ | ||
- | ||
entity_name: Oro\Bundle\TestFrameworkBundle\Entity\Item | ||
record_string: [email protected] | ||
record_url: http://localhost/search/ | ||
- | ||
entity_name: Oro\Bundle\TestFrameworkBundle\Entity\Item | ||
record_string: [email protected] | ||
record_url: http://localhost/search/ | ||
- | ||
entity_name: Oro\Bundle\TestFrameworkBundle\Entity\Item | ||
record_string: [email protected] | ||
record_url: http://localhost/search/ | ||
- | ||
entity_name: Oro\Bundle\TestFrameworkBundle\Entity\Item | ||
record_string: [email protected] | ||
record_url: http://localhost/search/ | ||
- | ||
entity_name: Oro\Bundle\TestFrameworkBundle\Entity\Item | ||
record_string: [email protected] | ||
record_url: http://localhost/search/ | ||
soap: | ||
item: | ||
- | ||
entityName: Oro\Bundle\TestFrameworkBundle\Entity\Item | ||
recordTitle: [email protected] | ||
recordUrl: http://localhost/search/ | ||
- | ||
entityName: Oro\Bundle\TestFrameworkBundle\Entity\Item | ||
recordTitle: [email protected] | ||
recordUrl: http://localhost/search/ | ||
- | ||
entityName: Oro\Bundle\TestFrameworkBundle\Entity\Item | ||
recordTitle: [email protected] | ||
recordUrl: http://localhost/search/ | ||
- | ||
entityName: Oro\Bundle\TestFrameworkBundle\Entity\Item | ||
recordTitle: [email protected] | ||
recordUrl: http://localhost/search/ | ||
- | ||
entityName: Oro\Bundle\TestFrameworkBundle\Entity\Item | ||
recordTitle: [email protected] | ||
recordUrl: http://localhost/search/ | ||
- | ||
entityName: Oro\Bundle\TestFrameworkBundle\Entity\Item | ||
recordTitle: [email protected] | ||
recordUrl: http://localhost/search/ | ||
- | ||
entityName: Oro\Bundle\TestFrameworkBundle\Entity\Item | ||
recordTitle: [email protected] | ||
recordUrl: http://localhost/search/ | ||
- | ||
entityName: Oro\Bundle\TestFrameworkBundle\Entity\Item | ||
recordTitle: [email protected] | ||
recordUrl: http://localhost/search/ | ||
- | ||
entityName: Oro\Bundle\TestFrameworkBundle\Entity\Item | ||
recordTitle: [email protected] | ||
recordUrl: http://localhost/search/ |
Oops, something went wrong.