Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2.2
-
Fix Version/s: None
-
Component/s: Sluggable
-
Labels:None
-
Environment:HideUsing Symfony 1.4 form svn:
URL: http://svn.symfony-project.com/branches/1.4
Revision: 29223
Last Changed Rev: 29218
Last Changed Date: 2010-04-20 08:04:09 +0200 (Di, 20 Apr 2010)ShowUsing Symfony 1.4 form svn: URL: http://svn.symfony-project.com/branches/1.4 Revision: 29223 Last Changed Rev: 29218 Last Changed Date: 2010-04-20 08:04:09 +0200 (Di, 20 Apr 2010)
Description
Basically the slug column doesn't get updated in spite of all fields being added correctly, as far as i can tell.
It seems to be related to additional options because when i don't have either of the uniqueBy or canUpdate options specified, it just works.
What's been missing is the 'slug' column value in the sql statements (providing 3 examples):
2400 Query INSERT INTO `custom_category` (`block_id`, `name`) VALUES ('1', 'slug test')
2526 Query INSERT INTO `custom_category` (`name`, `block_id`) VALUES ('please do work..', '1')
2560 Query UPDATE `custom_category` SET `name` = 'still not ok' WHERE `id` = '12'
The generated schema.sql includes the correct create table statement (it's also correctly inserted in the db):
CREATE TABLE `custom_category` ( `id` INT UNSIGNED AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL, `block_id` INT UNSIGNED NOT NULL, `slug` VARCHAR(255), UNIQUE INDEX `custom_category_sluggable_idx` (`slug`, `block_id`, `name`), INDEX `block_id_idx` (`block_id`), PRIMARY KEY(`id`) ) ENGINE = INNODB;
The schema.yml entry is the following:
CustomCategory:
connection: removed
tableName: custom_category
actAs:
Sluggable:
fields: [name]
uniqueBy: [block_id, name]
canUpdate: true
columns:
id:
type: integer(4)
unsigned: true
notnull: true
primary: true
autoincrement: true
name:
type: string(255)
notnull: true
block_id:
type: integer(4)
unsigned: true
notnull: true
relations:
Products:
class: Product
foreignAlias: CustomCategories
refClass: ProductCustomCategory
Block:
class: Block
local: block_id
foreign: id
foreignType: many
foreignAlias: CustomCategories
type: one
And finally the appropriate auto generated base class (removed doc block):
<?php // Connection Component Binding Doctrine_Manager::getInstance()->bindComponent('CustomCategory', 'removed'); abstract class BaseCustomCategory extends aaDoctrineRecord { public function setTableDefinition() { $this->setTableName('custom_category'); $this->hasColumn('id', 'integer', 4, array( 'type' => 'integer', 'unsigned' => true, 'primary' => true, 'autoincrement' => true, 'length' => '4', )); $this->hasColumn('name', 'string', 255, array( 'type' => 'string', 'notnull' => true, 'length' => '255', )); $this->hasColumn('block_id', 'integer', 4, array( 'type' => 'integer', 'unsigned' => true, 'notnull' => true, 'length' => '4', )); } public function setUp() { parent::setUp(); $this->hasMany('Product as Products', array( 'refClass' => 'ProductCustomCategory', 'local' => 'custom_category_id', 'foreign' => 'product_id')); $this->hasOne('Block', array( 'local' => 'block_id', 'foreign' => 'id')); $sluggable0 = new Doctrine_Template_Sluggable(array( 'fields' => array( 0 => 'name', ), 'uniqueBy' => array( 0 => 'block_id', 1 => 'name', ), 'canUpdate' => true, )); $this->actAs($sluggable0); } }
Activity
Jonathan H. Wage
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Description |
Basically the slug column doesn't get updated in spite of all fields being added correctly, as far as i can tell. What's been missing is the 'slug' column value in the sql statements (providing 3 examples): 2400 Query INSERT INTO `custom_category` (`block_id`, `name`) VALUES ('1', 'slug test') 2526 Query INSERT INTO `custom_category` (`name`, `block_id`) VALUES ('please do work..', '1') 2560 Query UPDATE `custom_category` SET `name` = 'still not ok' WHERE `id` = '12' -- both insert and update statements should also contain a slug column and the respective value. The generated schema.sql includes the correct create table statement (it's also correctly inserted in the db): CREATE TABLE `custom_category` ( `id` INT UNSIGNED AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL, `block_id` INT UNSIGNED NOT NULL, `slug` VARCHAR(255), UNIQUE INDEX `custom_category_sluggable_idx` (`slug`, `block_id`, `name`), INDEX `block_id_idx` (`block_id`), PRIMARY KEY(`id`) ) ENGINE = INNODB; The schema.yml entry is the following: CustomCategory: connection: removed tableName: custom_category actAs: Sluggable: fields: [name] uniqueBy: [block_id, name] canUpdate: true columns: id: type: integer(4) unsigned: true notnull: true primary: true autoincrement: true name: type: string(255) notnull: true block_id: type: integer(4) unsigned: true notnull: true relations: Products: class: Product foreignAlias: CustomCategories refClass: ProductCustomCategory Block: class: Block local: block_id foreign: id foreignType: many foreignAlias: CustomCategories type: one And finally the appropriate auto generated base class (removed doc block): <?php // Connection Component Binding Doctrine_Manager::getInstance()->bindComponent('CustomCategory', 'removed'); abstract class BaseCustomCategory extends aaDoctrineRecord { public function setTableDefinition() { $this->setTableName('custom_category'); $this->hasColumn('id', 'integer', 4, array( 'type' => 'integer', 'unsigned' => true, 'primary' => true, 'autoincrement' => true, 'length' => '4', )); $this->hasColumn('name', 'string', 255, array( 'type' => 'string', 'notnull' => true, 'length' => '255', )); $this->hasColumn('block_id', 'integer', 4, array( 'type' => 'integer', 'unsigned' => true, 'notnull' => true, 'length' => '4', )); } public function setUp() { parent::setUp(); $this->hasMany('Product as Products', array( 'refClass' => 'ProductCustomCategory', 'local' => 'custom_category_id', 'foreign' => 'product_id')); $this->hasOne('Block', array( 'local' => 'block_id', 'foreign' => 'id')); $sluggable0 = new Doctrine_Template_Sluggable(array( 'fields' => array( 0 => 'name', ), 'uniqueBy' => array( 0 => 'block_id', 1 => 'name', ), 'canUpdate' => true, )); $this->actAs($sluggable0); } } |
Basically the slug column doesn't get updated in spite of all fields being added correctly, as far as i can tell. What's been missing is the 'slug' column value in the sql statements (providing 3 examples): 2400 Query INSERT INTO `custom_category` (`block_id`, `name`) VALUES ('1', 'slug test') 2526 Query INSERT INTO `custom_category` (`name`, `block_id`) VALUES ('please do work..', '1') 2560 Query UPDATE `custom_category` SET `name` = 'still not ok' WHERE `id` = '12' -- both insert and update statements should also contain a slug column and the respective value. The generated schema.sql includes the correct create table statement (it's also correctly inserted in the db): CREATE TABLE `custom_category` ( `id` INT UNSIGNED AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL, `block_id` INT UNSIGNED NOT NULL, `slug` VARCHAR(255), UNIQUE INDEX `custom_category_sluggable_idx` (`slug`, `block_id`, `name`), INDEX `block_id_idx` (`block_id`), PRIMARY KEY(`id`) ) ENGINE = INNODB; The schema.yml entry is the following: {code} CustomCategory: connection: removed tableName: custom_category actAs: Sluggable: fields: [name] uniqueBy: [block_id, name] canUpdate: true columns: id: type: integer(4) unsigned: true notnull: true primary: true autoincrement: true name: type: string(255) notnull: true block_id: type: integer(4) unsigned: true notnull: true relations: Products: class: Product foreignAlias: CustomCategories refClass: ProductCustomCategory Block: class: Block local: block_id foreign: id foreignType: many foreignAlias: CustomCategories type: one {code} And finally the appropriate auto generated base class (removed doc block): {code} <?php // Connection Component Binding Doctrine_Manager::getInstance()->bindComponent('CustomCategory', 'removed'); abstract class BaseCustomCategory extends aaDoctrineRecord { public function setTableDefinition() { $this->setTableName('custom_category'); $this->hasColumn('id', 'integer', 4, array( 'type' => 'integer', 'unsigned' => true, 'primary' => true, 'autoincrement' => true, 'length' => '4', )); $this->hasColumn('name', 'string', 255, array( 'type' => 'string', 'notnull' => true, 'length' => '255', )); $this->hasColumn('block_id', 'integer', 4, array( 'type' => 'integer', 'unsigned' => true, 'notnull' => true, 'length' => '4', )); } public function setUp() { parent::setUp(); $this->hasMany('Product as Products', array( 'refClass' => 'ProductCustomCategory', 'local' => 'custom_category_id', 'foreign' => 'product_id')); $this->hasOne('Block', array( 'local' => 'block_id', 'foreign' => 'id')); $sluggable0 = new Doctrine_Template_Sluggable(array( 'fields' => array( 0 => 'name', ), 'uniqueBy' => array( 0 => 'block_id', 1 => 'name', ), 'canUpdate' => true, )); $this->actAs($sluggable0); } } {code} |
Daniel König
made changes -
| Description |
Basically the slug column doesn't get updated in spite of all fields being added correctly, as far as i can tell. What's been missing is the 'slug' column value in the sql statements (providing 3 examples): 2400 Query INSERT INTO `custom_category` (`block_id`, `name`) VALUES ('1', 'slug test') 2526 Query INSERT INTO `custom_category` (`name`, `block_id`) VALUES ('please do work..', '1') 2560 Query UPDATE `custom_category` SET `name` = 'still not ok' WHERE `id` = '12' -- both insert and update statements should also contain a slug column and the respective value. The generated schema.sql includes the correct create table statement (it's also correctly inserted in the db): CREATE TABLE `custom_category` ( `id` INT UNSIGNED AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL, `block_id` INT UNSIGNED NOT NULL, `slug` VARCHAR(255), UNIQUE INDEX `custom_category_sluggable_idx` (`slug`, `block_id`, `name`), INDEX `block_id_idx` (`block_id`), PRIMARY KEY(`id`) ) ENGINE = INNODB; The schema.yml entry is the following: {code} CustomCategory: connection: removed tableName: custom_category actAs: Sluggable: fields: [name] uniqueBy: [block_id, name] canUpdate: true columns: id: type: integer(4) unsigned: true notnull: true primary: true autoincrement: true name: type: string(255) notnull: true block_id: type: integer(4) unsigned: true notnull: true relations: Products: class: Product foreignAlias: CustomCategories refClass: ProductCustomCategory Block: class: Block local: block_id foreign: id foreignType: many foreignAlias: CustomCategories type: one {code} And finally the appropriate auto generated base class (removed doc block): {code} <?php // Connection Component Binding Doctrine_Manager::getInstance()->bindComponent('CustomCategory', 'removed'); abstract class BaseCustomCategory extends aaDoctrineRecord { public function setTableDefinition() { $this->setTableName('custom_category'); $this->hasColumn('id', 'integer', 4, array( 'type' => 'integer', 'unsigned' => true, 'primary' => true, 'autoincrement' => true, 'length' => '4', )); $this->hasColumn('name', 'string', 255, array( 'type' => 'string', 'notnull' => true, 'length' => '255', )); $this->hasColumn('block_id', 'integer', 4, array( 'type' => 'integer', 'unsigned' => true, 'notnull' => true, 'length' => '4', )); } public function setUp() { parent::setUp(); $this->hasMany('Product as Products', array( 'refClass' => 'ProductCustomCategory', 'local' => 'custom_category_id', 'foreign' => 'product_id')); $this->hasOne('Block', array( 'local' => 'block_id', 'foreign' => 'id')); $sluggable0 = new Doctrine_Template_Sluggable(array( 'fields' => array( 0 => 'name', ), 'uniqueBy' => array( 0 => 'block_id', 1 => 'name', ), 'canUpdate' => true, )); $this->actAs($sluggable0); } } {code} |
Basically the slug column doesn't get updated in spite of all fields being added correctly, as far as i can tell. It seems to be related to additional options because when i don't have either of the uniqueBy or canUpdate options specified, it just works. What's been missing is the 'slug' column value in the sql statements (providing 3 examples): {code} 2400 Query INSERT INTO `custom_category` (`block_id`, `name`) VALUES ('1', 'slug test') 2526 Query INSERT INTO `custom_category` (`name`, `block_id`) VALUES ('please do work..', '1') 2560 Query UPDATE `custom_category` SET `name` = 'still not ok' WHERE `id` = '12' {code} The generated schema.sql includes the correct create table statement (it's also correctly inserted in the db): {code} CREATE TABLE `custom_category` ( `id` INT UNSIGNED AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL, `block_id` INT UNSIGNED NOT NULL, `slug` VARCHAR(255), UNIQUE INDEX `custom_category_sluggable_idx` (`slug`, `block_id`, `name`), INDEX `block_id_idx` (`block_id`), PRIMARY KEY(`id`) ) ENGINE = INNODB; {code} The schema.yml entry is the following: {code} CustomCategory: connection: removed tableName: custom_category actAs: Sluggable: fields: [name] uniqueBy: [block_id, name] canUpdate: true columns: id: type: integer(4) unsigned: true notnull: true primary: true autoincrement: true name: type: string(255) notnull: true block_id: type: integer(4) unsigned: true notnull: true relations: Products: class: Product foreignAlias: CustomCategories refClass: ProductCustomCategory Block: class: Block local: block_id foreign: id foreignType: many foreignAlias: CustomCategories type: one {code} And finally the appropriate auto generated base class (removed doc block): {code} <?php // Connection Component Binding Doctrine_Manager::getInstance()->bindComponent('CustomCategory', 'removed'); abstract class BaseCustomCategory extends aaDoctrineRecord { public function setTableDefinition() { $this->setTableName('custom_category'); $this->hasColumn('id', 'integer', 4, array( 'type' => 'integer', 'unsigned' => true, 'primary' => true, 'autoincrement' => true, 'length' => '4', )); $this->hasColumn('name', 'string', 255, array( 'type' => 'string', 'notnull' => true, 'length' => '255', )); $this->hasColumn('block_id', 'integer', 4, array( 'type' => 'integer', 'unsigned' => true, 'notnull' => true, 'length' => '4', )); } public function setUp() { parent::setUp(); $this->hasMany('Product as Products', array( 'refClass' => 'ProductCustomCategory', 'local' => 'custom_category_id', 'foreign' => 'product_id')); $this->hasOne('Block', array( 'local' => 'block_id', 'foreign' => 'id')); $sluggable0 = new Doctrine_Template_Sluggable(array( 'fields' => array( 0 => 'name', ), 'uniqueBy' => array( 0 => 'block_id', 1 => 'name', ), 'canUpdate' => true, )); $this->actAs($sluggable0); } } {code} |