Code Monkey home page Code Monkey logo

neo4jfixturesbundle's Introduction

PandawanTechnology Neo4j Fixtures Bundle

Symfony bundle to allow fixtures loading into your Neo4j graph database

Installation

Add the bundle as a requirement:

composer require pandawan-technology/neo4j-fixtures-bundle

Enable it in your app/AppKernel.php file:

<?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ... my bundles
            new PandawanTechnology\Neo4jFixturesBundle\PandawanTechnologyNeo4jFixturesBundle(),
        ];
        
        return $bundles;
    }
}

Usage

Basic

By default, the bundle will search for the DataFixtures/Neo4j directories within your registered bundles. These files must implements the PandawanTechnology\Neo4jDataFixtures\Neo4jFixtureInterface but extending PandawanTechnology\Neo4jDataFixtures\AbstractNeo4jFixture class is recommended:

<?php
// src/AppBundle/DataFixtures/Neo4j/LoadUserData.php
namespace AppBundle\DataFixtures\Neo4j;

use GraphAware\Common\Connection\ConnectionInterface;
use PandawanTechnology\Neo4jDataFixtures\AbstractNeo4jFixture;

class LoadUserData extends AbstractNeo4jFixture
{
    /**
     * @inheritDoc
     */
    public function load(ConnectionInterface $connection)
    {
        // ... statements here
    }
}

See Pandawan Technology Neo4j Data Fixtures' library documentation for more informations.

Advanced

If you need to use third party services from your container, you can implements the ContainerAwareInterface:

<?php
// src/AppBundle/DataFixtures/Neo4j/LoadUserData.php
namespace AppBundle\DataFixtures\Neo4j;

use GraphAware\Common\Connection\ConnectionInterface;
use PandawanTechnology\Neo4jDataFixtures\AbstractNeo4jFixture;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

class LoadUserData extends AbstractNeo4jFixture implements ContainerAwareInterface
{
    private $container;
    
    /**
     * @inheritDoc
     */
    public function setContainer(ContainerInterface $container = null)
    {
        $this->container = $container;
    }
    
    /**
     * @inheritDoc
     */
    public function load(ConnectionInterface $connection)
    {
        // ... statements here
    }
}

For more informations, you can have a look into the Pandawan Technology Neo4j DataFixtures library README file.

neo4jfixturesbundle's People

Contributors

xavismeh avatar

Watchers

Azeem Michael avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.