[DC-724] Blameable relations import problem Created: 09/Jun/10  Updated: 13/Jul/10

Status: Open
Project: Doctrine 1
Component/s: Extensions, Import/Export
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Gordon Franke Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

symfony 1.4.5 with latest doctrine 1.2 branch with sfDoctrineGuardPlugin



 Description   

The import works only when i DISABLE the update relation. When i activate the update relation i get an sql error

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`clubicious`.`location`, CONSTRAINT `location_updated_by_sf_guard_user_id` FOREIGN KEY (`updated_by`) REFERENCES `sf_guard_user` (`id`))

The relation is created correct i think the problem is in the importer???

Location:
actAs:
Timestampable: ~
Sortable: ~
Blameable:
columns:
created:
length: null
updated:
length: null
relations:
created:
disabled: false
class: sfGuardUser
updated:
disabled: false
class: sfGuardUser
columns:
name:

{ type: string(255), notnull: true }

My fixtures:
sfGuardUser:
gfranke:
id: 1
first_name: Gordon
last_name: Franke
email_address: franke@clubicious.com
username: gfranke
password: startgf
Location:
location_atomic:
name: Atomic Cafe
CreatedBy: gfranke
UpdatedBy: gfranke

location_max:
name: Max & Moritz
CreatedBy: gfranke
UpdatedBy: gfranke



 Comments   
Comment by Tim Schofield [ 13/Jul/10 ]

Same Problem with Doctrine 1.2.2 and Zend Framework 1.10

Work around for me was to disable all Blameable relations in my schema.yml

Then run

./doctrine build-all-reload

So that fixtures can load

Then enable all Blameable relations in the schema.yml

and run

./doctrine generate-models-yaml

So models are generated with the correct relations

Regards

Tim





[DC-634] getPopularTags() query fails on Postgresql Created: 15/Apr/10  Updated: 15/Apr/10

Status: Open
Project: Doctrine 1
Component/s: Extensions
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: admirau Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Windows, Postgresql



 Description   

When I run:
Doctrine::getTable('TaggableTag')->getPopularTags();
I get: ERROR: column "i2__1" does not exist

The failing query on PostgreSql is:

SELECT t.id AS t_id, t.name AS tname, COUNT(DISTINCT i.id) AS i_0,
(COUNT(DISTINCT i.id)) AS i__1
FROM taggable_tag t
LEFT JOIN cms_model_image_taggable_tag c ON (t.id = c.tag_id)
LEFT JOIN image i ON i.id = c.id
WHERE t.id IN
(SELECT doctrine_subquery_alias.id
FROM
(SELECT DISTINCT t2.id, (COUNT(DISTINCT i2.id)) AS i2__1
FROM taggable_tag t2
LEFT JOIN cms_model_image_taggable_tag c2 ON (t2.id = c2.tag_id)
LEFT JOIN image i2 ON i2.id = c2.id
GROUP BY t2.id HAVING i2__1 > 0
ORDER BY i2__1 DESC LIMIT 10) AS doctrine_subquery_alias)
GROUP BY t.id HAVING i__1 > 0
ORDER BY i__1 DESC

Seems that this just a PostgreSql issue.
On Mysql it runs just fine.

The corrected, working query is:

SELECT t.id AS t_id, t.name AS tname, COUNT(DISTINCT i.id) AS i_0,
(COUNT(DISTINCT i.id)) AS i__1
FROM taggable_tag t
LEFT JOIN cms_model_image_taggable_tag c ON (t.id = c.tag_id)
LEFT JOIN image i ON i.id = c.id
WHERE t.id IN
(SELECT doctrine_subquery_alias.id
FROM
(SELECT DISTINCT t2.id, (COUNT(DISTINCT i2.id)) AS i2__1
FROM taggable_tag t2
LEFT JOIN cms_model_image_taggable_tag c2 ON (t2.id = c2.tag_id)
LEFT JOIN image i2 ON i2.id = c2.id
GROUP BY t2.id HAVING COUNT(DISTINCT i2.id) > 0
ORDER BY i2__1 DESC LIMIT 10) AS doctrine_subquery_alias)
GROUP BY t.id, t.name HAVING COUNT(DISTINCT i.id) > 0
ORDER BY i__1 DESC

