Commit f46a92b9 authored by jepso's avatar jepso

- Few changes to documentation layout

- Added Sensei_Exception
parent e5b137a0
......@@ -29,7 +29,8 @@ FROM User u LEFT JOIN u.Email e
+++ Sorting by an aggregate value
In the following example we fetch all users and sort those users by the number of phonenumbers they have.
In the following example we fetch all users and sort those users by the number of phonenumbers they have.
<code type='php'>
$q = new Doctrine_Query();
......@@ -41,7 +42,8 @@ $users = $q->select('u.*, COUNT(p.id) count')
+++ Using random order
In the following example we use random in the ORDER BY clause in order to fetch random post.
In the following example we use random in the ORDER BY clause in order to fetch random post.
<code type='php'>
$q = new Doctrine_Query();
......
......@@ -67,13 +67,16 @@ Doctrine::export('models');
This would execute the following queries on mysql.
<code>
CREATE TABLE user (id BIGINT AUTO_INCREMENT, name VARCHAR(20), PRIMARY KEY(id), INDEX(id));
CREATE TABLE phonenumber (id INT AUTO_INCREMENT, phonenumber VARCHAR(20), user_id BIGINT, PRIMARY KEY(id), INDEX(user_id));
ALTER TABLE phonenumber ADD CONSTRAINT FOREIGN KEY (user_id) REFERENCES user(id) ON DELETE CASCADE;
</code>
Pay attention to the following things:
1. The autoincrement primary key columns are auto-added since we didn't specify any primary key columns
2. Doctrine auto-adds indexes to the referenced relation columns (this is needed in mysql)
# The autoincrement primary key columns are auto-added since we didn't specify any primary key columns
# Doctrine auto-adds indexes to the referenced relation columns (this is needed in mysql)
+++ Getting export queries
......
......@@ -33,15 +33,18 @@ $users = $q->execute();
$user[0]; // User object
</code>
Pay attention to following things:
1. Fields must be in curly brackets
2. For every selected table there must be one addComponent call
Pay attention to following things:
# Fields must be in curly brackets
# For every selected table there must be one addComponent call
++ Fetching from multiple components
When fetching from multiple components the addComponent calls become a bit more complicated as not only do we have to tell which tables are bound to which components, we also have to tell the parser which components belongs to which.
Consider the following model:
Consider the following model:
<code type='php'>
// file User.php
class User extends Doctrine_Record
......@@ -73,7 +76,8 @@ class Phonenumber extends Doctrine_Record
}
</code>
In the following example we fetch all users and their phonenumbers:
In the following example we fetch all users and their phonenumbers:
<code type='php'>
$q = new Doctrine_RawSql();
......
......@@ -5,5 +5,4 @@
++ Constraints and validators
++ Record identifiers
++ Indexes
++ Relations
++ Hierarchical data
......@@ -20,7 +20,7 @@ foreach ($supportedLangs as $language) {
}
$baseUrl = '';
$title = 'Doctrine Documentation';
$title = 'Doctrine Manual';
$section = null;
if (isset($_GET['chapter'])) {
......
body, html {
margin: 0;
padding: 0;
font-family: "Arial", sans-serif;
font-size: 12pt;
font-family: "Trebuchet MS", sans-serif;
font-size: normal;
background: white;
color: black;
}
......@@ -40,17 +40,14 @@ h4 {
p, ul, ol, dl {
line-height: 1.5em;
text-align: justify;
text-align: justify;
font-size: normal;
}
ul {
list-style-type: square;
}
ul ul, ol ol {
font-size: 100%;
}
dd {
margin-bottom: 0.5em;
}
......@@ -59,7 +56,6 @@ table {
border: 1px solid #aaaaaa;
border-collapse: collapse;
margin: 0.5em 0;
font-size: 11pt;
background-color: #f9f9f9;
line-height: 1.5em;
}
......@@ -73,33 +69,22 @@ th {
background-color: #f2f2f2;
}
blockquote {
background-image: url("../images/quotation-mark.png");
background-position: top left;
background-repeat: no-repeat;
padding-left: 2.5em;
margin-left: 1em;
}
/*** Code blocks and highlighting**********************************************/
pre, tt {
font-family: "Bitstream Vera Sans Mono", monospace;
}
tt {
font-size: 11pt;
font-size: small;
}
pre {
font-size: 10pt;
font-weight: bold;
padding: 1em;
margin: 1em;
margin: 1em 0;
line-height: 1.2em;
background-color: #f6f6f6;
border: 1px solid #cccccc;
overflow: auto;
}
pre .default {
......@@ -145,20 +130,27 @@ a:visited:active {
}
#wrap {
width: 100%;
margin: 0;
padding: 0;
}
#sidebar {
float: right;
width: 20em;
width: 25%;
margin: 0;
padding: 1em;
}
#content {
margin-right: 20em;
margin-right: 25%;
padding: 1em;
padding-right: 2em;
}
/** Tree specific styles ******************************************************/
ul.tree {
font-size: 0.9em;
}
ul.tree, ul.tree ul {
......@@ -168,9 +160,6 @@ ul.tree, ul.tree ul {
margin-left: 0;
}
/** Tree specific styles ******************************************************/
.tree a {
text-decoration: none;
margin: 0;
......@@ -181,7 +170,6 @@ ul.tree, ul.tree ul {
color: black;
display: block;
float: left;
height: auto;
margin: 0;
margin-left: -1.25em;
padding: 0;
......
.tree .expander {
margin-left: -0.60em;
}
pre {
word-wrap: break-word;
}
\ No newline at end of file
body {
@page {
size: a4 portrait;
margin: 20mm;
padding: 5mm 0;
border-top: thin solid black;
border-bottom: thin solid black;
@top-left {
font-size: 10pt;
vertical-align: bottom;
margin: 2mm
}
@top-right {
font-size: 10pt;
vertical-align: bottom;
margin: 2mm
}
@bottom {
font-size: 10pt;
content: counter(page);
vertical-align: top;
text-align: outside;
margin: 2mm
}
}
@page :left {
@top-left {
content: "Doctrine Manual";
}
@top-right {
content: "";
}
}
@page :right {
@top-right {
content: "Doctrine Manual";
}
@top-left {
content: "";
}
}
* {
text-decoration: none;
}
html, body {
font-family: "Arial", sans-serif;
font-size: 11pt;
padding: 0;
margin: 0;
}
.chapter, #table-of-contents {
......@@ -9,18 +58,20 @@ body {
h1, h2, h3, h4, h5, h6 {
font-family: "Lucida Bright", serif;
page-break-after: avoid;
}
h1 {
text-align: center;
}
p, ul, ol {
p, ul, ol, dl {
text-align: justify;
line-height: 1.2em;
hyphens: auto;
}
ol {
ul {
list-style-type: square;
}
......@@ -59,5 +110,21 @@ a {
#table-of-contents ul {
list-style-type: none;
font-weight: bold;
}
#table-of-contents ul, #table-of-contents li {
margin-left: 0;
}
#table-of-contents ul ul {
margin-left: 1em;
font-weight: normal;
}
/* add page numbers to TOC */
#table-of-contents ul a::after {
content: leader('.') target-counter(attr(href), page);
}
......@@ -36,9 +36,9 @@ try {
} catch (Exception $e) {
?>
<h1>Doctrine Documentation</h1>
<h1>Doctrine Manual</h1>
<p>You can view this documentation as
<p>You can view this manual online as
<ul>
<li><a href="<?php echo $tool->getOption('clean-url') ? "${baseUrl}one-page" : '?one-page=1'; ?>">everything on a single page</a>, or</li>
<li><a href="<?php echo $tool->makeUrl($tool->findByIndex('1.')->getPath()); ?>">one chapter per page</a>.</li>
......
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://sourceforge.net/projects/sensei>.
*/
/**
* Sensei_Exception
*
* @package Sensei
* @category Sensei Core
* @license http://www.gnu.org/licenses/lgpl.txt LGPL
* @link http://sourceforge.net/projects/sensei
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @version $Revision$
* @since 1.0
*/
class Sensei_Exception extends Exception
{ }
......@@ -51,7 +51,7 @@ class Text_Wiki_Parse_Code extends Text_Wiki_Parse {
/* var $regex = '/^(\<code( .+)?\>)\n(.+)\n(\<\/code\>)(\s|$)/Umsi';*/
/* var $regex = ';^<code(\s[^>]*)?>((?:(?R)|.)*?)\n</code>(\s|$);msi';*/
var $regex = ';^<code(\s[^>]*)?>(.+?)\n</code>(\s|$);msi';
var $regex = ';^<code(\s[^>]*)?>\n(.+?)\n</code>(\s|$);msi';
/**
*
......
......@@ -63,7 +63,7 @@ class Text_Wiki_Render_Xhtml_Code extends Text_Wiki_Render {
if (substr($options['text'], 0, 5) != '<?php') {
// PHP code example:
// add the PHP tags
$text = "<?php \n"
$text = "<?php \n\n"
. $options['text'] . "\n\n"
. "?>";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment