logistcloud/edo-bundle

logist.cloud EdoBundle

安装: 7

依赖者: 0

建议者: 0

安全: 0

类型: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

运行以下命令 $ php composer.phar require logistcloud/edo-bundle:dev-master。Composer 将将包安装到 logistcloud/edo-bundle 目录。

添加到您的 app/config/parameters.yml

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

添加到您的 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;
    }

//...
}
?>

使用

使用示例

在您的控制器中

<?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));
}
#...
?>