Obviously, there is a significant amount of work left to get full features functionality back in the 2.x-dev branch...but I hope this is a good start.

My modifications to eck.features.inc and eck.module simply wake-up the features support, however, I do not believe they export everything that needs to be just yet.

Comments

wjaspers’s picture

NOTES:
* Uses features_var_export instead of attempting to hard-code exportable information.
* Bundle support doesn't export any data yet, but the features UI is able to access them
* Entity Type support exports the exact information from entity_get_info($entity_type). This likely needs to be tuned/updated.

wjaspers’s picture

Status: Active » Needs review
fmizzell’s picture

Awesome, I have not reviewed the patch yet, but features support is definitely one of the major priorities for this project. Are you planning to do some more work on this? If you are, maybe a git branch should be created to work on this until it is complete. Thanks.

wjaspers’s picture

I definitely plan on working on it. I don't remember, can I fork a drupal git repo and operate on it myself, then push up?

fmizzell’s picture

you can clone (fork) any repository, but you wont be able to push up unless I make you a co-maintainer. I am willing to do that so we can get this done. I will post back in here once I have created the branch with your patch changes, and had given you access to push stuff. I am in irc most of the time during US work hours, so maybe we can use that medium to coordinate efforts.

fmizzell’s picture

Status: Needs review » Needs work

wjasper is currently working on it, and I will jump in when I get a chance, work is being done on the features branch of the repository

itangalo’s picture

Tried the patch above, but got some serious problems from it. :-(

Drupal complained that lines 93 and 94 in eck.features.inc used undeclared indeces:

        'properties' => $entity_type_info['properties'],
        'custom_properties' => $entity_type_info['custom_properties'],

I tried commenting these out, just to see what would happen, and then Entity API became really upset:

Fatal error: Unsupported operand types in …/sites/all/modules/entity/includes/entity.property.inc on line 88

(Line 88 says $info['properties'] += $bundle_info['properties'];, so I should probably have set the properties and custom properties to an empty array rather than commenting the lines out.)

I'll keep digging, and see what I can find. Maybe I can improve the patch somehow. Maybe this information is useful anyway.

itangalo’s picture

Huh. I tweaked entity.property.inc just to get the page execution going again, and now the eck_entity_type_features_rebuild function (with lines 93+94 in eck.features.inc) isn't called any more. Even when clearing cache.

I obviously need to learn more about how Features calls functions and rebuilds configuration. Things seem to kind of work now. I hope.

itangalo’s picture

Hm. I tried enabling the Features export on a clean site, and I get the same errors as on the source site. When bypassing these by setings 'properties' and 'custom_properties' to empty arrays, I get database errors instead:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' )' at line 1: INSERT INTO {eck_entity_type} (name, label, properties, custom_properties) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, , ); Array ( [:db_insert_placeholder_0] => votable_relation [:db_insert_placeholder_1] => Votable relation ) in eck_entity_type_features_rebuild() (line 100 of …/sites/all/modules/eck/eck.features.inc).

To investigate further, I ran entity_get_property_info() on my original site, and that tells me that is *has* some properties. My conclusion is that these properties aren't exported.
I stared at eck.features.inc for some time, but couldn't find where this should be added. Sorry. :-/

It *might* be relevant to know that I created an entity type with two bundles, and neither of the bundles have the same name as the entity type. (I don't think this affects the entity properties in any way, though.)

wjaspers’s picture

Thanks for the heads up I left this hanging in my dev sandbox @italngalo. Assuming there's time this weekend, I'll try to keep at it.

itangalo’s picture

Sorry, can't get this patch to apply (either to 2.x, master or feature branch). Now trying to apply the rejected changes, and hope to upload a re-roll.

itangalo’s picture

StatusFileSize
new10.98 KB

I managed to apply the patch! (I think.) It required applying the patch from #1 as well as #10, and I had to do a bit of extra magic since Git wouldn't accept the second patch.

Attached is a patch that applies against the 2.x branch as of today.

(Another comment with some analysis will come.)

itangalo’s picture

StatusFileSize
new1.68 KB

I did a test export, and it seems that the entity types now are exported just fine, but the bundles are left out.
The .info file says features[eck_type][] = "test_bundle", but there is no inclusion file to define the bundle.

I added a field to the bundle, and the bundle is named in the field export (which is probably no surprise).

The test export is attached in a feature.

wjaspers’s picture

I think the trick to bundles is to just export them like we do with content-types (nodes). All they really are are entity-types with N fields attached to them. (Where N is a number). I still have work to do on this.

Thanks for giving this a try.

itangalo’s picture

It seems to me that the fields already have the information they need for being attached to the bundles – Strongarm picks up the relevant fields, and the field settings are all exported (including which bundle they apply for).

But maybe this was what you meant.

Anyways - thanks for great work. ECK is awesome, and I really look forward to be able to export custom entity types + bundles.

fmizzell’s picture

Ok, I just pushed a couple of commits to the features branch. From very superficial testing both the export and import seem to be working after a little bit of clean up. After we get a little bit more testing done, we should be ready to merge this to 7.x-2.x. Thanks wjaspers and Itangalo for you work.

fmizzell’s picture

Status: Needs work » Needs review
fmizzell’s picture

I found a couple of bugs and they have been fixed, but I am not a regular features' user so I will wait until the real features' users give the go ahead for merging

fmizzell’s picture

I just noticed that half of the features branch was already merged with 7.x-2.x, so I decided to go ahead and merge the whole thing. Features should be working on 7.x-2.x

itangalo’s picture

Status: Needs review » Fixed

Just tested the new and shiny 2.x-dev, and the Features export works just fine.
Thanks for great work!

(Marking this as fixed, since it is already committed.)

Status: Fixed » Closed (fixed)

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