Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tag Count Not Being Stored in Database #26

Open
larry-tx opened this issue Mar 1, 2014 · 0 comments
Open

Tag Count Not Being Stored in Database #26

larry-tx opened this issue Mar 1, 2014 · 0 comments

Comments

@larry-tx
Copy link

larry-tx commented Mar 1, 2014

I've enabled the "count" column in the behavior and have the appropriate field in the table. When I add a tag to a model, the tag gets stored in the appropriate table and an appropriate entry is made in the join table, but there is no entry made in the "count" column in the table. (By the way, I'm calling my "count" column _frequency_.)

My behavior looks like this:

public function behaviors() {
            return array(
                'tags_with_model' => array(
                    'class'                   => 'ext.yiiext.behaviors.model.taggable.ETaggableBehavior',
                    'tagTable'                => 'tag',
                    'tagBindingTable'         => 'disks_tag',
                    'modelTableFk'            => 'disksId',
                    'tagTablePk'              => 'id',
                    'tagTableCount'           => 'frequency',
                    'tagBindingTableTagId'    => 'tagId',
                    'createTagsAutomatically' => TRUE,
                ),
            );
        }

If it makes any differences, my tag and join tables look like this:

CREATE TABLE `tag` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `frequency` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `IDX_tag_name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=utf8;

CREATE TABLE `disks_tag` (
  `disksId` int(11) NOT NULL,
  `tagId` int(11) NOT NULL,
  PRIMARY KEY (`disksId`,`tagId`),
  KEY `FK_tags_disks` (`tagId`),
  CONSTRAINT `FK_disks_tags` FOREIGN KEY (`disksId`) REFERENCES `disks` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_tags_disks` FOREIGN KEY (`tagId`) REFERENCES `tag` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

I'd greatly appreciate it if anyone could help me with what I might need to do to get the frequency column to update in my _tag_ table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant