diff --git a/demos/init-db.php b/demos/init-db.php index 18eefb828e..0fa1acaf83 100644 --- a/demos/init-db.php +++ b/demos/init-db.php @@ -7,6 +7,7 @@ use Atk4\Core\Factory; use Atk4\Data\Field; use Atk4\Data\Model; +use Atk4\Data\Reference; use Atk4\Ui\Exception; use Atk4\Ui\Form; use Atk4\Ui\Table; @@ -299,7 +300,7 @@ public function addField(string $name, $seed = []): Field } #[\Override] - public function hasOne(string $link, array $defaults = []) + public function hasOne(string $link, array $defaults): Reference { // TODO remove once HasOne reference can infer type from their model if (!isset($defaults['type'])) { diff --git a/docs/multiline.md b/docs/multiline.md index e346acb681..d4dce061f9 100644 --- a/docs/multiline.md +++ b/docs/multiline.md @@ -30,7 +30,7 @@ class User extends \Atk4\Data\Model $this->addField('firstname', ['type' => 'string']); $this->addField('lastname', ['type' => 'string']); - $this->containsMany('addresses', [Address::class, 'system' => false]); + $this->containsMany('addresses', ['model' => [Address::class], 'system' => false]); } } @@ -81,7 +81,7 @@ class Email extends \Atk4\Data\Model $this->addField('email_address', ['type' => 'string']); - $this->hasOne('user_id', [User::class]); + $this->hasOne('user_id', ['model' => [User::class]]); } } @@ -99,7 +99,7 @@ class User extends \Atk4\Data\Model $this->addField('firstname', ['type' => 'string']); $this->addField('lastname', ['type' => 'string']); - $this->hasMany('Emails', [Email::class]); + $this->hasMany('Emails', ['model' => [Email::class]]); } } ```