When I first came across this module, no work had been done on it for the best part of a year, and changes to core and Entity API in the meantime had left it pretty broken. I've addressed enough of these to make it useful for my own projects, but it's really just differently broken at the moment, and a generally useful 1.0 release will need some more work.

Also in the last year, other projects have come along which have the potential to make Micro more lightweight, maintainable, and focused. Entity Construction Kit looks like dealing with some of the more complex use cases for which one might have used Micro, and a lot of the code currently in this module (particularly Views integration, which I mostly broke with a schema change) duplicates what Entity Reference now provides.

I'm currently in the process of rewriting the original "attaches to other entities" functionality to leverage Entity Reference, and if you look at the remaining hard-coded properties of the micro entity type:

  • 'uid' could be an optional Entity reference to a user, defaulting to the current user at micro creation.
  • 'created' could be an optional Date field, defaulting to the current time at micro creation. Also we could make a date field optionally an "updated" field by just overwriting the value with the current time whenever the entity is saved.

That leaves the only hard coded properties of the Micro entity type as Micro ID and Micro Type; lightweight indeed! If your use case is "I just want a fieldable thing" and you don't necessarily want it associated with other entity types, you can; just don't use Entity Reference in that way (or at all). Similarly, if you don't need a created date, it's not required.

Much of the functionality originally envisaged can be layered on top, as additions to the Entity Reference field settings form. i.e. A entity reference field targeting users might have a checkbox asking whether this field should be treated as an author field. Or more generally an entity reference field could optionally expose lists of "attached" micro items in the target entity's content, as a block, or as a tab (MENU_LOCAL_TASK menu item). These lists might be overridable views, or if we don't want a dependency on Views maybe an EntityFieldQuery optionally overridable by a view. Also settings to include an "Add a..." link (MENU_LOCAL_ACTION menu item) to the target entity type's page can be put here.

Another thing I'd like to do is pull out the Admin UI into a separate module, so that Micro types can be included in Features without cluttering up sites that will never want to modify them.

So the requirements for a 1.0-alpha1 release are:

Update 6th June 2012

The above are completed, in a rough-and-ready kind of way, but I want to add one more task:

Update 14th June 2012

Micro 7.x-1.0-alpha1!

Comments

Matthew Davidson’s picture

Oh, yeah. Another advantage of leaving "attached to" in the hands of Entity Reference is that we can have multiple such relationships without necessarily having to privilege any one of them.

So say in the case of an issue tracking feature, an issue Micro would belong just as much to the user it's assigned to as to the project the issue relates to.

(And yes, if you plan to use Micro like this, you might instead want to consider Relation.)

Matthew Davidson’s picture

Issue summary: View changes

Clarified what code provided by Entity Reference is currently unnecessarily implemented in Micro.

geek-merlin’s picture

@matthew,

now that
http://drupal.org/project/field_collection
has grown up, it seems that micro is mostly a dup.
or do i miss something?

DjebbZ’s picture

I was a workmate of the original Micro developer. There was discussion between him and fago (developer of field_collection) at that time. There's a fondamental difference between the projects. Field_collection allows a "kinda" multifield field. Micro allows a simple entity that's not a node. As a Micro could be attached to another entity, there was some overlap, because both could be used for the same purpose.

So, to comment the plan, if I understand it properly it looks like a good plan :
- Micro just allows the quick creation an entity, maybe base on the Entity Creation Kit (or at least code from it)
- if one wants to "attach" the micro entity to another, Entity Reference (or even Relation) do all the hard work
- one can even use field_collection with a micro entity
- Micro remains lightweight
- everything works logically, in a very "Drupal way".

@Matthew Davidson, can you confirm ?

geek-merlin’s picture

hmm, ok, this points a direction, but, as field_collection also is an entity i still do not really get the difference.

of course anyone is free to code new stuff, but maybe adding a "lightweight" option to field_collection would be an alternative.

yet if someone could explain the "fundamental difference" it would help us all to understand role and future of this project.

aidanlis’s picture

Indeed, not sure how this differs from field_collection from your description DjebbZ.

Matthew Davidson’s picture

