diff --git a/app/Controller/AppController.php b/app/Controller/AppController.php index fdc004f10..dd3b2a88b 100755 --- a/app/Controller/AppController.php +++ b/app/Controller/AppController.php @@ -363,4 +363,54 @@ class AppController extends Controller { //} return false; } + + + public function reportValidationIssuesEvents() { + // search for validation problems in the events + if (!self::_isAdmin()) throw new NotFoundException(); + print ("

Listing invalid event validations

"); + $this->loadModel('Event'); + // get all events.. + $events = $this->Event->find('all',array('recursive' => -1)); + debug($events); + // for all events.. + foreach ($events as $event) { + $this->Event->set($event); + if ($this->Event->validates()) { + // validates + } else { + $errors = $this->Event->validationErrors; + print ("

Validation errors for event: " . $event['Event']['id'] . "

");
+		        print_r($errors);
+		        print ("

Event details:

");
+		        print_r($event);
+		        print ("

"); + } + } + } + + public function reportValidationIssuesAttributes() { + // search for validation problems in the attributes + if (!self::_isAdmin()) throw new NotFoundException(); + print ("

Listing invalid attribute validations

"); + $this->loadModel('Attribute'); + // get all attributes.. + // FIXME fetch attributes by batch of 1000 or so + $attributes = $this->Attribute->find('all',array('recursive' => -1)); + // for all attributes.. + foreach ($attributes as $attribute) { + $this->Attribute->set($attribute); + if ($this->Attribute->validates()) { + // validates + } else { + $errors = $this->Attribute->validationErrors; + print ("

Validation errors for attribute: " . $attribute['Attribute']['id'] . "

");
+		        print_r($errors);
+		        print ("

Attribute details:

");
+		        print_r($attribute);
+		        print ("

"); + } + } + } + } \ No newline at end of file