bleicker / nodes
There is no license information available for the latest version (0.15.8) of this package.
0.15.8
2015-05-24 18:33 UTC
Requires
- bleicker/context: 0.0.*
- bleicker/exception: 1.0.*
- bleicker/objectmanager: 1.1.*
- bleicker/persistence: 1.1.*
- bleicker/registry: 1.2.*
- bleicker/translation: 0.2.*
Requires (Dev)
- phpunit/phpunit: 4.6.*
This package is not auto-updated.
Last update: 2026-06-07 02:48:19 UTC
README
Usage
Introduce your Node implementation
MyNode.yml:
MyNode:
type: entity
MyNode.php:
class myNode extends AbstractContentNode {
}
Bootstap an usage of Service
ExampleApp.php
use Bleicker\ObjectManager\ObjectManager;
use Bleicker\Persistence\EntityManager;
use Bleicker\Persistence\EntityManagerInterface;
use Bleicker\Registry\Registry;
use Doctrine\ORM\Tools\Setup;
// Register schemas of this node package
Registry::set('doctrine.schema.paths.nodes', __DIR__ . "/vendor/bleicker/nodes/src/Schema/Persistence");
// Register schemas of you app
Registry::set('doctrine.schema.paths.nodes-functional', __DIR__ . "/Schema/Persistence");
// Register DB Connection
Registry::set('DbConnection', ['url' => 'mysql://john:doe@localhost/yourdb']);
// Register the PersistenceManagerInterface
ObjectManager::register(EntityManagerInterface::class, function () {
return EntityManager::create(
Registry::get('DbConnection'),
Setup::createYAMLMetadataConfiguration(Registry::get('doctrine.schema.paths'))
);
});
/** @var EntityManagerInterface $entityManager */
$entityManager = ObjectManager::get(EntityManagerInterface::class);
$node = new Page();
$node1 = new Content();
$node2 = new Content();
$node3 = new Content();
$node->addChild($node1)->addChild($node2)->addChildAfter($node3, $node1);
$entityManager->persist($node);
$entityManager->flush();