F
Filament2mo ago
nowak

Developing on Filament and Filament Plugin locally causes duplicate classes of same namespaces

Hi, I am running a local fork of Filament in my app, and point to this in my composer.json file. Then I am also running a local fork of the Filament Google Maps plugin, which introduces it's own Filament instance it seems, which breaks my overrides of methods in classes from my initial Filament package fork. I am including these in my composer.json like this:
"require": {
"filament/filament": "*",
"cheesegrits/filament-google-maps": "*",
},
"repositories": [
{
"type": "path",
"url": "filament/packages/*"
},
{
"type": "path",
"url": "./filament-google-maps"
}
],
"require": {
"filament/filament": "*",
"cheesegrits/filament-google-maps": "*",
},
"repositories": [
{
"type": "path",
"url": "filament/packages/*"
},
{
"type": "path",
"url": "./filament-google-maps"
}
],
And I am overriding the Filament\Tables\Concerns\CanReorderRecords::reorderTable method which I have customized in my Filament package fork like this:
public function reorderTable(array $order, $draggedRecordKey = null): void
{
parent::reorderTable($order, $draggedRecordKey);
$reorderAction = app(ReordersGroupOrders::class);
$reorderAction->reorder($order, $draggedRecordKey);
}
public function reorderTable(array $order, $draggedRecordKey = null): void
{
parent::reorderTable($order, $draggedRecordKey);
$reorderAction = app(ReordersGroupOrders::class);
$reorderAction->reorder($order, $draggedRecordKey);
}
Where when I cmd + hover over parent::reorderTable, I see the following definitions:
Filament\Tables\Concerns\CanReorderRecords::reorderTable

<?php
public function reorderTable(array $order): void { }
@param array<int|string> $order

@return void

Filament\Tables\Concerns\CanReorderRecords::reorderTable

<?php
public function reorderTable(array $order, null|int|string $draggedRecordKey = null): void { }
@param array<int|string> $order

@param null|int|string $draggedRecordKey

@return void

function ListRecords::reorderTable(
array<int|string> $order
): void
Filament\Tables\Concerns\CanReorderRecords::reorderTable

<?php
public function reorderTable(array $order): void { }
@param array<int|string> $order

@return void

Filament\Tables\Concerns\CanReorderRecords::reorderTable

<?php
public function reorderTable(array $order, null|int|string $draggedRecordKey = null): void { }
@param array<int|string> $order

@param null|int|string $draggedRecordKey

@return void

function ListRecords::reorderTable(
array<int|string> $order
): void
And when I cmd + click parent::reorderTable, I navigated to:
filament-google-maps/vendor/filament/tables/src/Concerns/CanReorderRecords.php
filament-google-maps/vendor/filament/tables/src/Concerns/CanReorderRecords.php
Instead of to:
filament/packages/tables/src/Concerns/CanReorderRecords.php
filament/packages/tables/src/Concerns/CanReorderRecords.php
How can I make sure that I override the reorderTable method in the correct package?
Solution:
Doing this: ``` rm -r filament filament-google-maps/; git submodule init git submodule update --recursive --remote...
Jump to solution
1 Reply
Solution
nowak
nowak2mo ago
Doing this:
rm -r filament filament-google-maps/;
git submodule init
git submodule update --recursive --remote
rm -r vendor node_modules
composer install
npm install
php artisan migrate:fresh --seed
npm run dev
rm -r filament filament-google-maps/;
git submodule init
git submodule update --recursive --remote
rm -r vendor node_modules
composer install
npm install
php artisan migrate:fresh --seed
npm run dev
Seemed to make my override point to the correct class again. I think it might have been due to having ran composer install on the forked filament package and filament plugin directories.