← Back to Money Support
I followed the doc to setup a money field on a model
Created amount (float) and currency_id (integer) in database table for that model
Added 'Initbiz.Money.Behaviors.MoneyFields' in behaviors
defined my money field in fields.yaml
Added $moneyFields array
protected $moneyFields = [
'price' => [
'amountColumn' => 'amount',
'currencyIdColumn' => 'currency_id'
When I go to my model, I got the following error :
"Invalid argument supplied for foreach()" on line 25 of /plugins/initbiz/money/behaviors/MoneyFields.php
What did I miss ?
2 years ago
Thanks for using our plugin.
What do you mean by Added 'Initbiz.Money.Behaviors.MoneyFields' in behaviors? You should implement the behavior in your model.
<?php namespace Initbiz\ExamplePlugin\Models;
class ExampleModel extends Model
public $implement = [
As described in the docs: https://octobercms.com/docs/services/behaviors
Thank you for your answer, this is what I did
PS : I'm using SQLite, don't know if it could be related...
Change protected $moneyFields to public. Should help.
I will fix the documentation as soon as possible :)
Documentation fixed and new version of behavior as well.
Update to 1.0.2 :)
1-5 of 5
October CMS has become a primary platform for professional developers and digital studios all around the world. Businesses depend on our platform. Our mission is to help them succeed, and this means that we must harness opportunities to do so.
Continue reading →