Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
cf5b0ef9
Commit
cf5b0ef9
authored
May 26, 2006
by
doctrine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validators updated
parent
f7a3c2f3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
22 deletions
+12
-22
Notnull.class.php
classes/Validator/Notnull.class.php
+4
-1
Range.class.php
classes/Validator/Range.class.php
+4
-15
Regexp.class.php
classes/Validator/Regexp.class.php
+4
-1
classes.php
tests/classes.php
+0
-5
No files found.
classes/Validator/Notnull.class.php
View file @
cf5b0ef9
...
...
@@ -7,7 +7,10 @@ class Doctrine_Validator_Notnull {
* @return boolean
*/
public
function
validate
(
Doctrine_Record
$record
,
$key
,
$value
)
{
return
(
$value
===
null
);
if
(
$value
===
null
)
return
false
;
return
true
;
}
}
?>
classes/Validator/Range.class.php
View file @
cf5b0ef9
<?php
class
Doctrine_Validator_Range
{
/**
* @param integer $max
*/
public
function
setMin
(
$min
)
{
$this
->
min
=
$min
;
}
/**
* @param integer $max
*/
public
function
setMax
(
$max
)
{
$this
->
max
=
$max
;
}
/**
* @param Doctrine_Record $record
* @param string $key
...
...
@@ -20,10 +8,11 @@ class Doctrine_Validator_Range {
* @return boolean
*/
public
function
validate
(
Doctrine_Record
$record
,
$key
,
$value
,
$args
)
{
if
(
$var
<
$this
->
min
)
$e
=
explode
(
"-"
,
$args
);
if
(
$value
<
$e
[
0
])
return
false
;
if
(
$var
>
$this
->
max
)
if
(
isset
(
$e
[
1
])
&&
$value
>
$e
[
1
]
)
return
false
;
return
true
;
...
...
classes/Validator/Regexp.class.php
View file @
cf5b0ef9
...
...
@@ -8,7 +8,10 @@ class Doctrine_Validator_Regexp {
* @return boolean
*/
public
function
validate
(
Doctrine_Record
$record
,
$key
,
$value
,
$args
)
{
return
$value
;
if
(
preg_match
(
"/
$args
/"
,
$value
))
return
true
;
return
false
;
}
}
?>
tests/classes.php
View file @
cf5b0ef9
...
...
@@ -124,9 +124,6 @@ class Album extends Doctrine_Record {
}
}
class
Song
extends
Doctrine_Record
{
public
function
setUp
()
{
$this
->
hasColumn
(
"genre"
,
"string"
,
"30"
);
}
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
"album_id"
,
"integer"
);
$this
->
hasColumn
(
"genre"
,
"string"
,
20
);
...
...
@@ -210,6 +207,4 @@ class Forum_Thread extends Doctrine_Record {
$this
->
ownsMany
(
"Forum_Entry as Entries"
,
"Forum_Entry.thread_id"
);
}
}
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment