From 5d67e0aaed8a46f15cf87fe933199fac04357556 Mon Sep 17 00:00:00 2001
From: doctrine <doctrine@625475ce-881a-0410-a577-b389adb331d8>
Date: Mon, 29 May 2006 09:17:52 +0000
Subject: [PATCH]

---
 classes/Null.class.php           |  6 ++++++
 classes/Validator/Enum.class.php | 23 +++++++++++++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 classes/Null.class.php
 create mode 100644 classes/Validator/Enum.class.php

diff --git a/classes/Null.class.php b/classes/Null.class.php
new file mode 100644
index 000000000..4c4012af7
--- /dev/null
+++ b/classes/Null.class.php
@@ -0,0 +1,6 @@
+<?php
+/**
+ * Doctrine_Null
+ */
+class Doctrine_Null { }
+?>
diff --git a/classes/Validator/Enum.class.php b/classes/Validator/Enum.class.php
new file mode 100644
index 000000000..57e512c50
--- /dev/null
+++ b/classes/Validator/Enum.class.php
@@ -0,0 +1,23 @@
+<?php
+class Doctrine_Validator_Enum {
+    /**
+     * @param Doctrine_Record $record
+     * @param string $key
+     * @param mixed $value
+     * @param string $args
+     * @return boolean
+     */
+    public function validate(Doctrine_Record $record, $key, $value, $args) {
+        $max = substr_count($args, "-");
+        $int = (int) $value;
+
+        if($int != $value)
+            return false;
+
+        if($int < 0 || $int > $max)
+            return false;
+            
+        return true;
+    }
+}
+?>