For more details, please read the discussion here:
http://stackoverflow.com/questions/2647537/doctrine-sql-query-works-on-mysql-on-postgresql-wont






[DC-486] Taggable extension bound to inherited class also binds to all classes, which extend the base one Created: 08/Feb/10  Updated: 08/Feb/10

Status: Open
Project: Doctrine 1
Component/s: Extensions
Affects Version/s: 1.2.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Alexander Panshin Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

php5.2.11, symfony 1.4, Doctrine 1.2, Taggable 1.0



 Description   

This is my schema.yml:

Tale:
actAs:
Taggable:
columns: # there are some not interesting columns

FolkTale:
inheritance:
extends: Tale
type: column_aggregation
keyField: type
keyValue: folk
columns:
folk_id: integer
relations:
Folk:
class: Folk
local: folk_id
foreign: id
type: one
onDelete: CASCADE

AuthoredTale:
inheritance:
extends: Tale
type: column_aggregation
keyField: type
keyValue: authored
columns:
author_id: integer
relations:
Author:
class: Author
local: author_id
foreign: id
type: one
onDelete: CASCADE

When I do ./symfony doctrine:build --all I see three *_taggable_tag table in my DB (folk_tale_taggable_tag, authored_tale_taggable_tag and tale_tag) instead of expected one tale_tag.






[DC-440] doctrine migration fails with taggable extension Created: 20/Jan/10  Updated: 22/Jan/10

Status: Open
Project: Doctrine 1
Component/s: Extensions, Migrations
Affects Version/s: 1.2.0, 1.2.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Robert Gruendler Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 1
Labels: None
Environment:

osx 10.6, apache 2, php 5.3, symfony 1.4



 Description   

