There are some stuff which has to be fixed. There are some wrong named tables etc.

Here is a first version

Comments

lefnire’s picture

Status: Needs work » Needs review

More info on this: when you create a Term view (taxonomy as base taxonomy), create page of it, visit that page -- you get the following error:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'd7.term_data' doesn't exist: SELECT term_data.name AS term_data_name, term_data.vid AS term_data_vid, term_data.tid AS tid, term_data.description AS term_data_description FROM {term_data} term_data; Array ( )  in views_plugin_pager->execute_count_query()  (line 141 of /Users/renelle/workspace/d7/sites/all/modules/views/plugins/views_plugin_pager.inc).

It seems similar to #763650: PDOException: SQLSTATE[42S02] and #784144: Sort by taxonomy term name throws PDO exception, table not found -- the problem being that some tables were renamed in D7 and not updated in views7. This patch works for me. (How do you trigger simpletest on uploaded patches?)

dawehner’s picture

Status: Needs review » Needs work

But this sadly still needs work

dawehner’s picture

StatusFileSize
new17.59 KB

This is a minor improvement. Still term_node -> taxonomy_index has to be done.

dawehner’s picture

The central problem here:

Taxonomy_index uses nid, but term_node uses vid, so quite some stuff would have to be changed.

DeFr’s picture

Status: Needs work » Needs review
StatusFileSize
new20.29 KB

Ok, found this issue when playing with Views on Drupal 7 which prevented further work on a test site, so I took a stab at it. The patch attached is thus the one attached in #3 plus the necessary rename from term_node to taxonomy_index, and takes care of the vid => nid renaming.

It makes the default Taxonomy view almost usable (yeah !), if it weren't for the fact that the node "Published or admin" filter seems completely broken in a fresh checkout, but I'll fill a new issue for that if I don't find an already existing one.

There's something else that seems broken, as I get Notice: Undefined index: validate_argument_transform dans views_plugin_argument_validate_taxonomy_term->convert_options() (line 68 of /var/www/ows/serie/sites/all/modules/views.git/modules/taxonomy when viewing the page. I haven't looked into it yet, but I'll do if no one beats me to it.

Finally, due to the fact that taxonomy_index no longer contains a vid, but only an nid, there's no way anymore to establish a direct relationship between taxonomy_term_data and node_revisions, like the code used to in D6. I suppose it's ok, as you should be able to add two relationships, to go from node_revision to node and then from node to term, but maybe that should be taken care of in the conversion process ?

DeFr’s picture

Found the "Published or admin" issue, its #799604: Complex views no longer work, won't talk about it here anymore.

dawehner’s picture

Finally, due to the fact that taxonomy_index no longer contains a vid, but only an nid, there's no way anymore to establish a direct relationship between taxonomy_term_data and node_revisions, like the code used to in D6. I suppose it's ok, as you should be able to add two relationships, to go from node_revision to node and then from node to term, but maybe that should be taken care of in the conversion process ?

Thats not totally true. The fieldapi integration has everything you need for relationships/filters/arguments. You can use them. The problem is just, that the place to find it is totally different.

DeFr’s picture

Found another problem in views_plugin_argument_default_taxonomy_tid.inc when playing around: there's no longer a taxonomy property on the node object. Attached patch iterates over the fields attached to the entity, looking for taxonomy_term_reference one to build an array matching what $node->taxonomy used to look like.

I'm not too sure how to go about adding a generic term_data => node_revisions relationship that doesn't imply adding every taxonomy term reference field table to the query, which is going to be a possibly major performance hit if you have a lot of fields. Maybe that should be an explicit relationship, with a configuration screen, allowing you to choose which field you want to take into account ? Or every taxonomy term reference field should created its own relationship between the terms and node tables ?

BenK’s picture

Subscribing...

dawehner’s picture

Thanks for the work DeFr.

Could we split up the patch in

a) just term_data to taxonomy_term_data

This is easy to fix, so let's do it fast.

b) the term_node/term_index part?

From my perspective we should perhaps force people to use fieldapi fields.

fultonchain’s picture

Subscribing.

dawehner’s picture

Status: Needs review » Needs work

After some discuess the following stuff will be done

* the current term_node relation will be dropped and the user will have to use the fieldapi-fields.
* the existing handlers should be tryed to be ported to fieldapi related handlers.

I suggest to fix the renaming of the not-term_node tables first. Then fix the rest in another issue.

@defr it would be cool if you make a new patch

Just do the renaming and the cool stuff in the argument handlers.

tsvenson’s picture

subscribing

will_in_wi’s picture

Subscribing

dawehner’s picture

Status: Needs work » Fixed
[19:24] <merlinofchaos> dereine: The only reason we cared about node.vid is that the term_node table was storing revisions.
[19:24] <merlinofchaos> dereine: Since revisions are now being stored separately, we don't really need to care about node.vid

So i used the last patch cleaned up quite a bit and commited it. Yeah we have working taxonomy views in d7.

Perhaps we could forget #12

tsvenson’s picture

Cool, will give it a spin on my site over the next days. Let you know how it works.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.