elabx / FieldtypeRecurringDates

Recurring dates Inputfield for ProcessWire.
MIT License
10 stars 1 forks source link

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'webseite1.field_dates_extras' doesn't exist #2

Open juergenweb opened 1 year ago

juergenweb commented 1 year ago

Hi,

after adding a newly created field named "dates" to a template, I always get the message that the table "extras" of the field called "dates" does not exist. I have checked, if the Hook, who is responsible for creating the table starts, but in my case it does not fire. I have checked it with Tracy multiple times by adding a bd() statement inside the Hook method.

This is the Hook that I mean (in FieldtypeRecurringDates.module):

$this->addHookAfter('Fields::added', $this, 'hookAfterFieldAdded');

The method you are hooking is located inside the parent class "WireSaveableItems" and should be run if a new inputfield will be created, right?

Mabe you could check if the table will be created in your case or in other words if the Hook fires in your case.

Best regards

BTW also the delete Hook does not fire in my case.

juergenweb commented 1 year ago

Screenshot 2023-03-15 at 16-06-38 Bearbeite Seite Komplexes Formular • webseite1 at

elabx commented 1 year ago

Hi thanks a lot for testing!

I have run into this error when adding fields through the API and I haven't been able to sort if out, although if the field is created through the UI I have not had this issue. Were you creating the field through the UI??

What ProcessWire/PHP version are you testing on?

juergenweb commented 1 year ago

Hi, yep you are right. It happens if I add a field to a template of a site (let say to basic page). If I go to a page, which uses this template I get the error. It is definitely caused by the Hook, who does not fire in this case. As a result, the table will not be created and this causes the SQL error in the end. So we have to think over if this Hook is the right one for this case. Do you have tried to put fe bd('execute') inside this Hook to see if you will get an output inside the Tracy console?

I am running the latest dev on PHP 8.0 on a local Xampp with using TracyDebugger.

juergenweb commented 1 year ago

Sorry, I am running into this problem by using the UI.

elabx commented 1 year ago

I am testing in an older PHP version, let me see if I can reproduce in 8.0

juergenweb commented 1 year ago

Ok, but I guess that the different PHP version is not the problem.

elabx commented 1 year ago

To be honest I am not sure, I am getting even more errors testing in 8.0.

elabx commented 1 year ago

we have to think over if this Hook is the right one for this case.

I cannot think of a better place, I mean, it should go right after the database operation right?

juergenweb commented 1 year ago

OK, maybe these are warnings?

I had also some troubles with one of my modules on PHP 8.2. I will take a look if I find a Hook that fires and creates the table as expected. That is the problem in development: You are writing some code and it works in your case. Then you upload it and share it with others and you have to struggle with problems, that you never might think of. :-( Belive me! We all have to deal with that troubles, but your module is alpha stage, so lets try to climb the next level together ;-)

elabx commented 1 year ago

I greatly appreciate your help and patience!

I got this working in 7.3, 7.4 and launching it live so I do think it should be a combination of versions.

elabx commented 1 year ago

I moved the hooks initialization to init instead of ready and that seems to fix it, let me know how it goes on your end! Updated in main.

I think I also have to work in getting the field hook on rename event.

juergenweb commented 1 year ago

Yeah, that was the problem. I have not seen it. I have most of my Hooks in the init too, but in this case, i did not recognize it. Anyway, the tables have been created :-) I will test it and control it with PHP Storm and I will give you a feedback if another issue occur.

Thanks