vincentchalamon/nav-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

Symfony bundle for Microsoft Dynamics NAV

Fund package maintenance!
vincentchalamon

Installs: 816

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 2

Forks: 1

Open Issues: 1

Type:symfony-bundle

v2.0.0 2021-12-29 16:05 UTC

This package is auto-updated.

Last update: 2022-10-26 08:52:05 UTC


README

This bundle is not supported anymore!

GitHub CI Packagist Version Software license Coverage Status

This Symfony Bundle is used to map objects with a Microsoft Dynamics NAV service.

Requirements

  • PHP ^7.3
  • PHP extensions: curl, dom, soap

Installation

composer req vincentchalamon/nav-bundle

Configuration

nav:
    url: '%env(NAV_URL)%' # i.e.: https://user:pass@www.example.com/NAV_WS/
    paths:
        App:
            path: '%kernel.project_dir%/src/Entity'
            namespace: 'App/Entity'

Advanced configuration

nav:
    enable_profiler: '%kernel.debug%'
    foo:
        wsdl: '%env(NAV_WSDL)%'
        connection:
            class: App\Connection\CustomConnectionClass
            username: '%env(NAV_USERNAME)%'
            password: '%env(NAV_PASSWORD)%'
        paths:
            Foo:
                path: '%kernel.project_dir%/src/Entity/Foo'
                namespace: 'App/Entity/Foo'
        entity_manager_class: App\EntityManager\CustomEntityManager
        driver: nav.class_metadata.driver.annotation
        name_converter: nav.serializer.name_converter.camel_case_to_nav
        soap_options:
            soap_version: 1
            connection_timeout: 120
            exception: '%kernel.debug%'
            trace: '%kernel.debug%'
    bar:
        wsdl: '%env(ANOTHER_WSDL)%'
        connection:
            class: App\Connection\CustomConnectionClass
            username: '%env(ANOTHER_USERNAME)%'
            password: '%env(ANOTHER_PASSWORD)%'
        paths:
            Bar:
                path: '%kernel.project_dir%/src/Entity/Bar'
                namespace: 'App/Entity/Bar'
        entity_manager_class: App\EntityManager\CustomEntityManager
        driver: app.class_metadata.custom
        name_converter: nav.serializer.name_converter.camel_case_to_nav
        soap_options:
            soap_version: 1
            connection_timeout: 120
            exception: '%kernel.debug%'
            trace: '%kernel.debug%'

Usage

namespace App\Entity;

use NavBundle\Annotation as Nav;

/**
 * @Nav\Entity(namespace="Contact")
 */
final class Contact
{
    /**
     * @Nav\Column
     * @Nav\Key
     */
    public $key;

    /**
     * @Nav\Column
     * @Nav\No
     */
    public $no;

    /**
     * @Nav\Column(name="Custom_Email", nullable=true)
     */
    public $email;

    /**
     * @Nav\Column(type="date", nullable=true)
     */
    public $date;

    /**
     * @Nav\ManyToOne(targetClass=Foo::class)
     */
    public $foo;
}

Read

/** @var \NavBundle\RegistryInterface $registry */
$registry = $container->get('nav.registry');

$manager = $registry->getManagerForClass(Contact::class);
$repository = $manager->getRepository(Contact::class);

// Find entity by primary key
$repository->find($no);

// Find collection by a set of criteria
$repository->findBy(['foo' => 'bar']);

// Find entity by a set of criteria
$repository->findOneBy(['foo' => 'bar']);

// Find all
$repository->findAll();

Write/delete

/** @var \NavBundle\RegistryInterface $registry */
$registry = $container->get('nav.registry');

$manager = $registry->getManagerForClass(Contact::class);

// Create/Update
$manager->persist($object);

// Delete
$manager->remove($object);

// Flush
$manager->flush();

// It's also possible to flush an object or an array of objects
$manager->flush($object);

Profiler

Profiler

Code of conduct

This bundle is ruled by a code a conduct.

Contributing

Please have a look to the contributing guide.

Backward Compatibility promise

This bundle follows the same Backward Compatibility promise as the Symfony framework: https://symfony.com/doc/current/contributing/code/bc.html