Skip to content

[Bug] Not all directories are cached correctly, as well as the laravel-data directory. #1107

@SanderSander

Description

@SanderSander

The command data:cache-structures doesn't cache all Data objects correctly when using for example vendor paths, or paths outside the application

The current config doesn't allow to define the correct root_namespace and base_path per directory when using multiple directories.

I also noticed that the \Spatie\LaravelData\Support\Caching\DataClassFinder:36 class adds the path __DIR__.'/../../' to cache some files used in this package (not sure which ones), but the reflection discovery will always search for classes names like:

"Class "Vendor\spatie\laravel-data\src\Support\Caching/../..\Resource" does not exist in the \Spatie\StructureDiscoverer\StructureParsers\ReflectionStructureParser::execute

    'structure_caching' => [
        'enabled' => true,
        'directories' => [app_path('Data'), base_path('vendor/acme/package/src/Data')],
        'cache' => [
            'store' => env('CACHE_STORE', env('CACHE_DRIVER', 'file')),
            'prefix' => 'laravel-data',
            'duration' => null,
        ],
        'reflection_discovery' => [
            'enabled' => true,
            'base_path' => base_path(),
            'root_namespace' => null,
        ],
    ],

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions