OFFLINE-GmbH / oc-mall-plugin

:convenience_store: E-commerce solution for October CMS
https://offline-gmbh.github.io/oc-mall-plugin
MIT License
169 stars 112 forks source link

Class 'Filebase\Database' not found #81

Closed HomaEEE closed 5 years ago

HomaEEE commented 5 years ago

After save product have error:

[Symfony\Component\Debug\Exception\FatalThrowableError] Class 'Filebase\Database' not found

How it fix?

amdad commented 5 years ago

You need to run Composer install or update to install dependencies of Mall. 'Filebase\Database' is one of them.

tobias-kuendig commented 5 years ago

Closing this issue due to inactivity. @HomaEEE feel free to respond if you still experience problems.

obuchmann commented 5 years ago

We have the same Problem with the Version from the October Store. Seen in https://github.com/OFFLINE-GmbH/oc-mall-plugin/blob/8bfe0931f3731de33ae394ae6b43e308ce86877d/classes/index/Filebase.php#L23

I think the Store version is missing the composer dependencies.

tobias-kuendig commented 5 years ago

I'm looking into this. You should be able to fix it by running composer install manually.

obuchmann commented 5 years ago

unfortunately the store version does not provide a composer.json nor it provides a vendor folder.

Here is my mall root:

mall tree -L 1
.
├── assets
├── check.sh
├── classes
├── components
├── console
├── CONTRIBUTING.md
├── controllers
├── docs
├── formwidgets
├── lang
├── LICENSE
├── models
├── phpcs.xml
├── phpmd.xml
├── phpunit_bootstrap.php
├── phpunit.xml
├── Plugin.php
├── plugin.yaml
├── README.md
├── tests
├── updates
└── views

I tried the git version, it works fine with composer install.

tobias-kuendig commented 5 years ago

I'm looking into the issue: https://github.com/octobercms/october/issues/4043

tobias-kuendig commented 5 years ago

This problem has been fixed in 1.0.3. Thank you @obuchmann and @HomaEEE for reporting the issue.

For further information on the marketplace issue see https://github.com/octobercms/october/issues/4043

dathwa commented 3 years ago

This issue has re-appeared for me after upgrading from ocms1 to ocms2, "offline/oc-mall-plugin": "^1.14". The vendor folder is missing. I tried deleting the mall folder again, then php artisan october:sync but folder still missing. Any way I can force this, or at least can you provide an archive of the vendor folder i can use temporarily? Live site is broken. Thank-you.

tobias-kuendig commented 3 years ago

Run composer install in plugins/offline/mall to install the missing dependencies.

dathwa commented 3 years ago

Thanks. That did the trick. However, I now have a 500 error.

`PHP Fatal error: Declaration of Illuminate\Foundation\Exceptions\Handler::report(Exception $e) must be compatible with Illuminate\Contracts\Debug\ExceptionHandler::report(Throwable $e) in C:\htdocs\example.com\public_html\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php on line 101 PHP Fatal error: Uncaught ReflectionException: Class October\Rain\Foundation\Exception\Handler does not exist in C:\htdocs\example.com\public_html\vendor\laravel\framework\src\Illuminate\Container\Container.php:803 Stack trace:

0 C:\htdocs\example.com\public_html\vendor\laravel\framework\src\Illuminate\Container\Container.php(803): ReflectionClass->__construct('October\Rain\Fo...')

1 C:\htdocs\example.com\public_html\vendor\laravel\framework\src\Illuminate\Container\Container.php(681): Illuminate\Container\Container->build('October\Rain\Fo...')

2 C:\htdocs\example.com\public_html\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(785): Illuminate\Container\Container->resolve('October\Rain\Fo...', Array, false)

3 C:\htdocs\example.com\public_html\vendor\laravel\framework\src\Illuminate\Container\Container.php(265): Illuminate\Foundation\Application->resolve('October\Rain\Fo...', Array, false)

4 C:\htdocs\example.com\public_html\vendor\laravel\framework\src\Illuminate\Container\Container.php(799): Illumin in C:\htdocs\example.com\public_html\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 805

`

