Active
Project:
UUID Features Integration
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
17 Jun 2012 at 22:51 UTC
Updated:
10 Feb 2016 at 14:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
kelvinwong commented+1
Comment #2
mpgeek commentedThere's a patch available for Bean-instance export here: #1849668: Add support for Bean exporting (deployable bean instances).
Comment #3
Jeffrey C. commentedAs far as I know, no, currently there's no way to achieve this. Anyone who has a different idea is welcome to reopen this issue. Marking this duplicate of #1849668: Add support for Bean exporting (deployable bean instances)..
Comment #4
saltednutEven though @beanluc is talking about supporting beans, that is just one example. This is not a duplicate thread about adding the bean support.
@Jeffrey C. Tucking this issue away as a duplicate task changes nothing: this is what people want from the module.
In an ideal scenario, this module would be programmed in such a way that any new entity type that is introduced to the UUID ecosystem could easily be supported. This is by no means a simple task, but it is what I would expect most users would assume the module to do when first installing it.
Right now, it seems that every entity supported is handled through its own includes. This may be the only way to do it, but I'm bumping this as a Feature request anyway, hopefully at least to get a dialogue going about this problem.
Perhaps we can figure something out from an API/plugin standpoint?
Comment #5
saltednutComment #6
mpgeek commentedMaybe a uuid_features API does make sense. Modules that provide entities know how to create/modify/save instances... could we not implement a generic entity exporter, then leave the logical details of export/import/rebuild up to the client modules themselves? Would that mean uuid_features defines an api for integration? Just throwing out ideas...
Comment #7
Jeffrey C. commentedYes, that makes sense to me. Currently I don't have time to work on that, would be happy to commit if there's a working patch.
Comment #8
mpgeek commentedI'm short on time for general entity export as well, but I will be working on the Bean instance exporter #1849668: Add support for Bean exporting (deployable bean instances).. Perhaps looking at all of the entity types side-by-side will produce some sort of general factorization. Right now it feels like a radical shift in architecture/responsibility between features_uuid and the providing modules.
In any case, I would like to hear ideas on how this could be implemented. Is there some supporting functionality in teh Entity API that could help?
Comment #9
saltednut@mpgeek The main problem here is that there is no shared schema for entity properties. Nodes use nid, have a title field, etc. Taxonomy terms require a tid and vid. Beans have a bid. This makes it difficult to support entities on a general level.
However, there are things that can be done in in regard to field handling, so that we can employ some re-use and reduce code bloat/inconsistencies.
One example of this is the patch in #1904946: Nodes should be able to export file fields where I take the code for file handling out of the taxonomy_term include and turn it into a more generalized solution that all entity types can employ for file field serialization. (That patch needs review, btw!) We shouldn't need to handle file field exports on an individual entity level. The file fields are always the same. You could use this patch and add to the bean patch so that beans support image/file fields. They're going to need to do that anyway...
In general, using the entity api in shared code situations rather than entity specific functions or methods is a good direction. It would not be ideal to have every entity supported handling file fields differently.
Another idea, just to create some consistency in the codebase, would be using a generic handler for imports: entity_save - this could be used instead of
node_save,taxonomy_term_saveetc. Doesn't actually reduce any code - but its good practice to use the API wherever possible.Comment #10
saltednutremoving tag
Comment #11
gumanoed commentedAny luck to add support of my personal entity type to UUID_features (and get fields and data from my entity tipe bundles to the feature code)?
I need some information how i can realise support of my entity type.
I'm edditing the code in sites/all/modules/uuid_features
I added to the uuid_features.module
A copied includes/uuid_bean.features.inc to includes/uuid_fruit.features.inc and make changes (what i found) in code. Changes bean to fruit.
And a dind't find in includes/modules/bean.inc so i copied includes/modules/node.inc to includes/modules/fruit.inc and made changes of variables node to fruit.
So, i get structure, but i can't get bundles and fields to my feature code.
Can someone help me with information how to make it works?
Comment #12
gumanoed commentedWe succeeded realize support of our own entity tipe in Features_UUID to export (and import) data from our own entities.
In uuid_features.module
* add name of your entity tipe (our is fruits)
$entity_types = array('bean', 'node', 'taxonomy_term', 'fruits');
* in function function uuid_features_file_field_export(&$export, $entity_type) { ... add your antity description
switch ($entity_type) {
case "taxonomy_term":
$export_bundle = $export->vocabulary_machine_name;
break;
case "bean":
$export_bundle = $export->type;
break;
case "node":
$export_bundle = $export->type;
break;
case "fruits":
$export_bundle = $export->type;
break;
}
* In function uuid_features_features_api() { add
$components['uuid_fruits'] = array(
'name' => t('Content_fruits'),
'feature_source' => TRUE,
'default_hook' => 'uuid_features_default_content',
'default_file' => FEATURES_DEFAULTS_INCLUDED,
'file' => drupal_get_path('module', 'uuid_features') . '/includes/uuid_fruits.features.inc',
);
* create the file includes/uuid_fruits.features.inc from includes/uuid_node.features.inc and replace all "node" to your entity name (our is "fruits".
* But check lines 45, 80 161 function $node = node_load($nid, NULL, TRUE); will not work with entity. You need use entity_load() function with anothor input variables list
$fruits = entity_load('fruits', $ids = array($nid));
$fruits = $fruits[$nid];
(actualy this function works with $id variable, but not to change too much in code we uname $nid name for this variables, but actualy it is ID)
We have an issue with filefields load from our entity. But it's temporary problem. I think we will solve it.
I think i will make post about it. If you have questions - write me on gumanoed at gmail dot com.
Comment #13
gnucifer commentedI have begun to implement generic support for entities as a separate module. It is in a pretty early stage, and I'm posting it here as it is in case it will be useful for anyone. It will need more polishing, and will perhaps be released as a separate project (or contribute to uuid_features if it is possible to merge in the functionality in a clean way).
Comment #14
gnucifer commentedMight as well put it on github: https://github.com/gnucifer/uuid_entity_features
Use the github-version instead, the version in the previous post is broken.