Having problem with list<taxonomy_term> in a custom action

Events happening in the community are now at Drupal community events on www.drupal.org.
mike_yang's picture

Hi there:

I'm new to Rules (and Drupal as a matter of fact), so would really appreciate any help on this problem I'm encountering.

I'm trying to create a new custom action that takes a list parameter. For testing, I created a simple action set that takes an argument of list as well. When I tried to execute the action_set within my code, using rules_invoke_component(), I get this error:

# Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 354 of /Applications/MAMP/htdocs/alegup-d7/includes/entity.inc).
# Recoverable fatal error: Object of class stdClass could not be converted to string in DatabaseStatementBase->execute() (line 2039 of /Applications/MAMP/htdocs/alegup-d7/includes/database/database.inc).

The arguments I passed into rules_invoke_component() are (1) the action_set name; and (2) array of taxonomy terms that I built myself using

$taxonomies[] = taxonomy_term_load(5);

, etc.

If it helps, the versions I'm using are: Rules 7.x-2.x-dev, Entity API 7.x-1.0-beta7

Thanks in advance for any help.

Comments

Input list<> parameters are special

mike_yang's picture

OK. I think I know the problem... for list<> input parameters, looks like one should pass in the id of the objects, instead of the fully instantiated objects?

http://drupal.org/node/1013428

I didn't seem to recall this fact mentioned in the API docs though in big bold letters :-)

Output list<> same behavior

mike_yang's picture

I have another custom action that returns a list. It had to return an array of node IDs instead of the fluffed up node objects as well.

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: