sheadawson / silverstripe-zenvalidator

Faster, easier client and server-side form validation for SilverStripe
BSD 3-Clause "New" or "Revised" License
57 stars 28 forks source link

Missing imports #73

Open phptek opened 5 years ago

phptek commented 5 years ago

AFAICT there are half a dozen missing imports, that cause problems in using this module with framework v4.

I ascertained the following were required just with a casual glance down the ZenValidatorConstraint.php file:

use SilverStripe\Assets\File;
use SilverStripe\View\Requirements;
use SilverStripe\i18n\i18n;
use \Exception;
use SilverStripe\Forms\CheckboxSetField;
use SilverStripe\Control\Director;
lekoala commented 5 years ago

that's odd because i'm pretty sure i managed to use it on a ss4 website :-D but you are definetely right so maybe i missed something somewhere. i didn't test extensively. i'll look into it, i have a website using this module and it should have everything in order otherwise my customer is not going to be happy ;-)

this module would definetely need a bit of update, also since https://github.com/praxisnetau/silverware-validator doesn't seem to get any recent updates

lekoala commented 5 years ago

https://github.com/sheadawson/silverstripe-zenvalidator/commit/034f5112927480f4d5f69e2b0afedb89391262c1 should fix this as well as a lot of code formatting issues, i'm running some tests to see if everything is indeed working as it should

phptek commented 5 years ago

034f511 only adds Requirements - the following imports are still missing from that:

use SilverStripe\Assets\File;
use SilverStripe\i18n\i18n;
use SilverStripe\Forms\CheckboxSetField;
use SilverStripe\Control\Director

And sure, heaps of people might be using the module, but if your're not using the problematic constraints, PHP won't tell you about them until you try to call missing deps :-)

phptek commented 5 years ago

I can see that dev-master now has the correct imports - excellent, and that you've also fixed the composer vendormodule problem (double excellent) however, packagist hasn't been updated for "dev-master" since September (Just manually visited packagist.org to check) .

So after a composer update, I still see:

vagrant@my-project: (develop-ss4) $> composer info sheadawson/silverstripe-zenvalidator | grep source
source   : [git] https://github.com/sheadawson/silverstripe-zenvalidator.git f7022d590431d8d5f4b87f7c5d2d21e8f8ac4def
lekoala commented 5 years ago

@sheadawson is it possible to setup the auto update hook on packagist? i don't think i have the required permissions