When adding the Taggable behaviour to an entity, the doctrine migration fails (i'm using the symfony task) with the follwing error:

>> doctrine Migrating from version 0 to 1

The following errors occurred:

  • SQLSTATE[23000]: Integrity constraint violation: 1217 Cannot delete or update a parent row: a foreign key constraint fails. Failing Query: "DROP TABLE taggable_tag"

I have a single entity in my schema, with the Taggable behavior attached:

Article:
actAs:
Taggable: ~ 
columns:
title:

{ type: string(255), notnull: true }

body:

{ type: clob }

The Version1 class which was generate by the generate-migrations-diff task looks like this:

<?php
/**

  • This class has been auto-generated by the Doctrine ORM Framework
    */
    class Version1 extends Doctrine_Migration_Base
    {
    public function up() { $this->dropTable('taggable_tag'); }

public function down()

{ $this->createTable('taggable_tag', array( 'id' => array( 'type' => 'integer', 'length' => '8', 'autoincrement' => '1', 'primary' => '1', ), 'name' => array( 'unique' => '1', 'type' => 'string', 'length' => '255', ), ), array( 'type' => '', 'indexes' => array( ), 'primary' => array( 0 => 'id', ), 'collate' => '', 'charset' => '', )); }

}



 Comments   
Comment by Robert Gruendler [ 22/Jan/10 ]

i think i found the reason for this. The sfDoctrineGenerateMigrationsDiffTask seems to build it's diff from yml schema files:

protected function execute()....

$this->callDoctrineCli('generate-migrations-diff', array(
'yaml_schema_path' => $this->prepareSchemaFile($config['yaml_schema_path']),
));

The task does not know anything about the models in the doctrine_extensions folder, and there are no yaml files for their
schema, so symfony migration tasks won't work with extensions.

It would be great if this would be mentioned somewhere in the docs of the extensions.





[DC-438] Nesting Taggable and I18N Created: 19/Jan/10  Updated: 19/Jan/10

Status: Open
Project: Doctrine 1
Component/s: Extensions, I18n
Affects Version/s: 1.2.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Sorin Neacsu Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 1
Labels: None
Environment:

PHP 5.2.6, MySQL 5.0.75, Symfony 1.3.1



 Description   

The Taggable extension doesnt work correctly when nested under I18N.
The page_translation_taggable_tag table appears to be correctly created, it has 3 columns: id, lang, tag_id
But when you save a tag like this
$page->Translation['en']->setTags('tag 1, tag2');
the lang column in page_translation_taggable_tag is empty
and this doesnt work either:
$page->setTags('tag 1, tag2');

Schema is this:
Page:
actAs:
I18n:
fields: [title, contents]
actAs:
Taggable: ~
columns:
title:

{type: string(255), notnull: true}

contents: clob






[DC-67] Taggable not working Created: 28/Sep/09  Updated: 15/Apr/10

Status: Reopened
Project: Doctrine 1
Component/s: Extensions
Affects Version/s: 1.2.0-ALPHA1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: admirau Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 4
Labels: None
Environment:

PHP 5.2.8, Doctrine 1.2.0 Alpha1, Vista, Sandbox 1.2.0 Alpha1



 Description   

After enabling Taggable extension, magic methods on the tables (e.g. getPopularTags)
cannot be reached:

Doctrine::getTable('Upload')->getPopularTags();

Fatal error: Uncaught exception 'Doctrine_Table_Exception' with message 'Unknown method Doctrine_Table::getPopularTags' in C:\Users\user\www\extens.dev\lib\Doctrine\Table.php:2608 Stack trace: #0 [internal function]: Doctrine_Table->__call('getPopularTags', Array) #1 C:\Users\user\www\extens.dev\index.php(7): Doctrine_Table->getPopularTags() #2

{main}

thrown in C:\Users\user\www\extens.dev\lib\Doctrine\Table.php on line 2608



 Comments   
Comment by admirau [ 08/Oct/09 ]

The same with Alpha2

Comment by admirau [ 10/Oct/09 ]

Running the tests results in one failure:

Doctrine Unit Tests
===================
Doctrine_Template_Taggable_TestCase.............................................failed

Unexpected Doctrine_Connection_Sqlite_Exception thrown in [Doctrine_Template_Taggable_TestCase] with message [SQLSTATE[HY000]: General error: 1 no such column: a__2] in C:\Users\user\www\extens.dev\lib\Doctrine\Connection.php on line 1067

Trace
-------------

#0 C:\Users\user\www\extens.dev\lib\Doctrine\Connection.php(1015): Doctrine_Connection->rethrowException(Object(PDOException), Object(Doctrine_Connection_Sqlite))
#1 C:\Users\user\www\extens.dev\lib\Doctrine\Query\Abstract.php(936): Doctrine_Connection->execute('SELECT t.id AS ...', Array)
#2 C:\Users\user\www\extens.dev\lib\Doctrine\Query\Abstract.php(990): Doctrine_Query_Abstract->_execute(Array)
#3 C:\Users\user\www\extens.dev\tools\sandbox\extensions\Taggable\lib\Doctrine\Template\TaggableTag.php(76): Doctrine_Query_Abstract->execute(Array, 2)
#4 [internal function]: Doctrine_Template_TaggableTag->getPopularTagsTableProxy(Array)
#5 C:\Users\user\www\extens.dev\lib\Doctrine\Record.php(2569): call_user_func_array(Array, Array)
#6 [internal function]: Doctrine_Record->__call('getPopularTagsT...', Array)
#7 [internal function]: TaggableTag->getPopularTagsTableProxy(Array)
#8 C:\Users\user\www\extens.dev\lib\Doctrine\Table.php(2605): call_user_func_array(Array, Array)
#9 [internal function]: Doctrine_Table->__call('getPopularTags', Array)
#10 C:\Users\user\www\extens.dev\tools\sandbox\extensions\Taggable\tests\Template\TaggableTestCase.php(216): Doctrine_Table->getPopularTags(Array)
#11 C:\Users\user\www\extens.dev\tests\DoctrineTest\UnitTestCase.php(144): Doctrine_Template_Taggable_TestCase->testGetPopularTags()
#12 C:\Users\user\www\extens.dev\tests\DoctrineTest\GroupTest.php(61): UnitTestCase->run()
#13 C:\Users\user\www\extens.dev\tests\DoctrineTest.php(180): GroupTest->run(Object(DoctrineTest_Reporter_Cli), '')
#14 C:\Users\user\www\extens.dev\tools\sandbox\extensions\Taggable\tests\run.php(29): DoctrineTest->run()
#15

{main}

Tested: 1 test cases.
Successes: 26 passes.
Failures: 1 fails.
Number of new Failures: 0
Number of fixed Failures: 0

Tests ran in 1 seconds and used 15279.15625 KB of memory

Comment by Jonathan H. Wage [ 03/Nov/09 ]

The tests all pass now.

http://www.doctrine-project.org/extension/Taggable/1_2-1_0/tests

Comment by admirau [ 04/Nov/09 ]

It still does not work on my environment (Windows or Ubuntu 9.10, PHP 5.3/5.2.6)
The test result is a bit different, but still fails:

Doctrine Unit Tests
===================
Doctrine_Template_Taggable_TestCase.............................................failed

Unexpected Doctrine_Record_UnknownPropertyException thrown in [Doctrine_Template_Taggable_TestCase] with message [Unknown record property / related component "total_num" on "TaggableTag"] in /home/user/doctrine12b/lib/Doctrine/Record/Filter/Standard.php on line 55

Trace
-------------

#0 /home/taat/doctrine12b/lib/Doctrine/Record.php(1359): Doctrine_Record_Filter_Standard->filterGet(Object(TaggableTag), 'total_num')
#1 /home/taat/doctrine12b/lib/Doctrine/Record.php(1318): Doctrine_Record->_get('total_num', true)
#2 /home/taat/doctrine12b/lib/Doctrine/Access.php(117): Doctrine_Record->get('total_num')
#3 /home/taat/doctrine12b/tools/sandbox/extensions/Taggable/tests/Template/TaggableTestCase.php(217): Doctrine_Access->offsetGet('total_num')
#4 /home/taat/doctrine12b/tests/DoctrineTest/UnitTestCase.php(144): Doctrine_Template_Taggable_TestCase->testGetPopularTags()
#5 /home/taat/doctrine12b/tests/DoctrineTest/GroupTest.php(61): UnitTestCase->run()
#6 /home/taat/doctrine12b/tests/DoctrineTest.php(180): GroupTest->run(Object(DoctrineTest_Reporter_Cli), '')
#7 /home/taat/doctrine12b/tools/sandbox/extensions/Taggable/tests/run.php(29): DoctrineTest->run()
#8

{main}

Tested: 1 test cases.
Successes: 26 passes.
Failures: 1 fails.
Number of new Failures: 0
Number of fixed Failures: 0

Comment by Jonathan H. Wage [ 04/Nov/09 ]

Did you update Doctrine? I fixed something in Doctrine 1.2 that fixes it.

Comment by admirau [ 04/Nov/09 ]

Yes, the results above ("total_num") I get after updating to 1.2.0-BETA1.
At 1.2.0-ALPHA2 it was "no such column: a__2" (see above comments).

Do the extensions work with 2.0, or they are 1.2 specific?

Comment by Jonathan H. Wage [ 04/Nov/09 ]

1.2 specific. I don't get any fails now, can you try and troubleshoot it and figure out why it fails for you? They don't fail for me anywhere.

Comment by admirau [ 04/Nov/09 ]

Doctrine_Template_Taggable_TestCase::testGetPopularTags()
line 214:
$test = Doctrine::getTable('TaggableTag')->getPopularTags(array('ArticleTaggableTest', 'ArticleTaggableTest2'));

// compare this with your results
echo serialize($test);
result:
C:19:"Doctrine_Collection":169:{a:7:{s:4:"data";a:0:{}s:6:"_table";s:11:"TaggableTag";s:9:"_snapshot";a:0:{}s:14:"referenceField";N;s:9:"keyColumn";s:4:"name";s:8:"_locator";N;s:10:"_resources";a:0:{}}}

When I try to var_dump($test),
I get circular dependency.
I tried to save results of var_dump($test) to disk, by I get 1,5GB file, and still growing...

Maybe this article helps somehow:
http://www.bigroom.co.uk/blog/php-nesting-level-too-deep-recursive-dependency

Can I see the fix you mentioned above?

I'm sorry, but I do not know what else I can do.
Any ideas?

Comment by Jonathan H. Wage [ 10/Nov/09 ]

I am not sure what to say since it is working for me on all the machines I test. I'll be happy to look if I can get something to fail so I can troubleshoot it.

Comment by admirau [ 11/Nov/09 ]

I've tested on PLD Linux too.
The same thing.

Could you provide sample server/php configuration on which the tests are passing?

Can you describe the fix you've made to correct the errors with ''Unknown method Doctrine_Table::getPopularTags'.
Maybe I can manage to investigate it, but I do not know where to start.

Comment by admirau [ 11/Nov/09 ]

Sorry for reopening this again.

After upgrading to BETA2 all Taggable tests are passing OK for me too.

However, in the code I still get 'Unknown method BlogPostTable::getPopularTags' in /tools\sandbox\lib\Doctrine\Table.php:2793'
Isn't it a regression of the bug you've already fixed before ALPHA2?

Here is the description of how I came to this exception.

At the very end of config.php:

$manager->registerExtension('Taggable');

In the index.php:

<?php

require_once('config.php');

$models = Doctrine_Core::loadModels('models');

$post = new BlogPost();
$post->title = 'This is a sample blog post';
$post->description = 'Cool!';
$post->setTags('2009, symfony, doctrine');
$post->save();

$table = Doctrine::getTable('BlogPost');
echo get_class($table); // echoes Doctrine_Collection
$table->getPopularTags(); // this throws the exception

Then in the console:
php doctrine.php create-db
php doctrine.php generate-models-yaml (BaseBlogPost, BlogPost, BlogPostTable were generated)
php doctrine.php generate-sql (see SQL below)
php doctrine.php create-tables
(all ok)

php index.php

result:

BlogPostTablePHP Fatal error: Uncaught exception 'Doctrine_Table_Exception' with message 'Unknown method BlogPostTable::getPopularTags' in C:\Users\user\www\extens.dev\tools\sandbox\lib\Doctrine\Table.php:2793
Stack trace:
#0 [internal function]: Doctrine_Table->__call('getPopularTags', Array)
#1 C:\Users\user\www\extens.dev\tools\sandbox\index.php(15): BlogPostTable->getPopularTags()
#2

{main}
thrown in C:\Users\user\www\extens.dev\tools\sandbox\lib\Doctrine\Table.php on line 2793
Fatal error: Uncaught exception 'Doctrine_Table_Exception' with message 'Unknown method BlogPostTable::getPopularTags' in C:\Users\user\www\extens.dev\tools\sandbox\lib\Doctrine\Table.php:2793
Stack trace:
#0 [internal function]: Doctrine_Table->__call('getPopularTags', Array)
#1 C:\Users\user\www\extens.dev\tools\sandbox\index.php(15): BlogPostTable->getPopularTags()
#2 {main}

thrown in C:\Users\user\www\extens.dev\tools\sandbox\lib\Doctrine\Table.php on line 2793

And here is the generated SQL:

CREATE TABLE taggable_tag (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255) UNIQUE);
CREATE TABLE blog_post_taggable_tag (id INTEGER, tag_id INTEGER, PRIMARY KEY(id, tag_id));
CREATE TABLE blog_post (id INTEGER PRIMARY KEY AUTOINCREMENT, title VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL);

