Typical Entity Examples module provides a pack of typical example entities.

First entity created in this module is the smallest possible entity. Every next entity is gradually improved version of the previous one. The last entity from this module is the rather complex entity with the user interface for creating entity bundles.

This module can be useful for people who want to learn how to develop entities step-by-step.

Sandbox url: http://drupal.org/sandbox/dragon658/1991582
Git access: git clone http://git.drupal.org/sandbox/dragon658/1991582.git typical_entity_examples

Comments

fatel’s picture

Status: Needs review » Needs work

Hi dragon658,
first of all: i like the idea. Additional examples are always good for learning drupal.
You should resolve all automated review-errors first and read through the module development guidelines of drupal. (http://drupal.org/node/1587704)
e.g. don't work in the master branch.
http://ventral.org/pareview/httpgitdrupalorgsandboxdragon6581991582git

dragon658’s picture

Hi fatel!

  1. I moved my project from master to 7.x-1.x branch. Master branch is deleted.
  2. I resolved the most of automated errors I got on http://ventral.org/

My current not resolved automated errors:

  1. Errors like "./typical_entity_example_3/typical_entity_example_3.install: all functions should be prefixed with your module/theme name to avoid name clashes" for hooks like "typical_entity_example_3_schema". I did not understand what is wrong.
  2. Error in typical_entity_example_6/typical_entity_example_6.controller.inc file: "Public method name "TypicalEntity6TypeUIController::hook_menu" is not in lowerCamel format, it must not contain underscores". I suppose that this is not my fault, because I just override the method of EntityDefaultUIController.

Are these automated errors false positives?

dragon658’s picture

Hello!

I suppose that I fixed all errors, so I want somebody to review my module again!

fatel’s picture

Hi dragon658,
sorry for answering that late. I still see multiple issues at the automated review? Most of them should be easily fixed by renaming your functions. e.g. if your module is called "mymodule", just name your functions like "mymodule_myfunction", I am not an drupal expert, so maybe someone else will give you additional informations here.
You could review modules, too and you will get an review bonus for your own module, this will speed up the review process.

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. Feel free to reopen if you are still working on this application.

I'm a robot and this is an automated message from Project Applications Scraper.

dragon658’s picture

Hi, fatel!

Sorry for my slowness.
But as you can see I am slow.

I fixed all the errors except the one.
http://pareview.sh/pareview/httpgitdrupalorgsandboxdragon6581991582git

The only error I didn't fix is

FILE: ...w_temp/typical_entity_example_6/typical_entity_example_6.controller.inc
--------------------------------------------------------------------------------
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
101 | ERROR | Public method name
| | "TypicalEntityExample6TypeUiController::hook_menu" is not in
| | lowerCamel format, it must not contain underscores
--------------------------------------------------------------------------------

I didn't fix it, because this error is caused "by overridden contributed Entity module class EntityDefaultUIController method "hook_menu" not being in lowerCamel format".
I found that this error was mentioned here and, as I understood, it wasn't finally fixed.

What shall I do now? :)

dragon658’s picture

Status: Closed (won't fix) » Needs review

I want somebody to review my module again, please!

kscheirer’s picture

Status: Needs review » Postponed (maintainer needs more info)
  • Nice project page - there's a lot of repeated pieces though. Maybe you could use a bullet list or a little nicer formatting? Is Typical Entity Example 6 the "biggest" entity one could make? Maybe add some typical use cases for each kind of entity? I see you have example code in the README, that's great!
  • In TypicalEntityExample1UnitTestCase:: testTypicalEntity1(), don't escape quotes inside of t(), just use double quotes on the outside. That's a lot easier for translators.
  • Why did Example4+ need to extend Entity? I believe you that it does, I'm just curious :) The methods implemented just look like boilerplate.
  • Really nice progression of examples!

Could this go into the Example project instead? They just have 1 entity example, http://drupalcode.org/project/examples.git/tree/refs/heads/7.x-1.x:/enti... - how does yours compare? We generally prefer to see patches to existing modules when appropriate.

We prefer collaboration over competition, therefore we want to prevent having duplicating modules on drupal.org. If the differences between these modules are not too fundamental for patching the existing one, we would love to see you joining forces and concentrate all power on enhancing one module. (If the existing module is abandoned, please think about taking it over).

If that fails for whatever reason please get back to us and set this back to "needs review".

----
Top Shelf Modules - Crafted, Curated, Contributed.

dragon658’s picture

Hi, kscheirer!
Thank you for your reply.

Nice project page - there's a lot of repeated pieces though. Maybe you could use a bullet list or a little nicer formatting? Is Typical Entity Example 6 the "biggest" entity one could make? Maybe add some typical use cases for each kind of entity? I see you have example code in the README, that's great!

I have changed the project page.
I moved description of sub-modules to bullet list and added a big section with typical use cases for each sub-module.
If this section with typical use cases is too big, I can shorten it.
Typical Entity Example 6 is not the "biggest" entity one could make.
There is no "biggest" entity in typical_entity_example module now.
Typical Entity Example 6 is a module which shows how to create a user interface which allows user to create bundles of entities and attach fields to it.

In TypicalEntityExample1UnitTestCase:: testTypicalEntity1(), don't escape quotes inside of t(), just use double quotes on the outside. That's a lot easier for translators.

Fixed.

Why did Example4+ need to extend Entity? I believe you that it does, I'm just curious :) The methods implemented just look like boilerplate.

The answer:

For providing an entity label and URI it is suggested to override the defaultLabel() and defaultUri() methods, and to specify the entity_class_label() and entity_class_uri() as respective callbacks in hook_entity_info(). That way modules are able to override your defaults by altering the hook_entity_info() callbacks, while $entity->label() and $entity->uri() reflect this changes as well.

http://drupalcontrib.org/api/drupal/contributions!entity!includes!entity...

Could this go into the Example project instead? They just have 1 entity example, http://drupalcode.org/project/examples.git/tree/refs/heads/7.x-1.x:/enti... - how does yours compare? We generally prefer to see patches to existing modules when appropriate.

My typical_entity_example module cannot be implemented into "Examples for Developers" module because "Examples for Developers" module is about Drupal core functionality.

This project aims to provide high-quality, well-documented API examples for a broad range of Drupal core functionality.

https://drupal.org/project/examples

My typical_entity_example module creates entities with Entity API and Views modules (which are not parts of Drupal core), so it does not suit.
And sub-modules of "Examples for Developers" module are usually smaller than my module.

I decided to create typical_entity_example module because some time ago I was forced to work with entities and before I understood how to work with them I spent really a lot of time in search of normal examples of working entities.
All the information that I found was very fragmented, so I decided to create this module to make life easier for those who will follow in my footsteps.
I suppose then my typical_entity_example module is pretty useful for everybody who want to learn how to work with entities and I also think that it reasonable to issue it as a separate module because there is no example modules that would have been entirely devoted to entities and entity api.

dragon658’s picture

Status: Postponed (maintainer needs more info) » Needs review

Sorry!
I forgot to set the right status for my previous message.
I need review again!

kscheirer’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for addressing those points!

----
Top Shelf Modules - Crafted, Curated, Contributed.

dragon658’s picture

Thank you for your work kscheirer!

kscheirer’s picture

Assigned: dragon658 » Unassigned
Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

It's been a month without any problems reported, so I'm promoting this myself as per https://drupal.org/node/1125818.

Thanks for your contribution, dragon658!

I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

----
Top Shelf Modules - Crafted, Curated, Contributed.

dragon658’s picture

Thank you kscheirer and Drupal community!
I will be a good guy. :)

Status: Fixed » Closed (fixed)

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