Not sure if it is the proper way to invoke the entity CRUD hooks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim’s picture

Status: Needs review » Needs work

Good call.

Though I think these invocations belong inside the crud methods: _insert_flagging, _update_flagging _delete_flagging.

foopang’s picture

Status: Needs work » Needs review
FileSize
1.37 KB

Hi joachim, I have updated the patch, please review.

joachim’s picture

Status: Needs review » Needs work

One more thing -- sorry, should have said earlier :(
Could you change the comments to say 'Invoke hook_foo()' please? That way it's easier to find the places the hook is invoked because you can search for the hook name. Then I think we're good to go!

I think I'm going to have to file an issue after this one to review the whole of the flow round this part of the code, as in reviewing what your patch changes I have spotted that we call field_attach_presave() AFTER we've saved data! It's getting quite messy in there :/

foopang’s picture

Status: Needs work » Needs review
FileSize
1.36 KB

Hi joachim, updated the patch please review again.

I was wondering if it is possible to integrate flagging entity with Entity API so that it can be more extendable. For example, I try to use Search API to index the flagging entity, but there aren't any properties available for indexing unless we implement hook_entity_property_info() for the flagging entity type. And inserting/updating/deleting the flagging entity won't reflect in the Search API index because entity hooks were not invoked.

joachim’s picture

Category: feature » bug
Status: Needs review » Fixed

Committed. Thanks!
(And changed this to a bug, which I think it counts as.)

git commit -m "Issue #2119467 by foopang: Fixed entity CRUD hooks not invoked." --author="beansboxchrispang "

> I was wondering if it is possible to integrate flagging entity with Entity API so that it can be more extendable. For example, I try to use Search API to index the flagging entity, but there aren't any properties available for indexing unless we implement hook_entity_property_info() for the flagging entity type.

It's already been proposed that we depend on Entity API: #1866624: Add requirement for Entity API. . I'm against that, because I don't feel it's necessary for us to add a dependency and I don't think it adds anything to what Flag does at the moment. However, I'd be fine with adding support for Entity API in ways that don't require the dependency. Either hook_entity_property_info or declaring our use of an entity property controller would be fine, as without Entity API present those would just be ignored.

Entity API is part of D8 anyway, so doing that moves us along our eventual upgrade path.

Status: Fixed » Closed (fixed)

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