Follow-on from #1035410: Flag any entity.

Flag objects now store the entity info for their entity type when initially constructed, so that they can pull data from it whenever required (such as labels, bundles, key names, etc etc).

The alternative would be to call entity_get_info() every time something is needed from that data.

I have no idea which would be better for performance. Any thoughts?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim’s picture

Priority: Normal » Major

The decision has been made for us by #871064: Making flaggings fieldable, which would cause circularity here:

The hook_entity_info() added by that patch goes to look at which flag types we have in order to know about flagging bundles. But the flag_entity class calls entity_get_info() in its constructor.

joachim’s picture

Status: Active » Needs review
FileSize
3.46 KB

Here's a patch for review & the testbot.

joachim’s picture

... which wasn't enabled.

Hopefully a new comment will kick it into action :)

joachim’s picture

Status: Needs review » Fixed

Tests pass, and we need it for #871064: Making flaggings fieldable, and I was a bit iffy about this anyway. Committing!

Issue #1689704 by joachim: Changed flag object to retrieve entity info rather than store it.

Status: Fixed » Closed (fixed)

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