Обновление на yii 2.0.13.1 и phpexcel

Общие вопросы по использованию второй версии фреймворка. Если не знаете как что-то сделать и это про Yii 2, вам сюда.
Ответить
Аватара пользователя
Introvert
Сообщения: 139
Зарегистрирован: 2017.07.04, 13:42
Откуда: Украина, Киев

Обновление на yii 2.0.13.1 и phpexcel

Сообщение Introvert »

Обновился на yii 2.0.13.1 через composer update. Стало ругаться:
PHP Fatal Error – yii\base\ErrorException
Class 'PHPExcel_Style_Alignment' not found на строчку:

Код: Выделить всё

                // Выравнивание по центру
			'alignment' => [
		        'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
				'vertical' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
	        ],
Использую yii2-export от Картик. После обновления по пути \vendor\phpoffice папка phpexcel пропала! Вместо нее стала phpspreadsheet. В логе - Removing phpoffice/phpexcel (1.8.1)
Как исправить ошибку? Возможно появятся еще связанные с phpexcel. Лог установки:

Код: Выделить всё

$ composer update
The "extra.asset-installer-paths" option is deprecated, use the "config.fxp-asse
t.installer-paths" option
Loading composer repositories with package information
Updating dependencies (including require-dev)

Package operations: 6 installs, 37 updates, 3 removals
  - Removing stecman/symfony-console-completion (0.7.0)
  - Removing phpoffice/phpexcel (1.8.1)
  - Removing bower-asset/jquery.inputmask (3.3.6)
  - Updating ezyang/htmlpurifier (v4.9.2 => v4.9.3): Downloading (connecting...)
