# |
Sep 16th 2019, 21:49 |
rightscoreanalysis |
can i patch the entity before the rendering the form back to Admin? |
# |
Sep 16th 2019, 21:48 |
rightscoreanalysis |
after the file is read I copy the contents into an array which I then want to render in a form, alllowing the admin to make an alterations before saving |
# |
Sep 16th 2019, 21:47 |
rightscoreanalysis |
I have a form with file upload field. This allows admin to import a text file which contains data to be saved to my Model |
# |
Sep 16th 2019, 20:32 |
dereuromark |
@felipe.marinho You gather the necessary data, and let it do the rest in the background. for this usually just the id of the db row is needed, the entity etc. |
# |
Sep 16th 2019, 20:31 |
challgren |
Or straight up `fgetcsv()` |
# |
Sep 16th 2019, 20:29 |
challgren |
@felipe.marinho you can use https://github.com/ProLoser/CakePHP-CSV |
# |
Sep 16th 2019, 20:29 |
felipe.marinho |
@dereuromark I'll definitely try it... just don't know how to relate the columns but, it's OK :slightly_smiling_face: thank you guys. |
# |
Sep 16th 2019, 20:28 |
challgren |
Plugin makes a good plugin! |
# |
Sep 16th 2019, 20:19 |
dereuromark |
https://github.com/dereuromark/cakephp-queue is the most simple one and what we use for this |
# |
Sep 16th 2019, 20:15 |
felipe.marinho |
I never created any code in PHP to run as a background task, just some exec commands... I'll try to restructure it. |
# |
Sep 16th 2019, 20:12 |
felipe.marinho |
I need to relate, CSV columns with table columns, and that was the only way for me to solve this... |
# |
Sep 16th 2019, 20:09 |
ndm |
Why would you even try to get that working? Processing 500k records is clearly a job for a background task. |
# |
Sep 16th 2019, 20:06 |
jotpe |
Not sure about this :man-shrugging: |
# |
Sep 16th 2019, 20:04 |
felipe.marinho |
But the problem is that PHP is blocking I/O when is processing data (monothread) the way we normally work, right? |
# |
Sep 16th 2019, 19:59 |
jotpe |
To decouple the view a bit. |
# |
Sep 16th 2019, 19:58 |
jotpe |
Maybe you could try something like build a view+json and after the file handling is finished, update the json to update the view? |
# |
Sep 16th 2019, 19:53 |
felipe.marinho |
But there's no error, or fail, the browser go "empty_response" but in the backend the action still executing, until the end (and complete with success) |
# |
Sep 16th 2019, 19:52 |
jotpe |
Maybe try catch and resolve the exception? |
# |
Sep 16th 2019, 19:51 |
ricksaccous |
anyway i have a meeting, good luck |
# |
Sep 16th 2019, 19:51 |
ricksaccous |
@felipe.marinho you're probably timing out, you want to chunk it out into jobs |
# |
Sep 16th 2019, 19:51 |
jotpe |
:D |
# |
Sep 16th 2019, 19:49 |
felipe.marinho |
It's an action that read a CSV with 500k lines and insert into the database lol |
# |
Sep 16th 2019, 19:48 |
felipe.marinho |
This is my code: https://pastebin.com/ueqYpSG3 |
# |
Sep 16th 2019, 19:47 |
ricksaccous |
this might be more of a jquery/js question btw |
# |
Sep 16th 2019, 19:47 |
ricksaccous |
where is the code you are using to execute the action? |
# |
Sep 16th 2019, 19:47 |
ricksaccous |
how often are you executing the action? |
# |
Sep 16th 2019, 19:46 |
ricksaccous |
how are you executing the action? |
# |
Sep 16th 2019, 19:46 |
felipe.marinho |
Has anyone had a problem like this? |
# |
Sep 16th 2019, 19:43 |
ricksaccous |
I've got enough juice for another hour and a half actually which is pretty much what I have to do |
# |
Sep 16th 2019, 19:41 |
jotpe |
Oh damn :( |
# |
Sep 16th 2019, 19:40 |
ricksaccous |
I'm feeling tired but unfortunately I have to chug a lug on for a while |
# |
Sep 16th 2019, 19:40 |
ricksaccous |
it's not good working when you're tired |
# |
Sep 16th 2019, 19:39 |
ricksaccous |
lol |
# |
Sep 16th 2019, 19:39 |
jotpe |
I should go to bed... |
# |
Sep 16th 2019, 19:39 |
jotpe |
Just stupid. My Query is against the Confirmation and not the Email itself |
# |
Sep 16th 2019, 19:38 |
jotpe |
Ah wait |
# |
Sep 16th 2019, 19:37 |
ricksaccous |
ok |
# |
Sep 16th 2019, 19:37 |
jotpe |
The correct Entity |
# |
Sep 16th 2019, 19:37 |
jotpe |
Well, it finds it. |
# |
Sep 16th 2019, 19:36 |
ricksaccous |
are you sure the model is using that Entity? |
# |
Sep 16th 2019, 19:36 |
slackebot |
<jotpe> |