MonkeyT
unread,Jul 19, 2022, 4:21:48 PM7/19/22Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Joomla! General Development
I truly hate the #__fields_values table in Joomla4.
It has no primary key, relying on querying against a combination of field_id and item_id. I understand that.
But if I create a MySQLI query "REPLACE INTO #__fields_values VALUES ( 7, 155, 1111 )" and apply it using $dbo->execute( $query ), it fails with literally no impact at all - no error gets thrown, no exception is created, and no change is made to the table's data. If I copy and paste that very same query into PhpMyAdmin (with the correct table name), it works perfectly, with no issues.
FieldsHelper has no method to add/create records, even though it has the means to retrieve those records. I can't find a way to successfully instantiate a FieldModel which does seem to have a save function.
To update one value in this three field record, the Joomla source code appears to manually delete that record with one query (whether it actually exists or not), and re-insert it with another query (which is precisely what REPLACE INTO should be doing.)
WTH?
I need to update a user's custom field values using data from a third-party component instead of forcing that user to manually edit their user profile, but trying to update this database table fails in every way possible. Even the PhpMyAdmin interfaces won't edit it because it has no Primary Key.
A three field table should never cause this much frustration.
Does Joomla4 provide some simple update method for this data and just fail to mention it?