Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Warning

This hook may be StackOverflowError-prone when used inappropriately.

You have to avoid any kinds of re-loading entity from database within onView hooks. Otherwise you may end up with onView hook indirectly and infinitely calling itself.

Be aware that it's easy to do that unintentionally - for example by using SearchRestrictions.belongsTo(String, String, String, Long) or SearchRestrictions.belongsTo(String, DataDefinition, Long) criterion factory method, which internally loads an Entity for given plugin, model and id.
In such cases you have to use SearchRestrictions.belongsTo(String, Entity) which doesn't cause entity load.

Therefore, treat this hook as potentially dangerous and always check each used methods that they aren't your code in respect of performing any Entity loading.

Obey this rule, and world will be safe.

...