Skip to content

Commit 7782d94

Browse files
committed
Fixed H2s on doc page
1 parent 1c192bb commit 7782d94

File tree

5 files changed

+111
-4
lines changed

5 files changed

+111
-4
lines changed

documentation/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
layout: default
33
title: Documentation
44
---
5-
### Tutorials
5+
## Tutorials
66

77
- [The Book](http://phpcr.readthedocs.org/en/latest/)
88
- [Integrating with Symfony](/documentation/tutorial/integrating_with_symfony.html)
99

10-
### Reference
10+
## Reference
1111

1212
- [API Reference](/doc/html/index.html)
1313

14-
### Slides
14+
## Slides
1515

1616
- [PHPCR Introduction by David Buchmann and Lukas Smith](/slides.html)
1717
- [PHPCR, Une Introduction by Daniel Leech (in French)](http://phpcrtalk.dantleech.com)
1818

19-
### Other
19+
## Other
2020

2121
- [PHPCR Shell](/documentation/phpcr-shell)

documentation/reference/jcr-sql2.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
layout: default
3+
title: JCR-SQL2 Reference
4+
---
5+
JCR-SQL2 is a query language similar to SQL which is used by JCR and thus also PHPCR.
6+
7+
Some things to note:
8+
9+
- Unlike most other SQL dialects, JCR-SQL2 only supports SELECT statements.
10+
- JCR-SQL2 selects from *node types* not *tables*.
11+
- `LIMIT BY` and `OFFSET` are not supported.
12+
- Namespaced node types should always be surrounded by square brackets (`[` and `]`).
13+
14+
In the following examples I will use the PHPCR shell to execute the queries.
15+
16+
## Basics
17+
18+
The basic query grammer is defined as:
19+
20+
Query ::= 'SELECT' columns
21+
22+
'FROM' Source
23+
24+
['WHERE' Constraint]
25+
26+
['ORDER BY' orderings]
27+
28+
This should be familiar to anybody with a background in SQL.
29+
30+
So `WHERE` and `ORDER BY` are optional, and `SELECT` and `FROM` are mandatory.
31+
32+
- `columns` can either be a wildcard (e.g. `*` or `selector.*`) or a list of column names
33+
or both.
34+
- `source` can be a simple node type name, or a join source.
35+
- `where` is a list of criteria for selecting the records
36+
- `order by` determines which fields will be used to order the result set and in which direction.
37+
38+
The following are valid statements
39+
40+
{% highlight sql %}
41+
SELECT title FROM [myCms:article];
42+
SELECT * FROM [myCms:article] ORDER BY title
43+
SELECT a.* FROM [myCms:article] AS a;
44+
{% endhighlight %}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
Bootstrapping
2+
=============
3+
4+
You will need to make sure your php classes are available. Usually this means activating an autoloader. For a standalone project, just use the file generated by composer at vendor/.composer/autoload.php
5+
PHPCR and Jackalope follow the PSR-0 standard. If you want your own autoloading, use a PSR-0 compatible autoloader and configure it to find the code folder.
6+
7+
Once you have autoloading set up, bootstrap jackalope-jackrabbit like this:
8+
9+
.. code-block:: php
10+
11+
<?php
12+
require("vendor/autoload.php");
13+
14+
// factory (the *only* implementation specific part)
15+
$factoryclass = '\Jackalope\RepositoryFactoryJackrabbit';
16+
// the parameters would typically live in a configuration file
17+
// see your implementation for required and optional parameters
18+
$parameters = array('jackalope.jackrabbit_uri' => 'http://localhost:8080/server');
19+
20+
// end of implementation specific configuration
21+
// from here on, the whole code does not need to be changed when using different implementations
22+
23+
$factory = new $factoryclass();
24+
$repository = $factory->getRepository($parameters);
25+
if (null === $repository) {
26+
var_dump($parameters);
27+
die('There where missing parameters, the factory could not create a repository');
28+
}
29+
30+
// the login parameters would typically live in a configuration file
31+
32+
$workspacename = 'default';
33+
$user = 'admin';
34+
$pass = 'admin';
35+
36+
// create credentials and log in to get a session
37+
$credentials = new \PHPCR\SimpleCredentials($user, $pass);
38+
try {
39+
$session = $repository->login($credentials, $workspacename);
40+
} catch(\PHPCR\LoginException $e) {
41+
die('Invalid credentials: '.$e->getMessage());
42+
} catch(\PHPCR\NoSuchWorkspaceException $e) {
43+
die("No workspace $workspacename: ".$e->getMessage());
44+
}
45+
46+
// if we get here, we have a session object that can be used to read and write the repository

documentation/tutorial/importing_data.rst

Whitespace-only changes.

documentation/tutorial/index.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
The Book
3+
========
4+
5+
.. toctree::
6+
:hidden:
7+
8+
database_layer
9+
installation
10+
routing
11+
simplecms
12+
static_content
13+
structuring_content
14+
handling_multilang
15+
16+
.. include:: map.rst.inc
17+

0 commit comments

Comments
 (0)