Browse Source

Remove Schema::isRequired()

The validator provides this not the schema.
Mark Story 11 years ago
parent
commit
ffd5d89518
2 changed files with 1 additions and 34 deletions
  1. 1 16
      src/Form/Schema.php
  2. 0 18
      tests/TestCase/Form/SchemaTest.php

+ 1 - 16
src/Form/Schema.php

@@ -34,6 +34,7 @@ class Schema {
 	protected $_fieldDefaults = [
 		'type' => null,
 		'length' => null,
+		'precision' => null,
 		'required' => false,
 	];
 
@@ -101,22 +102,6 @@ class Schema {
 	}
 
 /**
- * Check whether or not a field is required.
- *
- * Fields that are not defined in the schema are not required.
- *
- * @param string $name The name of the field.
- * @return bool Whether or not a field is required.
- */
-	public function isRequired($name) {
-		$field = $this->field($name);
-		if (!$field) {
-			return false;
-		}
-		return (bool) $field['required'];
-	}
-
-/**
  * Get the type of the named field.
  *
  * @param string $field The name of the field.

+ 0 - 18
tests/TestCase/Form/SchemaTest.php

@@ -94,24 +94,6 @@ class SchemaTest extends TestCase {
 	}
 
 /**
- * test isRequired
- *
- * @return void
- */
-	public function testIsRequired() {
-		$schema = new Schema();
-
-		$schema->addField('name', ['type' => 'string'])
-			->addField('email', [
-				'type' => 'string',
-				'required' => true
-			]);
-		$this->assertFalse($schema->isRequired('name'));
-		$this->assertTrue($schema->isRequired('email'));
-		$this->assertFalse($schema->isRequired('nope'));
-	}
-
-/**
  * test fieldType
  *
  * @return void