Fatal error: Call to undefined method EntityValueWrapper::getIdentifier() in D:\drupal-7.0\sites\all\modules\userpoints\userpoints_rules.module on line 52

It seems this fatal error is due to a polymorphism issue: the object is not the type that supports that method (see http://www.drupalcontrib.org/api/drupal/contributions--entity--includes-...)

I'm not very familiar with PHP object approach, nor with the implementation of rules, but I checked the code and decided to change the line
$params['entity_id'] = $userpoints_transaction->entity->getIdentifier();
to this:
$params['entity_id'] = $userpoints_transaction->entity_id;

Sorry I'm not posting a formal patch, I don't know whether this fix actually makes sense... I just did it to get rid of the fatal error, I'm not using the rules integration, so I hope the maintainers can discuss/review/fix it properly. Thanks!

Comments

arithmetric’s picture

Priority: Critical » Major
Status: Needs review » Postponed (maintainer needs more info)

I can't reproduce this error. Can you describe the situation where you saw it?

mariano.barcia’s picture

I was processing an order, changing the status of the order from pending to complete, using a dev version of userpoints_ubercart for D7 I was working on. I couldn't see a relationship with this module, and I am not aware about the internals of rules module. I'm sorry I cannot provide further information right now, I may get back to my project next week, reverse the fix I did above, and check if it's still happening and how, and post again with more detailed information.

berdir’s picture

Something is wrong on your install I think, are you really sure that you are not using rules?

mariano.barcia’s picture

I have the module enabled, but I don't remember any rule about userpoints (I will be checking next week). If nobody else is having this issue, is good, you may demote its severity? You may check the pre-conditions of the object being used here or wait until I can provide more info, to discard any weird thing in my particular setup. The bad thing about it, even if it happens in a special case, is that it causes a fatal error :-/. Will keep you posted next week, thanks for the feedback.

berdir’s picture

Priority: Major » Normal

Is this still an issue?

mariano.barcia’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

I've postponed myproject and I don't know when I'm going to be able to provide more feedback, so I'm closing it for now, will re-open the issue if needed. Thanks!

basscleff94010’s picture

Version: 7.x-1.0-rc1 » 7.x-2.x-dev
Issue summary: View changes
Issue tags: +Commcerce Kickstart2

I just experienced what I believe is the same error. Here is the message:

Fatal error: Call to undefined method EntityValueWrapper::get()

I am writing Rules in Commerce KS2.

The action is:

Fetch entity by property
Parameter: Entity type: Commerce Product, Property: Type, Value: [node:field-event-pieces:0...
Provides variables: Fetched entity (entity_fetched)

jantoine’s picture

@basscleff94010,

You issues seems more related to one that I was having with Rules and Commerce which I posted and wrote a patch here: #2225215: Improper 'token type' definitions in hook_entity_info() implementations. You can apply that patch and clear caches and see if that resolves your issue. If it does, please comment in that issue!