Comment by Jonathan H. Wage [ 12/Nov/09 ]

When I test your code, it is working for me. You sure you don't have some old versions of PHP or something?

Comment by admirau [ 12/Nov/09 ]

Everything is up to date.
Tested on different servers, with different operating systems, different versions PHP, different versions of Doctrine, by different people.

Common thing for all these machines is that PHP (>5.2.10 <= 5.3.1) was installed from precompiled builds, not from source.

The error I get now is the same error I got earlier (at the beginning of this topic), which disapperared after your fix.
Then appeared the second error, which was fixed in BETA2, but the previous error is back. (strange, but the tests are passing now, despite the errors in the regular code).

When I find some spare time I'll try to trace the changes you've made since the beginning of the topic.

Comment by admirau [ 18/Nov/09 ]

Maybe the models are generated not properly.
Here are my models (three) for the reproduction procedure (above):

class BlogPostTable extends Doctrine_Table {}

class BlogPost extends BaseBlogPost {}

abstract class BaseBlogPost extends Doctrine_Record
{
public function setTableDefinition()

{ $this->setTableName('blog_post'); $this->hasColumn('title', 'string', 255, array( 'type' => 'string', 'notnull' => true, 'length' => '255', )); $this->hasColumn('description', 'string', 255, array( 'type' => 'string', 'notnull' => true, 'length' => '255', )); }

public function setUp()

{ parent::setUp(); $taggable0 = new Doctrine_Template_Taggable(); $this->actAs($taggable0); }

}

