This commit is contained in:
parent
cea5cf384b
commit
8dbfcf468a
267
manual/documentation2.php
Normal file
267
manual/documentation2.php
Normal file
@ -0,0 +1,267 @@
|
||||
<?php
|
||||
include("top.php");
|
||||
require_once("highlight.php");
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
$f = file_get_contents('menu.php');
|
||||
$a = explode(PHP_EOL, $f);
|
||||
$res = array();
|
||||
$curr = false;
|
||||
|
||||
|
||||
class DocTool
|
||||
{
|
||||
private $index;
|
||||
|
||||
protected $highlighter;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->highlighter = new PHP_Highlight;
|
||||
}
|
||||
public function parseIndex2($index)
|
||||
{
|
||||
$ret = array();
|
||||
$path = array();
|
||||
$counters = array();
|
||||
|
||||
foreach ($index as $k => $v) {
|
||||
if (empty($v)) {
|
||||
continue;
|
||||
}
|
||||
$v = rtrim($v);
|
||||
$i = count($path) - 1;
|
||||
|
||||
$i = ($i > 0) ? $i : 0;
|
||||
|
||||
$indent = substr_count($v, ' ');
|
||||
|
||||
if ( ! isset($counters[$indent])) {
|
||||
$counters[$indent] = 0;
|
||||
}
|
||||
|
||||
if ($indent > $i) {
|
||||
$counters[$indent]++;
|
||||
|
||||
$path[] = trim($v);
|
||||
} else {
|
||||
$steps = abs($i - $indent);
|
||||
|
||||
$key = ($i - $steps);
|
||||
while ($steps--) {
|
||||
array_pop($path);
|
||||
array_pop($counters);
|
||||
}
|
||||
|
||||
$counters[$key]++;
|
||||
|
||||
$path[$key] = trim($v);
|
||||
}
|
||||
|
||||
$chapterName = implode(' - ', $path);
|
||||
|
||||
$ret[] = array('index' => implode('.', $counters),
|
||||
'name' => $chapterName);
|
||||
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
/**
|
||||
if ($indent == $i) {
|
||||
$path[$i] = $v;
|
||||
} else {
|
||||
*/
|
||||
public function parseIndex($index, $path = array(), $counters = array())
|
||||
{
|
||||
$ret = array();
|
||||
|
||||
foreach ($index as $k => $v) {
|
||||
$i = count($path) - 1;
|
||||
|
||||
$counters[$i]++;
|
||||
|
||||
if (is_array($v)) {
|
||||
if ( ! is_numeric($k)) {
|
||||
$tmp = $path;
|
||||
$tmp[] = $k;
|
||||
|
||||
$chapterName = ( ! empty($path)) ? implode(' - ', $path) . ' - ' . $k : $k;
|
||||
|
||||
$ret[] = array('index' => implode('.', $counters),
|
||||
'name' => $chapterName);
|
||||
}
|
||||
|
||||
$ret = array_merge($ret, $this->parseIndex($v, $tmp, $counters));
|
||||
} else {
|
||||
$chapterName = ( ! empty($path)) ? implode(' - ', $path) . ' - ' . $v : $v;
|
||||
|
||||
$ret[] = array('index' => implode('.', $counters),
|
||||
'name' => $chapterName);
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
public function renderBlock($name) {
|
||||
|
||||
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");
|
||||
$c = trim($c);
|
||||
$this->renderCode($c);
|
||||
}
|
||||
}
|
||||
public function renderCode($code = null) {
|
||||
if( ! empty($code)) {
|
||||
|
||||
$this->highlighter->loadString($code);
|
||||
|
||||
print "<table width=500 border=1 class='dashed' cellpadding=0 cellspacing=0>";
|
||||
print "<tr><td><b>";
|
||||
|
||||
$this->highlighter->toHtml();
|
||||
print "</b></td></tr>";
|
||||
print "</table>";
|
||||
}
|
||||
}
|
||||
}
|
||||
print "<pre>";
|
||||
$doc = new DocTool();
|
||||
|
||||
function renderCode($code = null)
|
||||
{
|
||||
global $doc;
|
||||
|
||||
return $doc->renderCode($code);
|
||||
}
|
||||
$i = $doc->parseIndex2($a);
|
||||
|
||||
//print_r($i);
|
||||
|
||||
?>
|
||||
<table width="100%" cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td width=50>
|
||||
<td>
|
||||
<td align="left" valign="top">
|
||||
<table width="100%" cellspacing=0 cellpadding=0>
|
||||
<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>
|
||||
<td bgcolor="white" valign="top">
|
||||
<div class='index'>
|
||||
<?php
|
||||
if ( ! isset($_GET['chapter'])) {
|
||||
|
||||
foreach ($i as $k => $v) {
|
||||
$indexes = explode('.', $v['index']);
|
||||
$level = count($indexes);
|
||||
$e = explode(' - ', $v['name']);
|
||||
|
||||
print '<div class=level' . $level . '><font class=level' . $level . '> '. $v['index'] . '. <a href=documentation2.php?chapter='
|
||||
. urlencode($v['name']) . ">" . end($e) ."</a></font></div>";
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
$e = explode(' - ', $_GET['chapter']);
|
||||
$subchapters = false;
|
||||
$found = false;
|
||||
|
||||
foreach ($i as $k => $v) {
|
||||
if ($found) {
|
||||
if (strncmp($v['name'], $_GET['chapter'], strlen($_GET['chapter'])) === 0) {
|
||||
$subchapters = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
$parts = explode(' - ', $v['name']);
|
||||
$indexes = explode('.', $v['index']);
|
||||
|
||||
if ($v['name'] === $_GET['chapter']) {
|
||||
$prev = $i[($k - 1)];
|
||||
$next = $i[($k + 1)];
|
||||
$foundKey = ($k + 1);
|
||||
$found = $v;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
<table width='100%'>
|
||||
<tr><td colspan=3 align='center'><b></td></tr>
|
||||
<tr><td colspan=3 align='center'><b class='title'>
|
||||
<?php
|
||||
print 'Chapter ' . $indexes[0] . '. ' . array_shift($parts);
|
||||
?>
|
||||
</b></td></tr>
|
||||
<tr><td align='left'><b><a href=documentation2.php?chapter=<?php print urlencode($prev['name']); ?>>Prev</a></b></td>
|
||||
<td align='right'><b><a href=documentation2.php?chapter=<?php print urlencode($next['name']); ?>>Next</a></b></td></tr>
|
||||
<tr><td> </td></tr>
|
||||
</table>
|
||||
|
||||
|
||||
<b class='title'>
|
||||
<?php
|
||||
|
||||
print $indexes[0] . '.' . $indexes[1] . '. ' . $parts[0];
|
||||
?>
|
||||
</b>
|
||||
<hr>
|
||||
<?php
|
||||
if ($subchapters) {
|
||||
?>
|
||||
<b class='title'>
|
||||
Table of contents<br \>
|
||||
</b>
|
||||
<?php
|
||||
for ($x = $foundKey; $x < count($i); $x++) {
|
||||
$p = explode(' - ', $i[$x]['name']);
|
||||
$count = (count($parts) + 1);
|
||||
while($count--) {
|
||||
array_shift($p);
|
||||
}
|
||||
?>
|
||||
<a href=documentation2.php?chapter=<?php print urlencode($i[$x]['name']) . '>' . implode(' - ', $p); ?></a><br \>
|
||||
<?php
|
||||
|
||||
if (strncmp($i[$x]['name'], $_GET['chapter'], strlen($_GET['chapter'])) !== 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<b class='title'>
|
||||
<?php
|
||||
if (isset($parts[1])) {
|
||||
print $indexes[0] . '.' . $indexes[1] . '.' . $indexes[2] . '. ' . $parts[1];
|
||||
}
|
||||
?>
|
||||
</b>
|
||||
<hr class='small'>
|
||||
|
||||
<?php
|
||||
}
|
||||
$doc->renderBlock($found['name']);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
327
manual/menu.php
Normal file
327
manual/menu.php
Normal file
@ -0,0 +1,327 @@
|
||||
Getting started
|
||||
Requirements
|
||||
Installation
|
||||
Compiling
|
||||
Starting new project
|
||||
Working with existing databases
|
||||
Introduction
|
||||
Making the first import
|
||||
Import options
|
||||
Connection management
|
||||
Opening a new connection
|
||||
Lazy-connecting to database
|
||||
Managing connections
|
||||
Connection-component binding
|
||||
Object relational mapping
|
||||
Introduction
|
||||
Table and class naming
|
||||
Columns
|
||||
Column naming
|
||||
Column aliases
|
||||
Default values
|
||||
Data types
|
||||
Introduction
|
||||
Type modifiers
|
||||
Boolean
|
||||
Integer
|
||||
Float
|
||||
String
|
||||
Array
|
||||
Object
|
||||
Blob
|
||||
Clob
|
||||
Timestamp
|
||||
Time
|
||||
Date
|
||||
Enum
|
||||
Gzip
|
||||
About type conversion
|
||||
Constraints and validators
|
||||
Notnull
|
||||
Max - Min
|
||||
Record identifiers
|
||||
Introduction
|
||||
Autoincremented
|
||||
Natural
|
||||
Composite
|
||||
Sequence
|
||||
Indexes
|
||||
Introduction
|
||||
Adding indexes
|
||||
Index options
|
||||
Special indexes
|
||||
Relations
|
||||
Introduction
|
||||
Relation aliases
|
||||
Foreign key associations
|
||||
One-to-One
|
||||
One-to-Many, Many-to-One
|
||||
Tree structure
|
||||
Join table associations
|
||||
One-to-One
|
||||
One-to-Many, Many-to-One
|
||||
Many-to-Many
|
||||
Self-referencing
|
||||
Inheritance
|
||||
One table many classes
|
||||
One table one class
|
||||
Column aggregation
|
||||
Hierarchical data
|
||||
Introduction
|
||||
About
|
||||
Setting up
|
||||
Node interface
|
||||
Tree interface
|
||||
Traversing or Walking Trees
|
||||
Read me
|
||||
Adjacency list
|
||||
Introduction
|
||||
Nested set
|
||||
Introduction
|
||||
Setting up
|
||||
Tree options
|
||||
Node support
|
||||
Tree support
|
||||
Read me
|
||||
Materialized path
|
||||
Introduction
|
||||
Examples
|
||||
Working with objects
|
||||
Dealing with relations
|
||||
Creating related records
|
||||
Retrieving related records
|
||||
Updating related records
|
||||
Deleting related records
|
||||
Working with associations
|
||||
Component overview
|
||||
Manager
|
||||
Introduction
|
||||
Opening a new connection
|
||||
Managing connections
|
||||
Connection
|
||||
Introduction
|
||||
Available drivers
|
||||
Getting a table object
|
||||
Flushing the connection
|
||||
Querying the database
|
||||
Getting connection state
|
||||
Record
|
||||
Introduction
|
||||
Creating new records
|
||||
Retrieving existing records
|
||||
Accessing properties
|
||||
Updating records
|
||||
Deleting records
|
||||
Getting record state
|
||||
Getting object copy
|
||||
Serializing
|
||||
Checking Existence
|
||||
Callbacks
|
||||
Collection
|
||||
Introduction
|
||||
Accessing elements
|
||||
Adding new elements
|
||||
Getting collection count
|
||||
Saving the collection
|
||||
Deleting collection
|
||||
Key mapping
|
||||
Loading related records
|
||||
Collection expanding
|
||||
Table
|
||||
Introduction
|
||||
Getting table information
|
||||
Finder methods
|
||||
Custom table classes
|
||||
Custom finders
|
||||
Getting relation objects
|
||||
Fetching objects
|
||||
Configuration
|
||||
Introduction
|
||||
Levels of configuration
|
||||
Setting attributes
|
||||
Portability
|
||||
Identifier quoting
|
||||
Table creation
|
||||
Fetching strategy
|
||||
Batch size
|
||||
Session lockmode
|
||||
Event listener
|
||||
Validation
|
||||
Offset collection limit
|
||||
Advanced components
|
||||
Eventlisteners
|
||||
Introduction
|
||||
Creating new listener
|
||||
List of events
|
||||
Listening events
|
||||
Chaining
|
||||
AccessorInvoker
|
||||
Creating a logger
|
||||
Validators
|
||||
Introduction
|
||||
More Validation
|
||||
Valid or Not Valid
|
||||
List of predefined validators
|
||||
View
|
||||
Intoduction
|
||||
Managing views
|
||||
Using views
|
||||
Cache
|
||||
Introduction
|
||||
Query cache
|
||||
Locking Manager
|
||||
Introduction
|
||||
Examples
|
||||
Planned
|
||||
Technical Details
|
||||
Maintainer
|
||||
Db_Profiler
|
||||
Introduction
|
||||
Basic usage
|
||||
Advanced usage
|
||||
Hook
|
||||
Introduction
|
||||
Building queries
|
||||
List of parsers
|
||||
Query
|
||||
Introduction
|
||||
selecting tables
|
||||
limiting the query results
|
||||
setting query conditions
|
||||
HAVING conditions
|
||||
sorting query results
|
||||
RawSql
|
||||
Introduction
|
||||
Using SQL
|
||||
Adding components
|
||||
Method overloading
|
||||
Db
|
||||
Introduction
|
||||
Connecting to a database
|
||||
Using event listeners
|
||||
Chaining listeners
|
||||
Exceptions
|
||||
Overview
|
||||
List of exceptions
|
||||
DQL (Doctrine Query Language)
|
||||
Introduction
|
||||
SELECT queries
|
||||
DISTINCT keyword
|
||||
Aggregate values
|
||||
UPDATE queries
|
||||
DELETE queries
|
||||
FROM clause
|
||||
WHERE clause
|
||||
Conditional expressions
|
||||
Literals
|
||||
Input parameters
|
||||
Operators and operator precedence
|
||||
Between expressions
|
||||
In expressions
|
||||
Like Expressions
|
||||
Null Comparison Expressions
|
||||
Empty Collection Comparison Expressions
|
||||
Collection Member Expressions
|
||||
Exists Expressions
|
||||
All and Any Expressions
|
||||
Subqueries
|
||||
Functional Expressions
|
||||
String functions
|
||||
Arithmetic functions
|
||||
Datetime functions
|
||||
Collection functions
|
||||
GROUP BY, HAVING clauses
|
||||
ORDER BY clause
|
||||
Introduction
|
||||
Sorting by an aggregate value
|
||||
Using random order
|
||||
LIMIT and OFFSET clauses
|
||||
Introduction
|
||||
Driver portability
|
||||
The limit-subquery-algorithm
|
||||
Examples
|
||||
BNF
|
||||
Native SQL
|
||||
Scalar queries
|
||||
Component queries
|
||||
Fetching multiple components
|
||||
Transactions
|
||||
Introduction
|
||||
Unit of work
|
||||
Nesting
|
||||
Savepoints
|
||||
Locking strategies
|
||||
Pessimistic locking
|
||||
Optimistic locking
|
||||
Lock modes
|
||||
Isolation levels
|
||||
Deadlocks
|
||||
Caching
|
||||
Introduction
|
||||
Availible options
|
||||
Drivers
|
||||
Memcache
|
||||
APC
|
||||
Sqlite
|
||||
Database abstraction
|
||||
Modules
|
||||
Export
|
||||
Introduction
|
||||
Creating new table
|
||||
Altering table
|
||||
Import
|
||||
Introduction
|
||||
Getting table info
|
||||
Getting foreign key info
|
||||
Getting view info
|
||||
Util
|
||||
Using explain
|
||||
DataDict
|
||||
Getting portable type
|
||||
Getting database declaration
|
||||
Reserved keywords
|
||||
Drivers
|
||||
Oracle
|
||||
Making unsuported functions work
|
||||
Mysql
|
||||
Tips and tricks
|
||||
Technology
|
||||
Architecture
|
||||
Design patterns used
|
||||
Speed
|
||||
Internal optimizations
|
||||
DELETE
|
||||
INSERT
|
||||
UPDATE
|
||||
Real world examples
|
||||
User management system
|
||||
Forum application
|
||||
Album lister
|
||||
Coding standards
|
||||
Overview
|
||||
Scope
|
||||
Goals
|
||||
PHP File Formatting
|
||||
General
|
||||
Indentation
|
||||
Maximum line length
|
||||
Line termination
|
||||
Naming Conventions
|
||||
Classes
|
||||
Interfaces
|
||||
Filenames
|
||||
Functions and methods
|
||||
Variables
|
||||
Constants
|
||||
Record columns
|
||||
Coding Style
|
||||
PHP code demarcation
|
||||
Strings
|
||||
Arrays
|
||||
Classes
|
||||
Functions and methods
|
||||
Control statements
|
||||
Inline documentation
|
||||
Testing
|
||||
Writing tests
|
||||
|
@ -30,7 +30,7 @@ ul {
|
||||
line-height: 1.5em;
|
||||
}
|
||||
td {
|
||||
font-size: 13 px;
|
||||
font-size: 14 px;
|
||||
font-family: Verdana, Arial, Helvetica;
|
||||
}
|
||||
|
||||
@ -49,6 +49,32 @@ cellpadding: 0;
|
||||
cellspacing: 0;
|
||||
border-height: 1 px;
|
||||
}
|
||||
div {
|
||||
line-height: 1.5em;
|
||||
}
|
||||
div.level1 {
|
||||
font-size: 15px;
|
||||
background: #E0E0E0;
|
||||
}
|
||||
div.level2 {
|
||||
line-height: 1.8 em;
|
||||
background: #E9E9E9;
|
||||
}
|
||||
div.level3 {
|
||||
background: #EFEFEF;
|
||||
}
|
||||
div.level4 {
|
||||
background: #F5F5F5;
|
||||
}
|
||||
div.level5 {
|
||||
|
||||
}
|
||||
div.index {
|
||||
border-style: solid;
|
||||
border-color: #A0A0A0;
|
||||
border-shadow: none;
|
||||
border-width: thin;
|
||||
}
|
||||
b.title {
|
||||
color: #A50A3D;
|
||||
}
|
||||
@ -64,3 +90,21 @@ color: #367FAC;
|
||||
a {
|
||||
color: #367FAC;
|
||||
}
|
||||
font.level1 {
|
||||
font-size: 17 px;
|
||||
line-height: 2.0 em;
|
||||
font-weight: bold;
|
||||
margin-left: 0px;
|
||||
}
|
||||
font.level2 {
|
||||
font-size: 15 px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
font.level3 {
|
||||
font-size: 13 px;
|
||||
margin-left: 60px;
|
||||
}
|
||||
font.level4 {
|
||||
font-size: 11 px;
|
||||
margin-left: 90px;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user