terminal42 / contao-mailusername

MIT License
7 stars 5 forks source link

Error bei Contao 3.5.0 #7

Closed mstudio-dev closed 9 years ago

mstudio-dev commented 9 years ago

Ich bekomme bei C 3.5.0 einen Error: "Column 'username' cannot be null". Liegt vielleicht daran, dass sich bei 3.5 das Feld geändert hat: 'sql' => "varchar(64) COLLATE utf8_bin NULL" (3.4.5: 'sql' => "varchar(64) COLLATE utf8_bin NOT NULL default ''")

aschempp commented 9 years ago

@qzminski could be a time-filler for you? :-)

qzminski commented 9 years ago

Fixed in 26e4fca.

The problem lied in the below line of registration module. The username is obviously empty in this case and the only way we can alter it is through the model that is already in the model registry.

https://github.com/contao/core/blob/master/system/modules/core/modules/ModuleRegistration.php#L450

aschempp commented 9 years ago

Looks good, but:

  1. Cody style seems to be wrong (if I look at the GitHub diff)
  2. Shouldn't we check for null on the findByPk() method?
qzminski commented 9 years ago
  1. Yes because the old code is still tabs.
  2. In theory maybe yes, but in practice it would never be the case.
aschempp commented 9 years ago

Can you fix both then please? Coding style for old code and the null-check?

qzminski commented 9 years ago

Both fixed in 677308f and a34d17e. It now uses the Model::refresh() method instead of overidding the username value.

mstudio-dev commented 9 years ago

Funzt. Thank You!