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.*
- dev-master
- 0.15.8
- 0.15.7
- 0.15.6
- 0.15.5
- 0.15.4
- 0.15.3
- 0.15.2
- 0.15.1
- 0.15.0
- 0.14.2
- 0.14.1
- 0.14.0
- 0.13.0
- 0.12.18
- 0.12.17
- 0.12.16
- 0.12.15
- 0.12.14
- 0.12.13
- 0.12.12
- 0.12.11
- 0.12.10
- 0.12.9
- 0.12.8
- 0.12.7
- 0.12.6
- 0.12.5
- 0.12.4
- 0.12.3
- 0.12.2
- 0.12.1
- 0.12.0
- 0.11.4
- 0.11.3
- 0.11.2
- 0.11.1
- 0.11.0
- 0.10.0
- 0.9.0
- 0.8.1
- 0.8.0
- 0.7.1
- 0.7.0
- 0.6.1
- 0.6.0
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.0
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.0
- 0.0.2
- 0.0.1
This package is not auto-updated.
Last update: 2024-12-21 19:37:03 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();