Menu

[r3]: / index.php  Maximize  Restore  History

Download this file

54 lines (42 with data), 871 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
require_once 'DocAnnotation.class.php';
class DBFieldType extends DocAnnotation {
public $type;
public $params = '';
}
class DBId extends DocAnnotation {
}
class DBTableName extends DocAnnotation {
public $name = '';
}
/**
* This describes a database table for persons.
* To seperate DocComments and annotations, nest
* the annotations in HTML comments like this:
* <!---
* @DBTableName("persons")
* -->
* note: the comment begins with
* <!--- instead of <!--
*/
class Person {
/**
* @DBFieldType(Varchar, 255)
* @DBId
*/
public $name;
/**
* @DBFieldType(Date)
* @DBId
*/
public $bdate;
/**
* @DBFieldType(Enum, {MEMBER, GUEST, OTHER})
*/
public $state;
}
echo "<pre>";
$p = new Person();
if (DocAnnotation::hasPropertyAnnotation($p, 'name', 'DBId'))
echo "the property Person->name represents a primary key.";
?>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.