If a table doesn't have either a primary key or a join to another table with a primary key, then its contents can't be displayed on the admin/content/data/view/my_table_name path. However, the link to view the table contents still shows. I think it would be a good idea to add some help text and change or hide the link.

Additionally, in the table content view itself, the column header in the view is empty instead of showing the field name if the field's label is blank.

The attached patch is one way to fix these two things.

CommentFileSizeAuthor
#1 616324-3_adopt.patch6.71 KBalex_b
data_view.patch3.73 KBbecw

Comments

alex_b’s picture

StatusFileSize
new6.71 KB

You ran headlong into an issue I wanted to address earlier. The fact that putting clearing caches into CRUD functions isn't efficient if these functions are being batched.

The way how I'd like to address this is having no cache clear / rebuild functionality in CRUD methods at all and make it the API user's responsibility to clear caches after operations. I added DataTable::cacheClear() and modified the adopt patch accordingly as a first step in the right direction.

Other changes:

- Passing in the table name into adopt is redundant
- Minor tweaks to naming conventions to keep consistent with rest of code (i. e. call table $table, not $tmp. Nitty gritty stuff)
- unset() table pointer after adopting the table.
- Make $schema an optional parameter for adopt() so that API users can rely on DataTable to inspect the table. This keeps adopt() more in the pattern of create().

Needs review.

alex_b’s picture

Drats. wrong thread. Please ignore #1

arski’s picture

hmm, I had the same issue.. tried adding a primary key to my table, re-adopting it, but still I can't view it - the link is there but it just redirects to a list of tables without giving any information. Very sad :((

pretty old bug too it seems :(

joachim’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

Upping version so I remember to fix this on D7.

joachim’s picture

Status: Needs review » Fixed

Committed to both D6 and D7 branches, with tweaks on the latter.

- #616590 by becw: Fixed links to non-existent views for tables without primary keys.
- #616590 by becw, joachim: Fixed links to non-existent views for tables without primary keys.

Status: Fixed » Closed (fixed)

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

brandy.brown’s picture

Can we get links to the patches? I don't know how to find them otherwise.
Thanks!

brandy.brown’s picture

Status: Closed (fixed) » Active
brandy.brown’s picture

Status: Active » Closed (fixed)

well magically I went back (without patching) and it works just fine. WEIRD.