trilbymedia / grav-plugin-flex-objects

Powerful and supremely flexible object support for Grav
MIT License
40 stars 10 forks source link

Bad storage class error #171

Open Sogl opened 1 year ago

Sogl commented 1 year ago

I develop on my MacbookPro, OS X Monterey, server installed using Grav Blog instruction, php 7.4. All works fine. But on production server (CloudLinux) I see error during deployment (on bin/gpm install <anyplugin>) about my custom storage class:

In FlexDirectory.php line 996:

Bad storage class: Grav\Plugin\SoglFlex\Flex\Types\Users\UserFolderStorage

This line part on FlexDirectory.php:

if (!is_a($className, FlexStorageInterface::class, true)) {
    throw new \RuntimeException('Bad storage class: ' . $className);
}

Error shows on every plugin install: image

My storage class:

<?php
declare(strict_types=1);

namespace Grav\Plugin\SoglFlex\Flex\Types\Users;

use Grav\Common\Flex\Types\Users\Storage\UserFolderStorage as DefaultUserFolderStorage;

/**
 * Class UserFolderStorage
 * @package Grav\Plugin\SoglFlex\Flex\Types\Users
 */
class UserFolderStorage extends DefaultUserFolderStorage
{
    /**
     * Prepares the row for saving and returns the storage key for the record.
     *
     * @param array $row
     */
    protected function prepareRow(array &$row): void
    {
        parent::prepareRow($row);
    }

    protected function initOptions(array $options): void
    {
        parent::initOptions($options);
    }

}

I changed Storage class to default (object: 'Grav\Common\Flex\Types\Users\UserObject') and now it works on production too. But what kind of error is this?