dantleech / pcr-generator

此包的最新版本(0.1)没有可用的许可证信息。

PHPCR 固件生成器

0.1 2014-10-16 14:33 UTC

This package is auto-updated.

Last update: 2024-08-29 03:47:35 UTC


README

一个小型库,用于生成节点数据以进行基准测试、测试等。

示例

基本

    $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();

将产生

node/
    article1/ 
        - title: My First Article
        - body: My First Article body
    article2/
        - title: My First Article
        - body: My First Article body

范围

您也可以在节点名称中指定范围

        $builder->node('content-[1-5]', 'nt:unstructured')
            ->node('article[1-10]')
                ->property('title', 'My first article')
                ->property('body', 'My first article body')
            ->end()
        ->end();

将产生创建50个节点。