From b20b15bd4cb53291a6775b08319f15c5d0a1b113 Mon Sep 17 00:00:00 2001 From: Gustavo Piltcher Date: Wed, 23 Nov 2011 19:02:00 -0200 Subject: [PATCH 1/5] Oracle 10 issues I've changed Schema.php to not use Restrict on delete/update since oracle report it as missing keyword. Both restrict and no action on oracle seems to be redundant and used by default. So the output query can't use it. I've also changed Schema construct to accept a SchemaConfig parameter. InitAcl was changed to pass on new Schema a SchemaConfig generated by SchemaManager, I did that because acl command was generating names with more than 30 characters and Oracle doesn't accept, this seems to solve the problem and init:acl works properly. --- .../SecurityBundle/Command/InitAclCommand.php | 9 +++++---- .../Component/Security/Acl/Dbal/Schema.php | 20 +++++++++++++++---- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php index 3fd12b42b7..fcef6772e0 100644 --- a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php +++ b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php @@ -15,6 +15,7 @@ use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Security\Acl\Dbal\Schema; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Doctrine\DBAL\DriverManager; /** * Installs the tables required by the ACL system @@ -34,7 +35,7 @@ class InitAclCommand extends ContainerAwareCommand ->setHelp(<<init:acl command mounts ACL tables in the database. -php app/console init:acl +php app/console ini:acl The name of the DBAL connection must be configured in your app/config/security.yml configuration file in the security.acl.connection variable. @@ -68,12 +69,12 @@ EOT return; } } - - $schema = new Schema($tables); + + $schema = new Schema($tables, null, $sm->createSchemaConfig()); foreach ($schema->toSql($connection->getDatabasePlatform()) as $sql) { $connection->exec($sql); } $output->writeln('ACL tables have been initialized successfully.'); } -} +} \ No newline at end of file diff --git a/src/Symfony/Component/Security/Acl/Dbal/Schema.php b/src/Symfony/Component/Security/Acl/Dbal/Schema.php index 97372f0ab5..15cb9c7be4 100644 --- a/src/Symfony/Component/Security/Acl/Dbal/Schema.php +++ b/src/Symfony/Component/Security/Acl/Dbal/Schema.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Security\Acl\Dbal; use Doctrine\DBAL\Schema\Schema as BaseSchema; +use Doctrine\DBAL\Schema\SchemaConfig as SchemaConfig; /** * The schema used for the ACL system. @@ -26,10 +27,11 @@ final class Schema extends BaseSchema * Constructor * * @param array $options the names for tables + * @return void */ - public function __construct(array $options) + public function __construct(array $options, $unused=null, SchemaConfig $schemaConfig=null) { - parent::__construct(); + parent::__construct(array(), array(), $schemaConfig); $this->options = $options; @@ -42,6 +44,8 @@ final class Schema extends BaseSchema /** * Adds the class table to the schema + * + * @return void */ protected function addClassTable() { @@ -54,6 +58,8 @@ final class Schema extends BaseSchema /** * Adds the entry table to the schema + * + * @return void */ protected function addEntryTable() { @@ -82,6 +88,8 @@ final class Schema extends BaseSchema /** * Adds the object identity table to the schema + * + * @return void */ protected function addObjectIdentitiesTable() { @@ -97,11 +105,13 @@ final class Schema extends BaseSchema $table->addUniqueIndex(array('object_identifier', 'class_id')); $table->addIndex(array('parent_object_identity_id')); - $table->addForeignKeyConstraint($table, array('parent_object_identity_id'), array('id'), array('onDelete' => 'RESTRICT', 'onUpdate' => 'RESTRICT')); + $table->addForeignKeyConstraint($table, array('parent_object_identity_id'), array('id')); } /** * Adds the object identity relation table to the schema + * + * @return void */ protected function addObjectIdentityAncestorsTable() { @@ -119,6 +129,8 @@ final class Schema extends BaseSchema /** * Adds the security identity table to the schema + * + * @return void */ protected function addSecurityIdentitiesTable() { @@ -131,4 +143,4 @@ final class Schema extends BaseSchema $table->setPrimaryKey(array('id')); $table->addUniqueIndex(array('identifier', 'username')); } -} +} \ No newline at end of file From 315bfc472aa1776cb490219ba463601c31efc236 Mon Sep 17 00:00:00 2001 From: Gustavo Piltcher Date: Thu, 1 Dec 2011 13:33:03 -0200 Subject: [PATCH 2/5] just update --- .../SecurityBundle/Command/InitAclCommand.php | 2 +- src/Symfony/Component/Security/Acl/Dbal/Schema.php | 13 +------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php index fcef6772e0..fb0a208c3b 100644 --- a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php +++ b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php @@ -35,7 +35,7 @@ class InitAclCommand extends ContainerAwareCommand ->setHelp(<<init:acl command mounts ACL tables in the database. -php app/console ini:acl +php app/console init:acl The name of the DBAL connection must be configured in your app/config/security.yml configuration file in the security.acl.connection variable. diff --git a/src/Symfony/Component/Security/Acl/Dbal/Schema.php b/src/Symfony/Component/Security/Acl/Dbal/Schema.php index 15cb9c7be4..f75e822f70 100644 --- a/src/Symfony/Component/Security/Acl/Dbal/Schema.php +++ b/src/Symfony/Component/Security/Acl/Dbal/Schema.php @@ -12,7 +12,7 @@ namespace Symfony\Component\Security\Acl\Dbal; use Doctrine\DBAL\Schema\Schema as BaseSchema; -use Doctrine\DBAL\Schema\SchemaConfig as SchemaConfig; +use Doctrine\DBAL\Schema\SchemaConfig; /** * The schema used for the ACL system. @@ -27,7 +27,6 @@ final class Schema extends BaseSchema * Constructor * * @param array $options the names for tables - * @return void */ public function __construct(array $options, $unused=null, SchemaConfig $schemaConfig=null) { @@ -44,8 +43,6 @@ final class Schema extends BaseSchema /** * Adds the class table to the schema - * - * @return void */ protected function addClassTable() { @@ -58,8 +55,6 @@ final class Schema extends BaseSchema /** * Adds the entry table to the schema - * - * @return void */ protected function addEntryTable() { @@ -88,8 +83,6 @@ final class Schema extends BaseSchema /** * Adds the object identity table to the schema - * - * @return void */ protected function addObjectIdentitiesTable() { @@ -110,8 +103,6 @@ final class Schema extends BaseSchema /** * Adds the object identity relation table to the schema - * - * @return void */ protected function addObjectIdentityAncestorsTable() { @@ -129,8 +120,6 @@ final class Schema extends BaseSchema /** * Adds the security identity table to the schema - * - * @return void */ protected function addSecurityIdentitiesTable() { From 2316b2195287c0b41191678a6627a9d9f04b6dae Mon Sep 17 00:00:00 2001 From: Gustavo Piltcher Date: Thu, 1 Dec 2011 13:42:21 -0200 Subject: [PATCH 3/5] Oracle issues --- src/Symfony/Component/Security/Acl/Dbal/Schema.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Security/Acl/Dbal/Schema.php b/src/Symfony/Component/Security/Acl/Dbal/Schema.php index f75e822f70..60a3677baf 100644 --- a/src/Symfony/Component/Security/Acl/Dbal/Schema.php +++ b/src/Symfony/Component/Security/Acl/Dbal/Schema.php @@ -82,7 +82,7 @@ final class Schema extends BaseSchema } /** - * Adds the object identity table to the schema + * Adds the object identity table to the schema */ protected function addObjectIdentitiesTable() { From 81d73bb96876bde66f24cfd9f6202e1616586965 Mon Sep 17 00:00:00 2001 From: Gustavo Piltcher Date: Tue, 13 Dec 2011 00:38:22 -0200 Subject: [PATCH 4/5] Oracle issues minor changes on code --- .../Bundle/SecurityBundle/Command/InitAclCommand.php | 6 +++--- src/Symfony/Component/Security/Acl/Dbal/Schema.php | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php index fb0a208c3b..ec22cb23de 100644 --- a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php +++ b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php @@ -69,12 +69,12 @@ EOT return; } } - - $schema = new Schema($tables, null, $sm->createSchemaConfig()); + + $schema = new Schema($tables, $sm->createSchemaConfig()); foreach ($schema->toSql($connection->getDatabasePlatform()) as $sql) { $connection->exec($sql); } $output->writeln('ACL tables have been initialized successfully.'); } -} \ No newline at end of file +} diff --git a/src/Symfony/Component/Security/Acl/Dbal/Schema.php b/src/Symfony/Component/Security/Acl/Dbal/Schema.php index 60a3677baf..b5cf8becad 100644 --- a/src/Symfony/Component/Security/Acl/Dbal/Schema.php +++ b/src/Symfony/Component/Security/Acl/Dbal/Schema.php @@ -27,8 +27,9 @@ final class Schema extends BaseSchema * Constructor * * @param array $options the names for tables + * @param SchemaConfig $schemaConfig */ - public function __construct(array $options, $unused=null, SchemaConfig $schemaConfig=null) + public function __construct(array $options, SchemaConfig $schemaConfig=null) { parent::__construct(array(), array(), $schemaConfig); @@ -82,7 +83,7 @@ final class Schema extends BaseSchema } /** - * Adds the object identity table to the schema + * Adds the object identity table to the schema */ protected function addObjectIdentitiesTable() { @@ -132,4 +133,4 @@ final class Schema extends BaseSchema $table->setPrimaryKey(array('id')); $table->addUniqueIndex(array('identifier', 'username')); } -} \ No newline at end of file +} From 4a797df90bf7b4eb71e71f311390add2f1b76a9d Mon Sep 17 00:00:00 2001 From: Gustavo Piltcher Date: Fri, 23 Dec 2011 14:13:05 -0200 Subject: [PATCH 5/5] Oracle issues minor modifications --- src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php | 1 - src/Symfony/Component/Security/Acl/Dbal/Schema.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php index ec22cb23de..0821b42363 100644 --- a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php +++ b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php @@ -15,7 +15,6 @@ use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Security\Acl\Dbal\Schema; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Doctrine\DBAL\DriverManager; /** * Installs the tables required by the ACL system diff --git a/src/Symfony/Component/Security/Acl/Dbal/Schema.php b/src/Symfony/Component/Security/Acl/Dbal/Schema.php index b5cf8becad..010a51e2ce 100644 --- a/src/Symfony/Component/Security/Acl/Dbal/Schema.php +++ b/src/Symfony/Component/Security/Acl/Dbal/Schema.php @@ -29,7 +29,7 @@ final class Schema extends BaseSchema * @param array $options the names for tables * @param SchemaConfig $schemaConfig */ - public function __construct(array $options, SchemaConfig $schemaConfig=null) + public function __construct(array $options, SchemaConfig $schemaConfig = null) { parent::__construct(array(), array(), $schemaConfig);