erdmannfreunde / contao-portfolio-bundle

3 stars 8 forks source link

Warnings in portfolio list and reader #30

Closed seibtph closed 1 year ago

seibtph commented 1 year ago

I have found some warnings in backend and frontend.

Backend:

Article with module of type portfoliolist

Warning: Undefined array key "portfoliolist"
vendor/erdmannfreunde/portfoliobundle/src/Resources/contao/modules/ModulePortfolioList.php:32

Article with module of type portfolioreader

Warning: Undefined array key "portfolioreader"
vendor/erdmannfreunde/portfoliobundle/src/Resources/contao/modules/ModulePortfolioReader.php:33

Frontend:

Page with module of type portfoliolist

Warning: Undefined array key "tl_news_archive"
vendor/erdmannfreunde/portfoliobundle/src/Resources/contao/dca/tl_portfolio_category.php:29

Page with module of type portfolioreader

Warning: Undefined variable $blnAddArchive
vendor/erdmannfreunde/portfoliobundle/src/Resources/contao/modules/ModulePortfolio.php:42

Contao 4.13.16 PHP 8.1 Portfolio Bundle 1.0.6

denniserdmann commented 1 year ago

Please try the newer Version 4.X

seibtph commented 1 year ago

I have tried this, but the existing portfolio was deleted?

denniserdmann commented 1 year ago

Ooops, I'm sorry for this. This could have happened because the portfolio structure changed from Version 1.X to 4.X. In Version 1 there were no archives, but direct entries and there was no migration from 1.X ersion to newer versions.

You can try the following:

  1. Update to Version 4.6 but skip the database update.
  2. Create the tl_portfolio_archive by yourself or with the following SQL
    
    CREATE TABLE `tl_portfolio_archive` (
    `id` int UNSIGNED NOT NULL,
    `tstamp` int UNSIGNED NOT NULL DEFAULT '0',
    `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
    `groups` blob,
    `protected` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
    `jumpTo` int UNSIGNED NOT NULL DEFAULT '0'
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

INSERT INTO tl_portfolio_archive (id, tstamp, title, groups, protected, jumpTo) VALUES (1, 1603615584, 'Referenzen', NULL, '', 1);


3. add an additional column `pid` for `tl_portfolio` via SQL and use `1` as value for each item.
4. update the database via install tool or manager
seibtph commented 1 year ago

Ok thanks. I was able to recover everything, but I will stay with version 1 for now. We will update at a later date.