https://github.com/dantleech/phpcr-generator
Fixture generator for PHPCR
https://github.com/dantleech/phpcr-generator
Last synced: over 1 year ago
JSON representation
Fixture generator for PHPCR
- Host: GitHub
- URL: https://github.com/dantleech/phpcr-generator
- Owner: dantleech
- Created: 2014-10-16T14:30:19.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-10-18T15:38:23.000Z (over 11 years ago)
- Last Synced: 2025-01-30T15:44:22.188Z (over 1 year ago)
- Language: PHP
- Size: 113 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
PHPCR Node Generator
====================
[](https://travis-ci.org/dantleech/phpcr-generator)
Small library for generating node data for benchmarking, testing, etc.
Example
-------
### Basic
````php
$converter = new NodeConverter($phpcrSession);
$builder = new NodeBuilder('node', 'nt:unstructured');
$builder->node('content', 'nt:unstructured')
->node('article1')
->property('title', 'My first article')
->property('body', 'My first article body')
->end()
->node('article2')
->property('title', 'My first article')
->property('body', 'My first article body')
->end()
->end();
$this->converter->convert($this->builder);
$phpcrSession->save();
````
Will result in:
````
node/
article1/
- title: My First Article
- body: My First Article body
article2/
- title: My First Article
- body: My First Article body
````
### Ranges
You can also specify ranges in the node name:
````php
$builder->node('content-[1-5]', 'nt:unstructured')
->node('article[1-10]')
->property('title', 'My first article')
->property('body', 'My first article body')
->end()
->end();
````
Will result in 50 nodes being created.