elgentos/masquerade

delete: true gives errors

peterjaap opened this issue · 3 comments

@johnorourke I just ran into this;

PHP Notice:  Undefined index: columns in phar:///usr/bin/masquerade/src/Elgentos/Masquerade/DataProcessor/DefaultDataProcessorFactory.php on line 27
PHP Warning:  Invalid argument supplied for foreach() in phar:///usr/bin/masquerade/src/Elgentos/Masquerade/DataProcessor/DefaultDataProcessorFactory.php on line 27
PHP Notice:  Array to string conversion in phar:///usr/bin/masquerade/src/Elgentos/Masquerade/Console/SymfonyOutput.php on line 92
Deleting records from Array table
In Connection.php line 669:
                                                                               
  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error i  
  n your SQL syntax; check the manual that corresponds to your MySQL server v  
  ersion for the right syntax to use near 'as `main`' at line 1 (SQL: delete   
  from `swissup_checkoutfields_values` as `main`)                              
                                                                               
In PDOConnection.php line 72:
                                                                               
  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error i  
  n your SQL syntax; check the manual that corresponds to your MySQL server v  
  ersion for the right syntax to use near 'as `main`' at line 1                
                                                                               
In PDOConnection.php line 67:
                                                                               
  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error i  
  n your SQL syntax; check the manual that corresponds to your MySQL server v  
  ersion for the right syntax to use near 'as `main`' at line 1    

This is the yaml file I'm using; https://github.com/elgentos/masquerade/wiki/Swissup-YAML-file

Any idea?

@peterjaap I also ran into this today. This is because of https://github.com/elgentos/masquerade/blob/master/src/Elgentos/Masquerade/DataProcessor/TableService.php#L53-L56

The delete query will result in:

delete from your_table as `main` where ...

It should be just:

delete from your_table where ...

I don't know if the alias 'main' is actually used in Masquerade, else we could remove it.

@peterjaap looks like @Tjitse-E fixed this in #73