New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relationship cannot parse dynamic category ids #3104
Comments
Just wanted to give this a bump, has anyone seen it? |
@jamesseavers yes, we have seen it. Not sure whether it should be classified as bug, or limitation - but we have noted it as a thing to consider for improvement on relationship fields. It certainly is related to parsing order, and I think at this point the only way to overcome the limitation would be using embeds. |
Good to know. I'll revert to an embed. |
Thinking more about this, should a 'limitation' really end in a fatal error? |
Well, it is limitation in terms that "the tag is not supported to be used that way". So - the error could certainly provide better information, but - this is still supposed to error out |
@jamesseavers I just tested the below code (PHP on input) on latest EE 7.2.17 and it's working fine. Can you please confirm that you still have this issue?
|
@intoeetive Yes, it is still an issue. |
Can you show how your template looks like? I feel like I must be missing something as I'm not replicating. Also, is PHP set to parse on input? |
`
Yes, php is set to input. |
Is |
Yes, it is. I pull a single entry from the Speakers channel. I then access their related sessions. Within each related session, I then pull other related speakers to that session. Does that make sense? |
Makes sense, but I'm still unable to replicate the issue :) Looking at the trace you provided though, I see that the error is happening around |
Noting that I wasn't able to replicate even using same templates and same Channel Sets imported. Will keep open for some time to see if another reports come in |
Description of the problem
When using the relationship field the category parameter can only accept a hard-coded variable like so:
{related_sessions category="36"}
However, when the category id is passed in as a variable, say from php or by a tested mod result like:
{related_sessions category="{exp:sym_eventcycles:get_year_id}"}
OR
{related_sessions category="<?php echo $year_cat_id; ?>"}
Both of these variables are tested and work as expect in parent tags.
The following error is shown:
InvalidArgumentException Caught
Payload cannot be retrieved.
ee/legacy/libraries/datastructures/Tree.php:173
Stack Trace: Please include when reporting this error
#0 ee/legacy/libraries/relationship_parser/Nodes.php(181): EE_TreeNode->__get('parser')
#1 ee/legacy/libraries/channel_entries_parser/Parser.php(339): ParseNode->callback_tagdata_loop_end('', Array)
#2 ee/legacy/libraries/Channel_entries_parser.php(172): EE_Channel_data_parser->parse(Array, Array)
#3 ee/legacy/libraries/relationship_parser/Parser.php(245): EE_Channel_parser->parse(Object(Channel), Array, Array)
#4 ee/legacy/libraries/relationship_parser/Parser.php(209): EE_Relationship_data_parser->replace(Object(ParseNode), '{related_sessio...', Array)
#5 ee/legacy/libraries/relationship_parser/Parser.php(90): EE_Relationship_data_parser->parse_node(Object(ParseNode), 1950, '\n\n{layout:set n...')
#6 ee/legacy/libraries/channel_entries_parser/components/Relationship.php(124): EE_Relationship_data_parser->parse(1950, '\n\n{layout:set n...', Object(Channel))
#7 ee/legacy/libraries/channel_entries_parser/Parser.php(291): EE_Channel_relationship_parser->replace('\n\n{layout:set n...', Object(EE_Channel_data_parser), Object(EE_Relationship_data_parser))
#8 ee/legacy/libraries/Channel_entries_parser.php(172): EE_Channel_data_parser->parse(Array, Array)
#9 ee/ExpressionEngine/Addons/channel/mod.channel.php(2495): EE_Channel_parser->parse(Object(Channel), Array, Array)
#10 ee/ExpressionEngine/Addons/channel/mod.channel.php(257): Channel->parse_channel_entries()
#11 ee/legacy/libraries/Template.php(1795): Channel->entries()
#12 ee/legacy/libraries/Template.php(1471): EE_Template->process_tags()
#13 ee/legacy/libraries/Template.php(610): EE_Template->tags()
#14 ee/legacy/libraries/Template.php(244): EE_Template->parse('{!-- ra:0000000...', false, 1, false)
#15 ee/legacy/libraries/Template.php(174): EE_Template->fetch_and_parse('listings-detail', Array, false)
#16 ee/legacy/libraries/Core.php(794): EE_Template->run_template_engine('listings-detail', 'speaker')
#17 ee/legacy/controllers/ee.php(53): EE_Core->generate_page()
#18 [internal function]: EE->index()
#19 ee/ExpressionEngine/Core/Core.php(268): call_user_func_array(Array, Array)
#20 ee/ExpressionEngine/Core/Core.php(124): ExpressionEngine\Core\Core->runController(Array)
#21 ee/ExpressionEngine/Boot/boot.php(184): ExpressionEngine\Core\Core->run(Object(ExpressionEngine\Core\Request))
#22 index.php(164): require_once('...')
#22 index.php(164): require_once('...')
Environment Details:
The text was updated successfully, but these errors were encountered: