1
0
mirror of synced 2024-12-14 23:26:04 +03:00
doctrine2/manual/documentation.php

646 lines
27 KiB
PHP
Raw Normal View History

2006-07-24 01:08:06 +04:00
<?php
require_once("highlight.php");
error_reporting(E_ALL);
include("top.php");
$h = new PHP_Highlight();
function render($title,$t,$e) {
global $h;
print $e." <a name=\"$e\"><u>".$t."</u></a><br><br>\n";
$c = "";
if(file_exists("docs/$e.php")) {
rename("docs/$e.php","docs/$title - $t.php");
}
if(file_exists("docs/$t.php")) {
rename("docs/$t.php","docs/$title - $t.php");
}
if(file_exists("docs/$title - $t.php")) {
$c = file_get_contents("docs/$title - $t.php");
if(substr($c,0,5) == "<?php") {
include("docs/$title - $t.php");
} else
print $c."<br><br>";
}
$c = "";
if(file_exists("codes/$e.php")) {
rename("codes/$e.php","codes/$title - $t.php");
}
if(file_exists("codes/$t.php")) {
rename("codes/$t.php","codes/$title - $t.php");
}
if(file_exists("codes/$title - $t.php")) {
print "<table border=1 class='dashed' cellpadding=0 cellspacing=0>";
print "<tr><td>";
2006-08-21 14:16:36 +04:00
$c = file_get_contents("codes/$title - $t.php");
$c = trim($c);
2006-07-24 01:08:06 +04:00
$h->loadString($c);
print $h->toHtml();
print "</td></tr>";
print "</table>";
}
print "<br>";
}
function render_block($name) {
2006-10-01 17:58:19 +04:00
2006-07-24 01:08:06 +04:00
if(file_exists("docs/$name.php")) {
$c = file_get_contents("docs/$name.php");
if(substr($c,0,5) == "<?php") {
include("docs/$name.php");
} else {
print $c."<br><br>";
}
}
if(file_exists("codes/$name.php")) {
$c = file_get_contents("codes/$name.php");
2006-08-21 14:16:36 +04:00
$c = trim($c);
2006-10-01 17:58:19 +04:00
renderCode($c);
}
}
function renderCode($c = null) {
if( ! empty($c)) {
$h = new PHP_Highlight;
2006-07-24 01:08:06 +04:00
$h->loadString($c);
2006-08-21 14:16:36 +04:00
print "<table width=500 border=1 class='dashed' cellpadding=0 cellspacing=0>";
print "<tr><td>";
2006-07-24 01:08:06 +04:00
print $h->toHtml();
print "</td></tr>";
print "</table>";
}
}
function array2path($array, $path = '') {
$arrayValues = array();
$index = 1;
foreach ($array as $k => $value) {
$p = ($path !== '')?$path.".".$index:$index;
if (is_scalar($value) || is_resource($value)) {
$arrayValues[$p] = $value;
} elseif (is_array($value)) {
$arrayValues[$p] = $k;
$arrayValues = $arrayValues + array2path($value, $p);
}
$index++;
}
return $arrayValues;
}
$menu = array("Getting started" =>
array(
"Requirements",
"Installation",
2006-08-08 02:03:55 +04:00
"Compiling",
2006-07-24 01:08:06 +04:00
"Starting new project",
"Setting table definition" => array(
"Introduction",
2006-09-21 08:03:03 +04:00
"Table and class naming",
"Field(Column) naming",
2006-07-24 01:08:06 +04:00
"Data types and lengths",
"Constraints and validators",
"Default values",
"Enum emulation",
2006-09-16 22:04:01 +04:00
2006-07-24 01:08:06 +04:00
),
2006-08-07 00:46:12 +04:00
"Record identifiers" => array(
"Introduction",
"Autoincremented",
"Natural",
"Composite",
"Sequential")
2006-07-24 01:08:06 +04:00
),
2006-10-01 17:58:19 +04:00
/**
"Schema reference" =>
array(
"Data types" => array(
"Boolean",
"Integer",
"Float",
"String",
"Array",
"Object",
"Blob",
"Clob",
"Timestamp",
"Date",
"Enum",
"Gzip",
),
),
2006-10-01 17:58:19 +04:00
*/
2006-07-24 01:08:06 +04:00
"Basic Components" =>
array(
2006-09-21 08:03:03 +04:00
"Manager"
2006-07-24 01:08:06 +04:00
=> array("Introduction",
"Opening a new connection",
"Managing connections"),
2006-07-24 01:08:06 +04:00
"Record"
=> array("Introduction",
"Creating new records",
"Retrieving existing records",
"Accessing properties",
"Updating records",
"Deleting records",
"Getting record state",
"Getting object copy",
"Serializing",
"Checking Existence",
2006-07-24 01:08:06 +04:00
"Callbacks"),
"Connection"
2006-07-24 01:08:06 +04:00
=> array("Introduction",
2006-09-21 08:03:03 +04:00
"Available drivers",
2006-07-24 01:08:06 +04:00
"Getting a table object",
"Flushing the connection",
2006-07-24 01:08:06 +04:00
"Querying the database",
"Getting connection state"),
2006-07-24 01:08:06 +04:00
"Collection"
=> array("Introduction",
"Accessing elements",
"Adding new elements",
"Getting collection count",
"Saving the collection",
"Deleting collection",
2006-08-17 13:42:18 +04:00
//"Fetching strategies",
2006-09-02 01:56:55 +04:00
"Key mapping",
"Loading related records",
2006-07-24 01:08:06 +04:00
"Collection expanding",
),
"Table" => array("Introduction",
"Getting table information",
"Finder methods",
"Custom table classes",
"Custom finders",
"Getting relation objects"),
"Query" => array("Introduction",
"FROM - selecting tables",
"LIMIT and OFFSET - limiting the query results",
"WHERE - setting query conditions",
"ORDER BY - sorting query results",
2006-08-17 13:42:18 +04:00
//"Fetching strategies",
//"Lazy property fetching",
2006-07-24 01:08:06 +04:00
"Method overloading",
"Relation operators",
"Bound parameters",
"Aggregate functions",
"DQL - SQL conversion"),
"RawSql" => array(
"Introduction",
"Using SQL",
"Adding components",
"Method overloading"),
"DB" => array(
"Introduction",
"Connecting to a database",
"Using event listeners",
"Chaining listeners"),
/**
2006-07-24 01:08:06 +04:00
"Statement - <font color='red'>UNDER CONSTRUCTION</font>" => array("Introduction",
"Setting parameters",
"Getting parameters",
"Getting row count",
"Executing the statement"),
*/
2006-07-24 01:08:06 +04:00
"Exceptions" => array(
"Overview",
"List of exceptions"
)
2006-08-22 22:23:32 +04:00
),
2006-07-24 01:08:06 +04:00
"Mapping object relations" =>
array(
"Introduction",
"Composites and aggregates",
"Relation aliases",
"Foreign key associations" => array(
"One-to-One",
"One-to-Many, Many-to-One",
"Tree structure"),
"Join table associations" => array(
"One-to-One",
"One-to-Many, Many-to-One",
"Many-to-Many",
"Self-referencing"),
"Dealing with relations" => array(
"Creating related records",
"Retrieving related records",
"Updating related records",
2006-08-21 14:16:36 +04:00
"Deleting related records",
"Working with associations"),
2006-07-24 01:08:06 +04:00
"Inheritance" =>
array("One table many classes",
"One table one class",
"Column aggregation"
),
),
"Configuration" =>
array(
"Introduction",
"Levels of configuration",
"Setting attributes" => array(
"Table creation",
"Fetching strategy",
"Batch size",
"Session lockmode",
"Event listener",
"Validation",
"Offset collection limit"
)
),
"Advanced components" => array(
"Eventlisteners" =>
array(
"Introduction",
"Creating new listener",
"List of events",
"Listening events",
"Chaining",
"AccessorInvoker",
"Creating a logger",
2006-07-24 01:08:06 +04:00
),
"Validators" => array(
"Intruduction",
"Validating transactions",
"Analyzing the ErrorStack",
"List of predefined validators"
),
"View" => array(
"Intoduction",
"Managing views",
"Using views"
),
"Cache" => array(
"Introduction",
"Query cache"),
"Locking Manager" => array(
"Introduction",
"Examples",
"Planned",
"Technical Details",
"Maintainer"),
2006-07-24 01:08:06 +04:00
/**
"Debugger" => array(
"Introduction",
"Debugging actions"),
"Library" => array(
"Introduction",
"Using library functions"),
"Iterator" => array(
"Introduction",
"BatchIterator",
"ExpandableIterator",
"OffsetIterator")
*/
),
2006-09-21 08:03:03 +04:00
"DQL (Doctrine Query Language)" =>
2006-09-29 15:17:16 +04:00
array('Introduction',
'Syntax' =>
2006-09-16 21:52:58 +04:00
array(
'FROM',
'WHERE',
'GROUP BY',
'HAVING',
'ORDER BY',
'LIMIT and OFFSET',
),
'Functions' => array(
'Contains',
'Regexp',
'Like'),
'Operators' => array(
'Logical operators')
2006-09-21 08:03:03 +04:00
2006-08-30 00:37:55 +04:00
),
2006-07-24 01:08:06 +04:00
"Transactions" => array(
"Introduction",
"Unit of work",
"Locking strategies" =>
array("Pessimistic locking",
"Optimistic locking"),
"Nesting"
),
/**
"Developer components" => array(
"DataDict" => array(
"Introduction",
"Usage"
),
"IndexGenerator" =>
array(
"Introduction",
"Usage"),
"Relation" => array(
"Introduction",
"Types of relations",
),
"Null" => array(
"Introduction",
"Extremely fast null value checking"
),
"Access" => array(
"Introduction",
"Usage"
),
"Configurable" => array(
"Introduction",
"Usage"
),
),
*/
"Technology" => array(
"Architecture",
"Design patterns used",
"Speed",
"Internal optimizations" =>
array("DELETE",
"INSERT",
"UPDATE"),
),
2006-10-01 17:58:19 +04:00
"Real world examples" => array("User management system","Forum application","Album lister"),
"Coding standards" => array(
"Overview" =>
array(
"Scope",
"Goals"
),
"PHP File Formatting" => array(
"General",
"Indentation",
"Maximum line length",
"Line termination"
),
"Naming Conventions" => array(
"Classes",
"Interfaces",
"Filenames",
"Functions and methods",
"Variables",
"Constants",
"Record columns",
),
"Coding Style" => array(
"PHP code demarcation",
"Strings",
"Arrays",
"Classes",
"Functions and methods",
"Control statements",
"Inline documentation"
),
)
2006-07-24 01:08:06 +04:00
);
2006-08-21 14:16:36 +04:00
2006-07-24 01:08:06 +04:00
?>
<table width="100%" cellspacing=0 cellpadding=0>
<tr>
<td width=50>
<td>
2006-09-19 19:26:41 +04:00
<td align="left" valign="top">
2006-07-24 01:08:06 +04:00
<table width="100%" cellspacing=1 cellpadding=1>
<tr>
<td colspan=2 bgcolor="white">
<img src="images/logo.jpg" align="left"><b class="title">Doctrine - PHP Data Persistence and ORM Tool</b>
<hr>
</td>
</tr>
<tr>
2006-09-19 19:26:41 +04:00
<td bgcolor="white" valign="top">
2006-07-24 01:08:06 +04:00
<?php
if( ! isset($_REQUEST["index"])) {
$i = 1;
$missing = array();
$missing[0] = 0;
$missing[1] = 0;
foreach($menu as $title => $titles) {
print $i.". <a href=\"".$_SERVER['PHP_SELF']."?index=$i#$i\">".$title."</a><br>\n";
$i2 = 1;
foreach($titles as $k => $t) {
$e = "$i.".$i2."";
if(is_array($t)) {
print "<dd>".$e." <a href=\"".$_SERVER['PHP_SELF']."?index=$i.$i2#$e\">".$k."</a><br>\n";
$i3 = 1;
foreach($t as $k2 => $v2) {
$str = "";
if( ! file_exists("docs/$title - $k - $v2.php")) {
$missing[0]++;
$str .= " [ <font color='red'>doc</font> ] ";
2006-10-01 17:58:19 +04:00
touch("docs/$title - $k - $v2.php");
2006-07-24 01:08:06 +04:00
}
if( ! file_exists("codes/$title - $k - $v2.php")) {
$missing[1]++;
$str .= " [ <font color='red'>code</font> ] ";
2006-10-01 17:58:19 +04:00
touch("codes/$title - $k - $v2.php");
2006-08-22 22:23:32 +04:00
2006-07-24 01:08:06 +04:00
}
$e = implode(".",array($i,$i2,$i3));
2006-08-21 14:16:36 +04:00
print "<dd><dd>".$e." <a href=\"".$_SERVER['PHP_SELF']."?index=$i.$i2#$e\">".$v2."</a>$str<br>\n";
2006-07-24 01:08:06 +04:00
$i3++;
}
} else {
$str = "";
if( ! file_exists("docs/$title - $t.php")) {
$missing[0]++;
$str .= " [ <font color='red'>doc</font> ] ";
2006-10-01 17:58:19 +04:00
touch("docs/$title - $t.php");
2006-07-24 01:08:06 +04:00
}
if( ! file_exists("codes/$title - $t.php")) {
$missing[1]++;
$str .= " [ <font color='red'>code</font> ] ";
2006-10-01 17:58:19 +04:00
touch("codes/$title - $t.php");
2006-07-24 01:08:06 +04:00
}
2006-08-21 14:16:36 +04:00
print "<dd>".$e." <a href=\"".$_SERVER['PHP_SELF']."?index=$i#$e\">".$t."</a>$str<br>\n";
2006-07-24 01:08:06 +04:00
}
$i2++;
}
$i++;
}
} else {
$i = 1;
$ex = explode(".",$_REQUEST["index"]);
$paths = array2path($menu);
if( ! isset($paths[$ex[0]]))
exit;
$break = false;
$tmp = $paths;
foreach($tmp as $path => $title) {
$e = explode(".", $path);
if(count($e) > 2) {
unset($tmp[$path]);
}
}
$prev = 1;
foreach($tmp as $path => $title) {
if($break)
break;
2006-09-21 08:03:03 +04:00
2006-07-24 01:08:06 +04:00
if($path == $_REQUEST["index"]) {
$break = true;
} else {
$prev = $path;
}
}
$index = $_REQUEST['index'];
print "<table width='100%'>";
print "<tr><td colspan=3 align='center'><b></td></tr>";
print "<tr><td colspan=3 align='center'><b class='title'>".$paths[$ex[0]]."</b></td></tr>";
print "<tr><td align='left'><b><a href=documentation.php?index=$prev>Prev</a></b></td>";
print "<td align='right'><b><a href=documentation.php?index=$path>Next</a></b></td></tr>";
print "<tr><td>&nbsp;</td></tr>";
print "</table>";
$tmp = $ex;
if(count($tmp) > 2) {
//array_pop($tmp);
}
foreach($tmp as $k => $v) {
$numbers[] = $v;
$curr = implode(".",$numbers);
$stack[] = $paths[$curr];
}
if(isset($ex[1])) {
$name = implode(" - ", $stack);
2006-09-02 01:56:55 +04:00
print "<a name='$path'><b class='title'>".$paths[$curr]."</b></a><hr>";
2006-07-24 01:08:06 +04:00
$n = $numbers;
$o = $paths[$n[0]];
2006-09-02 01:56:55 +04:00
$numpath = implode(".", array($n[0], $n[1]));
$o2 = $paths[$numpath];
2006-07-24 01:08:06 +04:00
$value = $menu[$o];
2006-09-02 01:56:55 +04:00
if( ! is_array($value))
2006-07-24 01:08:06 +04:00
exit;
2006-09-02 01:56:55 +04:00
2006-07-24 01:08:06 +04:00
if(in_array($o2, $value)) {
render_block($name);
2006-09-02 01:56:55 +04:00
} else {
2006-07-24 01:08:06 +04:00
$value = $menu[$o][$o2];
if(is_array($value)) {
foreach($value as $k => $title) {
2006-09-02 01:56:55 +04:00
$numpath2 = $numpath . '.' . ($k + 1);
print "<br \><a name='".$numpath2."'><b class='title'>".$title."</b></a><hr style='height: 1px' \>";
2006-07-24 01:08:06 +04:00
$s = $name." - ".$title;
render_block($s);
}
}
}
} else {
//if( ! isset($menu[$ex[0]]))
// exit;
$tmp = $paths[$ex[0]];
$i = 1;
foreach($menu[$tmp] as $title => $value) {
$n = $ex[0].".".$i;
if(is_scalar($value)) {
print "<dd>".$n.". <a href=\"documentation.php?index=".$n."\">".$value."</a><br \>\n";
} else {
print "<dd>".$n.". <a href=\"documentation.php?index=".$n."\">".$title."</a><br \>\n";
}
$i++;
}
}
}
?>
2006-09-19 19:26:41 +04:00
<td bgcolor="white" align="left" valign="top" width=300>
2006-07-24 01:08:06 +04:00
<?php
$i = 1;
print "<dd>-- <b><a href=documentation.php>index</a></b><br>\n";
foreach($menu as $title => $titles) {
print "<dd>".$i.". <a href=\"".$_SERVER['PHP_SELF']."?index=$i\">".$title."</a><br>\n";
$i++;
}
?>
</td>
<td>
<tr>
<td bgcolor="white" valign="top" colspan="2">
<?php
/**
foreach($menu as $title => $titles) {
if($i == $ex[0]) {
print $i.". <b><a class=\"big\" name=\"$i\">".$title."</a></b><hr><br>\n";
$i2 = 1;
foreach($titles as $k => $t) {
$e = "$i.".$i2;
if(is_array($t)) {
$tmp = "$title - $k";
if( ! isset($ex[1]) || $i2 != $ex[1]) {
$i2++;
continue;
}
print $e." <b><a class=\"big\" name=\"$e\">".$k."</a></b><hr><br><br>\n";
foreach($t as $k2 => $t2) {
if( ! isset($ex[1]) || $i2 != $ex[1])
break;
$e = "$i.".$i2.".".($k2+1);
render($tmp,$t2,$e);
}
} else {
if( ! isset($ex[1])) {
render($title,$t,$e);
}
}
$i2++;
}
}
$i++;
}
*/
?>
</td>
</tr>
</td>
<td>
</td>
</tr>
</table>