gearbox-solutions / eloquent-filemaker

A Model extension and Eloquent driver for Laravel connecting to FileMaker through the Data API
https://gearboxgo.com
MIT License
56 stars 16 forks source link

Exception thrown while setting global fields #51

Closed orochefort closed 1 year ago

orochefort commented 1 year ago

Dependencies

Description of the issue:

Firstly, may I suggest giving an example in the documentation of how to use the setGlobalFields() function. This function is not documented.

Back to the issue. When this function is called, for example :

FM::layout('web_inventory')->setGlobalFields(["inventory::price_category" => 123])

The following exception is thrown:

GearboxSolutionsEloquentFileMakerServicesFileMakerConnection::setGlobalFields(): Argument #1 ($globalFields) must be of type array, GearboxSolutionsEloquentFileMaker\Database\Query\FMBaseBuilder given

Line #861 in FMBaseBuilder.php seems to be the problem:

#857: public function setGlobalFields(array $globals) #858: { #859: $this->globalFields = $globals; #860: #861: return $this->connection->setGlobalFields($this); #862: }

Replace the $this passed as an argument with $globals. That fixes the issue.

Smef commented 1 year ago

This has been updated and released as 1.0.9. Thanks!

orochefort commented 1 year ago

Thanks to you guys!