rickyrolly
New member
Hi everyone,
I'm working on a custom add-on for XenForo 2.3.7 that programmatically creates a Node (Category), sets specific user-group-based permissions for that node, and creates sub-forums.
I am running into a RuntimeException: Creation Failed! Please enter a valid value which points to
Earlier logs showed a MySQL Error 1265 (Data truncated for column 'permission_value'). It seems the Entity Manager is rejecting the string for the
Has anyone encountered this strict validation behavior in 2.3? Is there a preferred "Service" layer approach for node-level permission overrides in the new version, or am I missing a required field that
Thanks in advance
I'm working on a custom add-on for XenForo 2.3.7 that programmatically creates a Node (Category), sets specific user-group-based permissions for that node, and creates sub-forums.
I am running into a RuntimeException: Creation Failed! Please enter a valid value which points to
src/XF/Mvc/Entity/Entity.php on line 1276.The Context
XenForo Version: 2.3.7
Database: MariaDB (Strict Mode enabled)- Goal: Create a "Clan Hub" Category under a specific parent, create a unique User Group for the clan, and grant that Group
viewNode=allowon the new Category.
The Problem
My browser console shows a 200 OK response with the following JSON error:
JSON:
{"status": "error","errors": ["Establishment failed: Please enter a valid value."]}
Earlier logs showed a MySQL Error 1265 (Data truncated for column 'permission_value'). It seems the Entity Manager is rejecting the string for the
permission_value ENUM, or perhaps the Node handler is rejecting the specific permission ID combination.Current Code Logic
I am using a database transaction. I create the Node via raw SQL (to bypass hierarchy/parent validation issues) and attempt to save the permission via the Entity Manager:
Code:
/** @var \XF\Entity\PermissionEntryContent $permEntry */$permEntry = $this->em()->create('XF:PermissionEntryContent');$permEntry->bulkSet(['content_type' => 'node','content_id' => $nodeId,'permission_group_id' => 'general','permission_id' => 'viewNode','permission_value' => 'allow','user_id' => 0,'user_group_id' => $userGroupId]);$permEntry->save();
What I've tried
Manually cleaning thexf_permission_entry_contenttable of malformed ENUM values.
Using$permEntry->save(false)to bypass strict validation.- Ensuring all NOT NULL fields (like
breadcrumb_dataandnavigation_id) are populated in the raw SQL inserts for the node.
Has anyone encountered this strict validation behavior in 2.3? Is there a preferred "Service" layer approach for node-level permission overrides in the new version, or am I missing a required field that
Entity.php is now strictly enforcing?Thanks in advance