Since entity makes revisions trivial, we need to use the functionality. Beans are content and content should have revisions.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

indytechcook’s picture

Issue tags: +Release blocker

Tagging with release blocker

indytechcook’s picture

This is dependent on #996696.

alexweber’s picture

indytechcook’s picture

Status: Active » Needs review
FileSize
19.89 KB

Work is occurring in the bean_revisions branch. Here is the first pass at a patch (totally untested). This requires the patch from the entity API module

indytechcook’s picture

FileSize
19.88 KB

Ignore previous patch. I did the diff backwards. Here is the correct one.

Kristen Pol’s picture

Status: Needs review » Needs work
+++ b/bean.install
@@ -176,3 +299,21 @@ function bean_update_7006() {
+function bean_update_7007(&$return) {
+  $schema = bean_schema();
+  $bean = $schema['bean'];
+  $bean_revision = $schema['bean_revision'];
+
+  db_drop_primary_key('bean');
+  db_change_field('bean', 'bid', 'bean', $bean['bid'], array('primary key' => array('bid')));
+  db_add_field('bean', 'vid', $bean['vid']);
+  db_add_unique_key('bean', 'vid', array('vid'));
+
+  db_create_table('bean_revision', $bean_revision);

After the bean_revision table is created, don't you need to prepopulate it with a first round of revisions (where revision id = bean id)? When I created a patch for Field Collection awhile ago to support revisions, I did this. I had assumed it was necessary.

Also, you have a lot of logic for handling the revisions but I thought that the Entity API patch gives you a lot of it for "free"... I didn't try understanding what you were doing, though, so maybe it is all necessary.

Kristen Pol’s picture

Status: Needs work » Needs review

Putting back to needs review for others to review.

indytechcook’s picture

Status: Needs review » Needs work

Thanks. I've made a bunch of changes since last night. I'll push up a new patch today.

indytechcook’s picture

FileSize
23.41 KB

Here is another patch. I'm still working off of the bean_revisions branch in git.

Left to do:

  • Update hook to fill data
  • Test, test, test.
indytechcook’s picture

@Kristen The entity api module handles the saving and loading mostly. You still have to tell it when to save a new revision and which one to load. Some of the code is just overriding the load method with a one line change.

indytechcook’s picture

Status: Needs work » Needs review
FileSize
23.62 KB

Updated Patch. Work is also in the bean_revisions patch.

indytechcook’s picture

FileSize
28.34 KB

Updated patch to add the ability to set the active revision. the bean_revisions branch is still up to date

indytechcook’s picture

FileSize
38.06 KB

Updated patch to match the new entity api patch #996696: Support revisions in Entity API

indytechcook’s picture

FileSize
28.42 KB

Merged in code before rolling patch this time

indytechcook’s picture

Status: Needs review » Needs work

Patch needs to be rerolled against current entity API patch.

indytechcook’s picture

The patch has been committed to entity api. No more moving target! #996696: Support revisions in Entity API

indytechcook’s picture

Status: Needs work » Needs review
FileSize
28.86 KB

UPdated patch

indytechcook’s picture

Status: Needs review » Fixed

This has been committed. Please open new issues.

Status: Fixed » Closed (fixed)

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

muschpusch’s picture

muschpusch’s picture

Issue summary: View changes

Updated issue summary.