dathwa commented 3 years ago

Update: Replacing "Throwable" with "Exception" in plugins/offline/mall/vendor/illuminate/contracts/Debug/ExceptionHandler.php fixed the 500 error. But i now have this error again: Symfony\Component\Debug\Exception\FatalThrowableError: Class 'Filebase\Database' not found in C:\htdocs\example.com\public_html\plugins\offline\mall\classes\index\Filebase.php:23

Where is this Database object? Thanks again.

daftspunk commented 3 years ago

Here's how to install in OC2 from scratch:

composer create-project october/october .
php artisan october:install
php artisan october:migrate
php artisan plugin:install offline.mall
php artisan plugin:check
php artisan october:migrate
  1. Download October
  2. Install October
  3. Migrate DB
  4. Install Mall
  5. Install Dependencies
  6. Migrate DB

Done

dathwa commented 3 years ago

The Class 'Filebase\Database' not found error was present because I had the "index driver" option in "Mall Settings" set to "Filesystem". I switched to "Database" and this fixed the error. OFFLINE also suggested as another option to specifically install the missing dependencies offline/jsonq tmarois/filebase. "please see the release notes for the 1.14.0 release: https://offline-gmbh.github.io/oc-mall-plugin/changelog/1.14.0.html#check-your-composer-dependencies The optional packages have been moved to be only suggestions to make the dependency handling easier. This means that you have to install them manually, in case you are using the file-based index instead of the database one. "

chocolata commented 2 years ago

Hi guys,

I'm migrating my site from October CMS v1 to v2 and am now encountering the same issues. My previous' install index also was filebased. I ran composer install in the plugins/offline/mall folder, which installed some dependencies. The errors persisted. I then ran composer require offline/jsonq tmarois/filebase which installed all the dependencies, but still I constantly am getting the following error.

After I installed the dependencies, I finally was able to get back into the admin area, and was able to switch to the database index. But trying to run any command after that throws the same error below...

I also tried to do as Dathwa said... I ran a find and replace in the below file to change "Throwable" to "Exception" in plugins/offline/mall/vendor/illuminate/contracts/Debug/ExceptionHandler.php, but this doesn't seem to have effect.

Can anyone help me to get unstuck please? :-)

PHP Fatal error:  Declaration of Illuminate\Foundation\Exceptions\Handler::report(Exception $e) must be compatible with Illuminate\Contracts\Debug\ExceptionHandler::report(Throwable $e) in /var/www/vhosts/mydomain.be/httpdocs/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php on line 101
PHP Fatal error:  Uncaught ReflectionException: Class October\Rain\Foundation\Exception\Handler does not exist in /var/www/vhosts/mydomain.be/httpdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php:803
Stack trace:
#0 /var/www/vhosts/mydomain.be/httpdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(803): ReflectionClass->__construct()
#1 /var/www/vhosts/mydomain.be/httpdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(681): Illuminate\Container\Container->build()
#2 /var/www/vhosts/mydomain.be/httpdocs/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(785): Illuminate\Container\Container->resolve()
#3 /var/www/vhosts/mydomain.be/httpdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(265): Illuminate\Foundation\Application->resolve()
#4 /var/www/vhosts/mydomain.be/httpdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(799): Illuminate\Container\Container->I in /var/www/vhosts/mydomain.be/httpdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 805

Thanks in advance!

daftspunk commented 2 years ago

@chocolata If using October v2+, don't run composer install in the plugin directory. This is a v1 pattern and can cause these types of conflicts; precisely the reason we stopped doing it in v2. As a soft test, rename plugins/offline/mall/vendor to vendor2 to see if it helps.

Just install using composer in the root directory and it will pull in all the necessary dependencies.

php artisan plugin:install offline.mall

or

composer require offline/oc-mall-plugin
chocolata commented 2 years ago

Thanks for the heads-up... Will definitely take that into account. I finally got it working, but I'm unsure how. I replaced the Mall-plugin folder with my backed up folder of the mall plugin from before the migration and suddenly it did work. Maybe because I also renamed the index folder. I then switched to the database driven index and now I'm up & running.