Comment by Jonathan H. Wage [ 18/Nov/09 ]

I have everything generated the same as you.

Comment by Benjamin Arthur Lupton [ 21/Nov/09 ]

Also getting this. Using doctrine 1.2.0-beta3 and also tried with latest SVN. Taggable is latest available.

PHP 5.3.0 running on Zend Server version 5.0.0Beta2

Comment by admirau [ 24/Nov/09 ]

No changes after upgrade to 1.2.0-RC1.

Comment by admirau [ 24/Nov/09 ]

Maybe this helps somehow:

// Following line throws:
// Doctrine_Table_Exception: Unknown method Doctrine_Table::getPopularTags in /home/user/doctrine12rc1/lib/Doctrine/Table.php on line 2799
$tags = Doctrine::getTable('BlogPost')->getPopularTags();

// This line returns collection of tags, as expected
$tags = Doctrine::getTable('TaggableTag')->getPopularTags('BlogPost');

$rel = Doctrine::getTable('BlogPost')->getRelations(); // is int(2)
$rel = Doctrine::getTable('TagableTag')->getRelations(); // is int(2)

Comment by Brian Smith [ 16/Dec/09 ]

Symfony 1.3 SVN updated as of this post.

Ubuntu Karmic with PHP 5.3.1

I have installed Taggable in mysymfonyproject/lib/doctrine_extensions/Taggable

