PHP Reserved Word used as Espo Entity Type

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • huntfarms
    commented on 's reply
    Thank you - yes I had missed that - everything is working now.

  • emillod
    replied
    huntfarms i worked on hook in case today. This is correct namespace: namespace Espo\Custom\Hooks\CaseObj;
    Ther propper name of method is isAttributeChanged

    Leave a comment:


  • huntfarms
    commented on 's reply
    How did you overcome the issue of Espo-defined methods not working against CaseObj?

  • emillod
    replied
    I'm using EspoCRM from almost 5 years and yeah, i had to use CaseObj. I think if your business don't need different approach, i would leave it that way.

    Leave a comment:


  • huntfarms
    started a topic PHP Reserved Word used as Espo Entity Type

    PHP Reserved Word used as Espo Entity Type

    I'm javascript proficient but not PHP. I want to add a hook for the Case entity, however "case" is a reserved in all the various languages I know and thus is not available to be used as as part of the namespace in a hook. I've seen the posts saying to use CaseObj instead, which I have done, and then had to change the path to the hook to end with CaseObj as well. The issue with this "workaround" is that when id go to do a $entity->isChanged('myfield') I get errors logged.

    Message: Call to undefined method Espo\Modules\Crm\Entities\CaseObj::isChanged()

    I assume this is because the namespace has overtyped the actual entity type, Case, with ChangeObj and it is not listed among the valid Entities in Espo.

    My question - am I better off creating my own Entity to duplicate the Case Entity but choose another non-reserved name, or is there a good documented and test fix to workaround this issue.

    Thank you
Working...