Downloading (100%)
  - Updating cebe/markdown (1.1.1 => 1.1.2): Downloading (100%)
  - Updating bower-asset/jquery (2.2.4 => 3.2.1): Downloading (100%)
  - Updating bower-asset/yii2-pjax (v2.0.6 => 2.0.7.1): Downloading (connecting.
Downloading (100%)
  - Installing bower-asset/inputmask (3.3.11): Downloading (100%)
  - Updating yiisoft/yii2 (2.0.11.2 => 2.0.13.1): Downloading (100%)
  - Updating mdmsoft/yii2-admin (2.7 => 2.8): Downloading (100%)
  - Updating yiisoft/yii2-bootstrap (2.0.6 => 2.0.7): Downloading (connecting...
Downloading (100%)
  - Updating yiisoft/yii2-debug (2.0.9 => 2.0.13): Downloading (100%)
  - Updating yiisoft/yii2-gii (2.0.5 => 2.0.6): Downloading (100%)
  - Updating phpunit/phpunit-mock-objects (3.4.3 => 3.4.4): Downloading (connect
Downloading (100%)
  - Installing codeception/stub (1.0.1): Downloading (100%)
  - Updating symfony/polyfill-mbstring (v1.3.0 => v1.6.0): Downloading (connecti
Downloading (100%)
  - Updating symfony/dom-crawler (v3.3.0 => v3.4.3): Downloading (connecting...)
Downloading (100%)
  - Updating symfony/css-selector (v3.3.0 => v3.4.3): Downloading (connecting...
Downloading (100%)
  - Updating symfony/browser-kit (v3.3.0 => v3.4.3): Downloading (connecting...)
Downloading (100%)
  - Updating symfony/yaml (v3.3.0 => v3.4.3): Downloading (100%)
  - Updating symfony/event-dispatcher (v3.3.0 => v3.4.3): Downloading (connectin
Downloading (100%)
  - Updating symfony/debug (v3.3.0 => v3.4.3): Downloading (100%)
  - Updating symfony/console (v3.3.0 => v3.4.3): Downloading (100%)
  - Updating symfony/finder (v3.3.0 => v3.4.3): Downloading (100%)
  - Updating phpunit/php-token-stream (1.4.11 => 1.4.12): Downloading (connectin
Downloading (100%)
  - Updating phpunit/php-file-iterator (1.4.2 => 1.4.5): Downloading (connecting
Downloading (100%)
  - Updating phpdocumentor/reflection-common (1.0 => 1.0.1): Downloading (connec
Downloading (100%)
  - Updating phpdocumentor/type-resolver (0.2.1 => 0.4.0): Downloading (connecti
Downloading (100%)
  - Updating phpdocumentor/reflection-docblock (3.1.1 => 3.3.2): Downloading (co
Downloading (100%)
  - Updating phpspec/prophecy (v1.7.0 => 1.7.3): Downloading (100%)
  - Updating myclabs/deep-copy (1.6.1 => 1.7.0): Downloading (100%)
  - Updating phpunit/phpunit (5.7.20 => 5.7.26): Downloading (100%)
  - Updating codeception/base (2.3.2 => 2.3.8): Downloading (100%)
  - Updating kartik-v/yii2-krajee-base (v1.8.8 => v1.8.9): Downloading (connecti
Downloading (100%)
  - Updating kartik-v/yii2-widget-select2 (v2.0.9 => v2.1.1): Downloading (conne
Downloading (100%)
  - Updating kartik-v/yii2-dialog (v1.0.1 => v1.0.3): Downloading (connecting...
Downloading (100%)
  - Updating kartik-v/yii2-grid (v3.1.5 => v3.1.7): Downloading (100%)
  - Updating kartik-v/yii2-dynagrid (v1.4.5 => v1.4.7): Downloading (connecting.
Downloading (100%)
  - Installing paragonie/random_compat (v2.0.11): Downloading (100%)
  - Installing mpdf/mpdf (v7.0.3): Downloading (100%)
  - Updating kartik-v/yii2-mpdf (v1.0.1 => v1.0.2): Downloading (100%)
  - Updating fzaninotto/faker (v1.6.0 => v1.7.1): Downloading (100%)
  - Updating swiftmailer/swiftmailer (v5.4.8 => v5.4.9): Downloading (connecting
Downloading (100%)
  - Installing psr/simple-cache (1.0.0): Downloading (100%)
  - Installing phpoffice/phpspreadsheet (1.0.0): Downloading (100%)
  - Removing kartik-v/yii2-export (dev-master d1ab7ab)
  - Installing kartik-v/yii2-export (dev-master d109a23): Cloning d109a23359 fro
m cache
paragonie/random_compat suggests installing ext-libsodium (Provides a modern cry
pto API that can be used to generate random bytes.)
phpoffice/phpspreadsheet suggests installing dompdf/dompdf (Option for rendering
 PDF with PDF Writer)
phpoffice/phpspreadsheet suggests installing tecnick.com/tcpdf (Option for rende
ring PDF with PDF Writer)
phpoffice/phpspreadsheet suggests installing jpgraph/jpgraph (Option for renderi
ng charts, or including charts with PDF or HTML Writers)
Writing lock file
Generating autoload files

  Seems you have upgraded Yii Framework from version 2.0.11.2 to 2.0.13.1.

  Please check the upgrade notes for possible incompatible changes
  and adjust your application code accordingly.

  Upgrade from Yii 2.0.12
  -----------------------

  * The `yii\web\Request` class allowed to determine the value of `getIsSecureCo
nnection()` form the
    `X-Forwarded-Proto` header if the connection was made via a normal HTTP requ
est. This behavior
    was insecure as the header could have been set by a malicious client on a no
n-HTTPS connection.
    With 2.0.13 Yii adds support for configuring trusted proxies. If your applic
ation runs behind a reverse proxy and relies on
    `getIsSecureConnection()` to return the value form the `X-Forwarded-Proto` h
eader you need to explicitly allow
    this in the Request configuration. See the [guide](http://www.yiiframework.c
om/doc-2.0/guide-runtime-requests.html#trusted-proxies) for more information.

    This setting also affects you when Yii is running on IIS webserver, which se
ts the `X-Rewrite-Url` header.
    This header is now filtered by default and must be listed in trusted hosts t
o be detected by Yii:

    ```php
    [   // accept X-Rewrite-Url from all hosts, as it will be set by IIS
        '/.*/' => ['X-Rewrite-Url'],
    ]
    ```

  * For compatibiliy with [PHP 7.2 which does not allow classes to be named `Obj
ect` anymore](https://wiki.php.net/rfc/object-typehint),
    we needed to rename `yii\base\Object` to `yii\base\BaseObject`.

    `yii\base\Object` still exists for backwards compatibility and will be loade
d if needed in projects that are
    running on PHP <7.2. The compatibility class `yii\base\Object` extends from
`yii\base\BaseObject` so if you
    have classes that extend from `yii\base\Object` these would still work.

    What does not work however will be code that relies on `instanceof` checks o
r `is_subclass_of()` calls
    for `yii\base\Object` on framework classes as these do not extend `yii\base\
Object` anymore but only
    extend from `yii\base\BaseObject`. In general such a check is not needed as
there is a `yii\base\Configurable`
    interface you should check against instead.

    Here is a visualisation of the change (`a < b` means "b extends a"):

    ```
    Before:

    yii\base\Object < Framework Classes
    yii\base\Object < Application Classes

    After Upgrade:

    yii\base\BaseObject < Framework Classes
    yii\base\BaseObject < yii\base\Object < Application Classes

    ```

    If you want to upgrade PHP to version 7.2 in your project you need to remove
 all cases that extend `yii\base\Object`
    and extend from `yii\base\BaseObject` instead:

    ```
    yii\base\BaseObject < Framework Classes
    yii\base\BaseObject < Application Classes
    ```

    For extensions that have classes extending from `yii\base\Object`, to be com
patible with PHP 7.2, you need to
    require `"yiisoft/yii2": "~2.0.13"` in composer.json and change affected cla
sses to extend from `yii\base\BaseObject`
    instead. It is not possible to allow Yii versions `<2.0.13` and be compatibl
e with PHP 7.2 or higher.

  * A new method `public static function instance($refresh = false);` has been a
dded to the `yii\db\ActiveRecordInterface` via a new
    `yii\base\StaticInstanceInterface`. This change may affect your application
in the following ways:

    - If you have an `instance()` method defined in an `ActiveRecord` or `Model`
 class, you need to check whether the behavior is
      compatible with the method added by Yii.
    - Otherwise this method is implemented in the `yii\base\Model`, so the chang
e only affects your code if you implement `ActiveRecordInterface`
      in a class that does not extend `Model`. You may use `yii\base\StaticInsta
nceTrait` to implement it.

  * Fixed built-in validator creating when model has a method with the same name
.

    It is documented, that for the validation rules declared in model by `yii\ba
se\Model::rules()`, validator can be either
    a built-in validator name, a method name of the model class, an anonymous fu
nction, or a validator class name.
    Before this change behavior was inconsistent with the documentation: method
in the model had higher priority, than
    a built-in validator. In case you have relied on this behavior, make sure to
 fix it.

  * Behavior was changed for methods `yii\base\Module::get()` and `yii\base\Modu
le::has()` so in case when the requested
    component was not found in the current module, the parent ones will be check
ed for this component hierarchically.
    Considering that the root parent module is usually an application, this chan
ge can reduce calls to global `Yii::$app->get()`,
    and replace them with module-scope calls to `get()`, making code more reliab
le and easier to test.
    However, this change may affect your application if you have code that uses
method `yii\base\Module::has()` in order
    to check existence of the component exactly in this specific module. In this
 case make sure the logic is not corrupted.

  * If you are using "asset" command to compress assets and your web applicaiton
 `assetManager` has `linkAssets` turned on,
    make sure that "asset" command config has `linkAssets` turned on as well.

  You can find the upgrade notes for all versions online at:
  https://github.com/yiisoft/yii2/blob/2.0.13.1/framework/UPGRADE.md
Пишу социальную сеть заявок для фирм.
someweb
Сообщения: 552
Зарегистрирован: 2017.03.09, 10:12

Re: Обновление на yii 2.0.13.1 и phpexcel

Сообщение someweb »

Конкретно эта ошибка видимо
\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER
В репозитории PHPExcel написано, что он depricated. Исправляйте под PhpSpreadsheet.
Чтобы правильно задать вопрос, нужно знать бо́льшую часть ответа. Роберт Шекли.
Аватара пользователя
ElisDN
Сообщения: 5845
Зарегистрирован: 2012.10.07, 10:24
Контактная информация:

Re: Обновление на yii 2.0.13.1 и phpexcel

Сообщение ElisDN »

Это поменяли в https://github.com/kartik-v/yii2-export/pull/232

Либо откатить с dev-master до стабильной версии:

Код: Выделить всё

composer require kartik-v/yii2-export:1.2.8
либо переписать свой код на phpspreadsheet.
Аватара пользователя
Introvert
Сообщения: 139
Зарегистрирован: 2017.07.04, 13:42
Откуда: Украина, Киев

Re: Обновление на yii 2.0.13.1 и phpexcel

Сообщение Introvert »

Спасибо, решение принял откатить на стабильную версию. А по новому буду переписывать как новый проект, все ровно перешел на yii2 advanced версию с разделением фронтенда и бекенда, нужно пилить почти заново все.
Пишу социальную сеть заявок для фирм.
Ответить