Closed (fixed)
Project:
Scrambler
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
21 Feb 2018 at 09:35 UTC
Updated:
8 Mar 2018 at 12:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
novitsh commentedComment #3
novitsh commentedComment #4
beerendlauwers commentedWhy are you checking against a
0? Perhaps the empty string or usingissetwould be better ?Perhaps add a comment here why you do the
-1check?Comment #5
novitsh commentedUpdated version attached, thanks for the feedback!
Comment #6
tim@lammar.be commentedOriginally your schema had 1 field (fid), now you are adding field_name.
You want to automatically add the machine name of each field already in this table, right?
In that case, instead of using an update hook inside a foreach loop, I would use a bulk delete/insert instead. (this action affects all the records anyway)
You already start by doing a select to get all fids.
Next i would truncate the whole table.
Next, based on your $fid array, you can build a bulk insert hook.
Something like:
Comment #7
tim@lammar.be commentedHereby the patch file of my previous comment.
Comment #8
nico.knaepen commentedThere is no specific reason why I started by using field id instead of the field machine name. It's just my way of working for all kind of relations in tables. So I don't see an issue to switch to the field machine name.
Comment #10
novitsh commentedThx all for the testing. Commited.