1129

A special welcome to our newest member, Humble-Servant.

Compose Reply

Version 3.6 of the Vtl Data Generator is now available

#1
24 Jul 2024, 9:38am UTC
Wednesday 24th July 2024, at 9:38am UTC
Assuming that you have version 3.4 then you should be able to update to this from within your project.

The Create Module feature is now complete. If you have tables in your database that require a module this will create one for you. You will get an api, a fully functional controller and three views providing basic crud operations. Primary keys with names other than id are fully supported.

Please note that this is being done 'on the fly' as it were. By definition it is not an exact science and never can be. In the main this will get it right but clearly there will be occasions when it doesn't and you might need to step in and alter the code.

If you spot obvious error then please submit issues to the github repo, or even consider providing a fix and pr.

If you can create modules then it seems only sensible that you should be able to delete them, and of course you can.

The final three features added are connected with zip files. There is now the facility to zip up modules or the entire project if you so wish (although please be aware that these operations are mutually exclusive). You can also unzip module zip files. This should make it easy for you to transfer modules that you create from one application to another.

To use the zip feature you must uncomment this line ...



in your php.ini file.
Edited on Wednesday 24th July 2024, at 9:38am UTC
#2
25 Jul 2024, 1:14pm UTC
Thursday 25th July 2024, at 1:14pm UTC
Hi Dom,

Not sure if you had seen these messages on the live stream

10:55 PM
DaFa
Member (1 year)
​​If you are still there DOM, I'm seeing an error thrown if "tables": [] array is empty (i.e. no orphaned tables)

11:02 PM
DaFa
Member (1 year)
​​Dom, you also have legacy code in the index of a newly created module - 'display' view doesn't exist

11:02 PM
DaFa
Member (1 year)
​​otherwise - the module creation is cool

11:12 PM
DaFa
Member (1 year)
​​ah I take that back - the 'Picture Uploader Related Functions' is missing $this->get_picture_path() and $this->_rrmdir()

11:13 PM
DaFa
Member (1 year)
​​also, you have hardcoded 'customers' module on update
Edited on Thursday 25th July 2024, at 1:14pm UTC
#3
25 Jul 2024, 1:21pm UTC
Thursday 25th July 2024, at 1:21pm UTC
And these were the warnings with PHP 8.4.0alpha2


Edited on Thursday 25th July 2024, at 1:21pm UTC
#4
25 Jul 2024, 10:12pm UTC
Thursday 25th July 2024, at 10:12pm UTC
Hi Simon

I managed to catch the last few minutes of the live stream so I took a note of the points you made, almost all are now fixed with the changes up on github.

There is one small directory change I need to make to complete the replication of the single picture uploaded. As it's late here and I have a habit of rising at silly o clock no matter what I will fix that last bit in a few hours from now.

The last three messages about the deprecated issues are very much appreciated and I will attend to those as well.

By my reckoning v3.9 should see everything catered for.
Edited on Thursday 25th July 2024, at 10:12pm UTC
#5
27 Jul 2024, 7:33pm UTC
Saturday 27th July 2024, at 7:33pm UTC
Well 3.9 is here and at least the image aspects should be in working order ( my thanks to DC for accepting a PR that addressed a couple of issues).

I had, perhaps somewhat naively on reflection, assumed that creating fully functional modules on fly going off the info that could be gleaned from interrogating the database would be a relatively simple procedure. I have still to work out how to integrate a meaningful search facility and validation is proving to be anything but easy. However there is now a reasonable expectation that both can be achieved.

My next goal is to see if it's possible to create templates that would allow you to create functional modules utilising Trongate MX. I won't put a time frame on that but it is on my TODO list.

For those of you on V3.4 or above there should be a prompt to update to 3.9. I apologise for using you as beta testers but I would like to create a robust update procedure for modules as a little side project running concurrently with this.
Edited on Saturday 27th July 2024, at 7:33pm UTC
#6
6 Apr 2025, 1:47pm UTC
Sunday 6th April 2025, at 1:47pm UTC
I tried using the VTL data Generator, but Generating fake data in version 5.9 is not working in google crome. getting these errors in dev console when clicking generate button: https://prnt.sc/_PnZ8YtNJ4LD

Same trouble in edge: https://prnt.sc/Xq7HMhR7cHNG
Edited on Sunday 6th April 2025, at 2:03pm UTC
#7
7 Apr 2025, 5:15am UTC
Monday 7th April 2025, at 5:15am UTC
Hi chr1974,

The JavaScript errors (SyntaxError: Unexpected token '<' and ReferenceError: response is not defined) occurred because the PHP backend was sending an HTML error message instead of the expected JSON response when an error happened during fake data generation.

Here's a breakdown of the fixes applied:

File: modules/vtlgen/assets/js/createDataAndIndex.js

Problem: The generateData function's xhr.onload callback tried to parse the server response as JSON using JSON.parse(xhr.responseText). When a PHP error occurred, the server sent HTML, causing JSON.parse to fail (SyntaxError). The subsequent catch block then tried to access response.message, but the response was only defined in the try block, leading to a ReferenceError.

Fix: Modified the catch block within the xhr.onload function to handle the JSON parsing error gracefully. Instead of trying to access the non-existent response variable, it now displays the raw server response (xhr.responseText) in the error modal. This shows the user the actual error message from PHP.

Original Code Snippet (Problematic Catch Block):


Fixed Code Snippet:


File: modules/vtlgen/controllers/Vtlgen.php

Problem: The methods createdataCreateFakeData and createdataWithForeignKeys were intended to return JSON. However, if a PHP error (Notice, Warning, Fatal) occurred before the final echo json_encode(...), PHP's default error reporting would output HTML, breaking the JSON contract with the frontend JavaScript.

Fix: Wrapped the main logic inside both createdataCreateFakeData and createdataWithForeignKeys methods within try...catch blocks. The catch block now ensures that even if an exception occurs, the script sets the Content-Type: application/json header, logs the detailed error server-side (error_log), sets an HTTP 500 status code, and explicitly echos a JSON-formatted error message. This guarantees a valid JSON response is always sent back. Additionally, corrected the Faker library initialization.

Example Fix Structure (Applied to both methods):

Download fixed files here >> https://ums.myds.me/help-bar-fixes/Vtlgen-5.9-fixes.zip

These changes ensure that the JavaScript correctly handles potential non-JSON responses and that the PHP backend consistently returns JSON, even when internal errors occur, providing better error feedback.

Cheers,
DaFa
×