Package Data | |
---|---|
Maintainer Username: | gmoigneu |
Maintainer Contact: | guillaume@moigneu.net (Guillaume Moigneu) |
Package Create Date: | 2015-11-08 |
Package Last Update: | 2015-11-08 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-30 03:03:31 |
Package Statistics | |
---|---|
Total Downloads: | 0 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Laravel 5.x package providing Jackrabbit backend capabilities with Doctrine-PHPCR-ODM mappings.
Jackalope is currently not working with Jackrabbit Oak and thus not in Apache Sling 8
Download Sling Launchpad 7 on Maven repository.
More info on :
composer require gmoigneu/laravel-jackrabbit
Publish the config file & edit it with your Jackrabbit details:
php artisan vendor:publish
// Init session
$session = \App::make('phpcr.session');
// Save a new testNode
$rootNode = $session->getNode("/");
$testNode = $rootNode->addNode("testNode");
$session->save();
// Get the newly created node
$testNode = $session->getNode("/testNode");
dd($testNode);
Create a new model :
<?php namespace App\Models;
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCR;
/**
* @PHPCR\Document(referenceable=true)
*/
class Post
{
/**
* @PHPCR\Uuid()
*/
protected $uuid;
/**
* @PHPCR\Id()
*/
protected $slug;
/**
* @PHPCR\ParentDocument()
*/
protected $parent;
/**
* @PHPCR\NodeName
*/
protected $title;
public function setParent($parent)
{
$this->parent = $parent;
return $this;
}
public function setTitle($title)
{
$this->title = $title;
return $this;
}
public function getTitle()
{
return $this->title;
}
}
Register your new type with :
$ php artisan doctrine:phpcr:register-system-node-types
Successfully registered system node types.
Use your model wherever you want :
// Get the document manager
$dm = \App::make('phpcr.manager');
// Get the root node
$root = $dm->find(null, '/');
// Create a post
$post = new Post();
$post->setParent($root);
$post->setTitle('Example Post');
$dm->persist($post);
$dm->flush();
$post = $dm->find(null, 'Example Post');
dd($post);
Based on the work of Workers