1

I'm using the Entity API in my module and I'm starting to feel headache with so many problems.

If you think this is a duplicate of this one or this other you are wrong, just keep reading

I need an Entity to represent a work centre of an organization, this is the simplest case possible since I only need one field, the centre’s name (and obviously on the database table I will need an ID).

Well, I already passed trough the problems described on the questions linked in the previous paragraph, but it was not enough.

I specified the setter callback for the centre's name, I even specified the schema field on which relies the property. I used my own setter and with the dpm() function provided by the Devel module I discovered that the object's instance seems immutable, I tried to update the value but didn't worked, probably I could get rid of the entity class and use the metadata wrapper for updating the values, but that could have side effects.

  • please show us your entity declarations, such as hook_entity_info and any other Entity APIs you've implemented. – tenken Nov 24 '14 at 18:05
  • @tenken Oh! I forgot to copy the code from the job's laptop, I will update this question with the code tomorrow. However on the setter callback I printed the object before modify the value and after and the dpm() shown that the value didn't change at all. – lordscales91 Nov 24 '14 at 18:33
  • @tenken Forget about the code I already solved it, the funny thing is that the problem was not on the Entity API, but on the form. Nobody told me that using #value on a Textfield will cause ignore the user input, I changed that for #default_value – lordscales91 Nov 25 '14 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.