logistcloud/edo-bundle

logist.cloud EdoBundle

This package's canonical repository appears to be gone and the package has been frozen as a result.

Installs: 7

Dependents: 0

Suggesters: 0

Security: 0

Type:symfony-bundle

dev-master 2017-11-07 14:52 UTC

This package is auto-updated.

Last update: 2019-08-11 17:00:53 UTC


README

Composer

Run the command $ php composer.phar require logistcloud/edo-bundle:dev-master. Composer will install bundle to logistcloud/edo-bundle directory.

Add to your app/config/parameters.yml:

parameters:
    dev_key: 'ak-15135506-228f-4f8f-ab98-wk4kl345'
    login: 'test@logist.cloud'
    password: 'test@logist.cloud3450938450'
    p_key: '2222'

Add to your app/AppKernel.php:

<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            //...
            new EdoBundle\EdoBundle()
        );

        return $bundles;
    }

//...
}
?>

Using

Example of use

In your controller:

<?php
#...
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
#...

/**
 * @Route("/", name="homepage")
 * @return Response
 */
public function indexAction()
{
    $diaDoc = $this->get('Diadoc');
    $organizations = $diaDoc->getMyOrganizations();
    if (is_array($organizations) && isset($organizations['Organizations'])) {
        $organizations = reset($organizations['Organizations']);
        if (isset($organizations['Boxes'])) {
            $box = reset($organizations['Boxes']);
            $boxId = isset($box['BoxId']) ? $box['BoxId'] : '';
            if (isset($organizations['Departments'])) {
                $department = reset($organizations['Departments']);
                $result = $diaDoc->sendNonFormalizedAttachment([__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Tests' . DIRECTORY_SEPARATOR . 'Test333.pdf'], ['ak@logist.cloud'], [
                    'FromBoxId' => $boxId,
                    'IsInternal' => 'true',
                    'FromDepartmentId' => '00000000-0000-0000-0000-000000000000',
                    'ToDepartmentId' => $department['DepartmentId'],
                ]);
            }
        }
    }
    //echo '<pre>';
    return new Response(print_r($result, true));
}
#...
?>