Page 1 of 1
Hard coded entries for later use (client requeriment)
Posted: 2024-01-20 13:36
by arcanebits
I have a client who, as a requirement, needs the application to automatically write a series of records to a specific table upon startup. The detail is that, by requirement (it is a financial entity), they need it to be hard-coded How can I achieve this? How can I write 3 records to a specific table and then work with those records later inside de Application as a normal record?"
Any help is welcome.
A3
Re: Hard coded entries for later use (client requeriment)
Posted: 2024-01-22 13:22
by arcanebits
I was thinking in using the after login hookup... any ideas?
Re: Hard coded entries for later use (client requeriment)
Posted: 2024-01-22 15:25
by jsetzer
I usually do that kind of stuff like auto inserting master data, if not exist, or auto creating groups and setting permissions by executing sql statements or method-calls in __global.php or in header-extras.php, sometimes also in TABLENAME.php hooks file if this is table related.
I usually execute those scripts if getLoggedAdmin(), not every time, because after update usually I reload the page as admin and so the scripts get executed by myself on first run.
Sometimes it makes sense to have a separate setup or migration or update file for the required update steps, which can be included.
Re: Hard coded entries for later use (client requeriment)
Posted: 2024-01-23 14:41
by arcanebits
Hi, very nice approach, I will hand draw a analisis of this aproach to port it after as code!
thanks again!
a3