It's odd. When I first came across this module, a whole lot of uses seemed obvious to me, but the Field Collection-like one never occurred to me. If anything, I'm pleased the consensus is that Field Collection rocks, because I'm currently merrily ripping out the UI stuff in Micro that facilitates that kind of use (but has never worked for me).

It's probably best to describe what I have used Micro for. The most straightforward one is a microblogging feature I'm using on a couple of sites, where each post is a Micro "attached" to a user (the author), but also to one or more other users (recipients of messages), other posts of this Micro type (i.e. posts you're replying to) and potentially taxonomy terms (hashtagging) or other entities on the site that posts can refer to.

I've also developed a simple node update moderation feature where privileged users see the latest "real" revision of a node, but anonymous users see the last approved revision. All I'm doing is using the core node revision system and referring to a micro attached to the node that holds our extra revision metadata to pull in the appropriate revision content in hook_node_view().

Most interestingly, a friend of mine is using it on a site he's developed for a marine research group who collect debris (garbage, to non-scientists) from the ocean floor in the local marine park. Every bit of garbage is logged as a Micro, and in conjunction with Views and Google Chart API, they can produce pretty charts of rubbish they've collected viewed by date, type, geolocation, depth, habitation type; however they like, basically. It's pretty cool, and I'm sure paints a very depressing picture of the state of Earth's oceans.

So I'm thinking of Micro not as something to complement Field API, but as a tool for people like myself; site builders who can hack together a bit of code to get the last 10% of the functionality they need, but find entity type creation in code too overwhelming. The problem is that during the development of D7 the idea of "everything is an entity" led to the expectation that we'd be able to do things like:

$entity_type = new entityType('thing');
$entity_type->fields['field_description'] = new field('text', 'longtext');
$entity_type->save();
$entity = new entity('thing');
$entity->field_description->set('Wouldn\'t this be cool?');
$entity->save();
// Note: Don't try this. It doesn't work.

But the reality instead is "Here's hundreds and hundreds of lines of code, copy and paste it into your own module and then start tweaking," which is not practical on low-budget projects. The inclination then is to switch back into D6 everything's-a-node mode and say "I'll just make it a node type". I admit "I'll just make it a Micro type" isn't that much of a conceptual leap forward, but it is an improvement.

I think that even with Entity Construction Kit there will still be cases where you just want a simple little fieldable thing to store data, but you don't need multiple bundles with shared properties, and you want sensible overridable default ways of querying and displaying that data in the context of other entity types the data relates to, and Micro can inhabit that niche quite happily.

geek-merlin’s picture

@matthew: thank you for elaborating this.
so the need is about having something like a "naked collection".
i would love to have this too for quite some use cases.

to only speak for me, i would like to compare the two approaches "go micro" and "extend field_collection" further, and started #1480228: Have "naked collections", field collections not attached as a field

DjebbZ’s picture

I didn't know field collections were entities in fact. In this case, a "lightweight" and "naked" field collections could be a good starter.

@matthew your use case is interesting, since you "attached" the micro's to different other entities. Would it mean, for the field collections counterpart, that Entity Reference (or Relation) would be needed to achieve the same result ?

geek-merlin’s picture

field_collections are - by now - automatically attached to entities as fields - that's the primary use case.

just explored field_collection a bit: you can already
* view a collection item by itself
* edit a collection item by itself

so you can already
* create a dummy entity (which you never will use!)
* attach a field collection to it
and use only field collection as entities.

what i still see to explore is: how tight is field_collection tangled to the concept of a host entity and how should we deal with that.
not sure now.

DjebbZ’s picture

Based on your explorations axel, I think the dummy entity should be Micro. The concept of 'multi-field field' as in field_collection is self contained and already working. Not sure that fago, maintainer of field_collection would want to change field_collection to an independant entity.

So the scenario I envision would be : enable Micro to have a simple and lightweight entity to store data, and attach field_collections to it when needed.

geek-merlin’s picture

i can fully support this now!

geek-merlin’s picture

any news on the state of work?

geek-merlin’s picture

Issue summary: View changes

Broke out first issue node from this task list.

Matthew Davidson’s picture

Have got the original few features functional enough to be usable. Have added just one last thing to my wishlist before I'm happy enough with the feature set to recommend it to people to test:

#1618484: Default display methods for list of micros from a referenced entity.

Hope to get that done in the next couple of days. Shouldn't jinx myself by saying so, though.

Matthew Davidson’s picture

Micro 7.x-1.0-alpha1 is out! Test away!

I fully expect a significant amount of bugfixes and refactoring before a stable release, and a lot of obsolete code still needs to be ripped out, but it's feature-complete enough to be useful now.

If you're running a very old dev version you should be able to upgrade, but some functionality may break in the process, notably any Views you may have created which depend on micro properties that don't exist any more. I have some update code which converts those properties to fields, but you'll have to adjust your Views manually to use these.

Matthew Davidson’s picture

Issue summary: View changes

Added extra little task.

fmizzell’s picture

@Developers, Is there any way that I can convince you to stop working on Micro and come help me with ECK :)?. I think ECK is trying to cover a more general case than Micro, and it makes it really easy to create entity types, and bundles (that is a great part of what micro does) but the rest of the functionality that is being described here I would love to have for all ECK entity types and entities. I am mainly talking about "merging" entities together that have connections either through entity_references or relations. That way we can have all that is great about Micro, but in a more flexible and powerful system, and also that will keep us from recreating each others code :)
Any thoughts?