I have two example tables defined with Taggable:

Video:
actAs:

{ Taggable: ~, Timestampable: ~ }

columns:
id:

{ type: integer, primary: true, autoincrement: true }

content_id:

{ type: integer, notnull: true }

title:

{ type: string(255) }

description:

{ type: clob }

relations:
Content:

{ local: content_id, foreign: id }

Photo:
actAs:

{ Taggable: ~, Timestampable: ~ }

columns:
id:

{ type: integer, primary: true, autoincrement: true }

content_id:

{ type: integer, notnull: true }

title:

{ type: string(255) }

description:

{ type: clob }

uri:

{ type: string(255) }

relations:
Content:

{ local: content_id, foreign: id }

The following code functions and populates the database:
$video = new Video();
...
$video->setTags(implode(", ", $tags));
$video->save();

The following code errors:
$tags = Doctrine::getTable('Video')->getPopularTags();

500 | Internal Server Error | Doctrine_Table_Exception
Unknown method VideoTable::getPopularTags

The following code errors:
$tags = Doctrine::getTable('TaggableTag')->getPopularTags('Video');

500 | Internal Server Error | Doctrine_Exception
Couldn't find class TagableTag

Comment by Sorin Neacsu [ 20/Jan/10 ]

Dont know if its related to this issue or not, but for some reason Doctrine::getTable('TaggableTag') throws a "

{Doctrine_Exception}

Couldn't find class TaggableTag" exception

I understand that you would normally do this:
Doctrine::getTable('Video')->getTags()
but I just want plain access to the TaggableTag model and Doctrine doesnt seem to generate any model classess for TaggableTag

Comment by Jonathan H. Wage [ 01/Mar/10 ]

