Thanks for the question. The main difference between the two is that the entity module does not actually turn entities into true objects. Your example from the entity module even shows this. Instead of creating an object, you called procedural code of "entity_create" to create the entity and then another procedural function, "entity_save," to save it. I'm wrapping all the functions up into the object as well to make them truly objects with functions.
You no longer need all the procedural functions and pass the standard object into them, you only have to call the save() function on the object.
Thanks for the links. I'm well aware of the entity module and looked it over to see if it did what I wanted it to do before I started writing this module. If it does what I want to do then it is the best guarded secret in Drupal right now.
All of the documentation and code that I've read about the entity API module show how to create new entity types so that they interact with fields in core and to provide CRUD functionality to those new entity types. This is NOT what this module does.
This module is about creating objects around core entity (and non entities). Look over my second set of examples. Does the entity API module allow me to do this? If it does then I am very glad to hear it but I've never seen any code nor heard anyone talking about it.
I'd like to avoid ever having to populate the $edit array when doing a user_save again and remember to do a node_submit before a node_save when creating new nodes. If the entity module does this then I'm all for it but I can't tell that it does.
Comments
Comment #1
dpi+1
Using the example from the project page:
Object.module
Entity.module
Comment #2
randallknutson commenteddpi,
Thanks for the question. The main difference between the two is that the entity module does not actually turn entities into true objects. Your example from the entity module even shows this. Instead of creating an object, you called procedural code of "entity_create" to create the entity and then another procedural function, "entity_save," to save it. I'm wrapping all the functions up into the object as well to make them truly objects with functions.
You no longer need all the procedural functions and pass the standard object into them, you only have to call the save() function on the object.
Comment #3
randallknutson commentedLet me give you another example. Can you do the following with the Entity module without using procedural code:
Here is another example to create a new page node:
Comment #4
mikeytown2 commentedThe save method exists if you're wondering
http://drupalcode.org/project/entity.git/blob/c1a949c89aac9bedf11fa8004a...
http://drupalcode.org/project/entity.git/blob/c1a949c89aac9bedf11fa8004a...
http://drupalcode.org/project/entity.git/blob/c1a949c89aac9bedf11fa8004a...
Check it out as it's used by over 100K sites and its usage is only increasing.
http://drupal.org/project/usage/entity
Comment #5
randallknutson commentedmikeytown2,
Thanks for the links. I'm well aware of the entity module and looked it over to see if it did what I wanted it to do before I started writing this module. If it does what I want to do then it is the best guarded secret in Drupal right now.
All of the documentation and code that I've read about the entity API module show how to create new entity types so that they interact with fields in core and to provide CRUD functionality to those new entity types. This is NOT what this module does.
This module is about creating objects around core entity (and non entities). Look over my second set of examples. Does the entity API module allow me to do this? If it does then I am very glad to hear it but I've never seen any code nor heard anyone talking about it.
I'd like to avoid ever having to populate the $edit array when doing a user_save again and remember to do a node_submit before a node_save when creating new nodes. If the entity module does this then I'm all for it but I can't tell that it does.
Comment #6
amitaibuSounds like what your looking for is Entity's wrapper:
Comment #7
randallknutson commentedAmitaibu,
I had no idea that existed. I am rethinking my approach and will post again soon.