|
@@ -28,6 +28,7 @@ class DeviceValidator extends ConstraintValidator
|
|
|
{
|
|
|
$this->webservice = $webservice;
|
|
|
$this->deviceCheckUrl = $deviceCheckUrl;
|
|
|
+ $this->enabled = true;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -36,6 +37,8 @@ class DeviceValidator extends ConstraintValidator
|
|
|
*/
|
|
|
public function validate($entity, Constraint $constraint)
|
|
|
{
|
|
|
+ if(!$this->enabled) return;
|
|
|
+
|
|
|
$result = $this->webservice->makeGetRequest($this->deviceCheckUrl);
|
|
|
$data = json_decode($result, true);
|
|
|
if (is_null($entity->getId()) && isset($data['result']) && $data['result'] == false) {
|
|
@@ -44,4 +47,8 @@ class DeviceValidator extends ConstraintValidator
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ function remoteCheck($enable){
|
|
|
+ $this->enable = $enable;
|
|
|
+ }
|
|
|
+
|
|
|
}
|