cubicweb #856248 Refactor API to manipulate entities in hooks / repository [resolved]

Currently, in a before_[add|update] hook, we use the dict api (i.e. __setitem__) to set an attribute value. Using the dict notation bypasses RQL query execution, which is necessary in a before_add_entity() and sometimes desirable in a before_udpate_entity(). Since no RQL query will be executed, no hook will be called.

An explicit API, carefully thought, user-friendly, should be made available on the reposistory side to hide those low-level and sometimes ambiguous manipulations.

Side-note: If this API is carried by the hooks themselves, it will be easy to ensure we're not using a method outside its dedicated context. (cubicweb.server.hook.entity_oldnewvalue comes to my mind for instance)

When this is done, other APIs should be deprecated.

priorityimportant
typeenhancement
done in3.10.0
load2.000
load left0.000
closed by<not specified>