I have tested everything everyone has provided and it is all working for me. The only thing I can suggest now is that someone creates a Doctrine failing test case so that I can run it to see the failure.

Comment by Benjamin Arthur Lupton [ 01/Mar/10 ]

Will create a test case this weekend for this and a few other problems I've across (with fixes). Nothing more frustrating than not being able to reproduce a problem, so I feel your pain.

Comment by Ivar Nesje [ 02/Mar/10 ]

I think this bug i related to the bug in the documentation http://www.doctrine-project.org/jira/browse/DC-378 to get the popular tags you will first have to load the models you want the tags for.

// load models that you want the tags from
Doctrine::getTable('blog');
Doctrine::getTable('products');
// then you can get the tags for the models currently loaded
$tags = Doctrine::getTable('TaggableTag')->getPopularTags();
Comment by Brian Smith [ 07/Mar/10 ]

This works for me:

// load models that you want the tags from
Doctrine::getTable('blog');
Doctrine::getTable('products');
// then you can get the tags for the models currently loaded
$tags = Doctrine::getTable('TaggableTag')->getPopularTags();

Comment by Benjamin Arthur Lupton [ 01/Apr/10 ]

Okie... Creating test cases for this turned out to be more complicated than I can handle - myself not being that familiar with phpunit.
Although within the test it is written as:
$test = Doctrine::getTable('TaggableTag')->getPopularTags(array('ArticleTaggableTest', 'ArticleTaggableTest2'));
Rather than:
$test = Doctrine::getTable('ArticleTaggableTest')->getPopularTags();
which is what this problem is about.

Although I do believe I've nailed the source of the problem - as well as others I've experienced.

Having either of the above causes the system to fall down. I've applied a bunch of fixes/changes to taggable to ensure it works with my systems, such as http://sos.7dots.co.uk/ (still in staging) which uses all of the above mentioned problems, not sure how to do a diff but here is the file:
http://www.2shared.com/file/12385197/c5911e42/Taggable.html

Hope that helps some people. Any changes I've made code can come under the same licence as doctrine, so no worries there.

Comment by admirau [ 15/Apr/10 ]

With 1.2.2 there is some progress.
There was still 1 test failing (CASCADE),
but with the version:
http://www.2shared.com/file/12385197/c5911e42/Taggable.html
provided by Benjamin Arthur Lupton
all test are passing now.

But now when I run:
getTable('ArticleTaggableTest')->getPopularTags();
I get: ERROR: column "i2__1" does not exist

The failing query on PostgreSql is:

SELECT t.id AS t_id, t.name AS tname, COUNT(DISTINCT i.id) AS i_0,
(COUNT(DISTINCT i.id)) AS i__1
FROM taggable_tag t
LEFT JOIN cms_model_image_taggable_tag c ON (t.id = c.tag_id)
LEFT JOIN image i ON i.id = c.id
WHERE t.id IN
(SELECT doctrine_subquery_alias.id
FROM
(SELECT DISTINCT t2.id, (COUNT(DISTINCT i2.id)) AS i2__1
FROM taggable_tag t2
LEFT JOIN cms_model_image_taggable_tag c2 ON (t2.id = c2.tag_id)
LEFT JOIN image i2 ON i2.id = c2.id
GROUP BY t2.id HAVING i2__1 > 0
ORDER BY i2__1 DESC LIMIT 10) AS doctrine_subquery_alias)
GROUP BY t.id HAVING i__1 > 0
ORDER BY i__1 DESC

Seems that this just a PostgreSql issue.
On Mysql it runs just fine.

Comment by Ivar Nesje [ 15/Apr/10 ]

The last comment is concerning how the poular tags are found and rated (on PostgreSql). I think this is unrelated to the rest of this issue and should be moved to a separate issue. (also I only got junk ads when I tried to get the file you are linking to).

Comment by admirau [ 15/Apr/10 ]

I have created separated issue for this:
http://www.doctrine-project.org/jira/browse/DC-634

And yes, this link is quite odd...
There is a lot of crap,
however there is a small link, to download improved code:

Look for: "Save file to your PC: click here"





Generated at Fri Nov 28 05:58:00 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.