Matthew Davidson’s picture

Fine idea in principle. The only reason I started using Micro was that at the time it looked closer to production-ready than ECK. I soon realised my mistake, but by the time I fixed it, broke it, fixed it again, etc. I felt obliged to push my (arguable) improvements to d.o.

I'm also starting to think that the "backreferences" functionality (which is basically just a design pattern I got tired of reproducing manually on almost all my sites with Views and a bit of custom code) might belong in entityreferences, or an add-on to that module. Come to think of it, the same applies to the special field behaviours. If I were to move that stuff to another module (or modules), we can practically consider Micro stable and "finished".

I'm just about to revisit the site that I started using Micro for (also have a few others I've done since), so I'll have to upgrade it to either the "new" Micro, ECK, or some combination of modules old and new, so I'll have to work out what approach is most sensible over the long term. I'll take a fresh look at ECK, put my feet up, stare out the window, and have a deep ponder.

fmizzell’s picture

@Matthew Davidson let me know if I can answer any ECK questions

EntrepreneurNet’s picture

Hey, @Matthew Davidson I’m asking you because you seem like quite the Architect!

I just discovered Micro and I’m really interested in this project. I’ve read all the threads & issues, and I have a use case exactly like what you described.

Only I’m building a (low traffic) site that I want to go live in about a month. Do you think Micro is ready? Or should I use something else like ECK? You seem to be doing quite a good & expedient job at bug-fixes.

If I start with ECK and then want to convert to Micro later (when it’s more mature) how hard do you think migration would be?

I also get the feeling there might eventually be a merge... so I’m tempted to use ECK.

Matthew Davidson’s picture

Definitely if you start on ECK you won't want to migrate to Micro, as this would be a significant downgrade in functionality (except maybe for some superficial niceties).

I'm committed to maintaining Micro for the lifetime of D7 because I have quite a few sites now depending on it, but I expect ECK or something like it will be the future for D8, so I imagine Micro for D8 will just be an upgrade module (like CCK for D7).

The aforementioned superficial niceties currently in Micro will probably be moving to separate modules, so you'll be able to use them with ECK or other entity providing modules. I haven't suggested it to the ECK guys yet, but I think their property behavior plugins should do likewise and be abstracted to work with fields as well, since in D8 fields and properties are going to be the same thing and we might as well get used to thinking that way (the D7 concept of pseudo-fields was a step in that direction). Obviously that's a far less trivial task, and I've been reluctant to put in a feature request without having some proof of concept code.

EntrepreneurNet’s picture

Thanks Matthew, for your informative reply! (even if I'm a little late) That clears things up nicely. I'll definitely go with ECK. :)

EntrepreneurNet’s picture

Issue summary: View changes

Update for Micro 7.x-1.0-alpha1.