Skip to content

Commit 1e9e3ec

Browse files
Update docs.
1 parent ef6223c commit 1e9e3ec

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function initialize(array $config)
3434
{
3535
$this->table('users');
3636
$this->addBehavior('Robotusers/TableInheritance.Sti');
37-
$this->discriminator('admin');
37+
$this->setDiscriminator('admin');
3838
}
3939
```
4040
Now both the `ClientsTable` and `AdministratorsTable` will share `users` db table. A table has to have a `discriminator` field which will be used to determine which model's record is stored in a row.
@@ -76,6 +76,12 @@ public function initialize(array $config)
7676

7777
An `ImagesTable` will share `files` db table and match only specified mime types.
7878

79+
You can also add accepted discriminators on runtime:
80+
81+
```php
82+
$table->addAcceptedDiscriminator('image/bmp');
83+
```
84+
7985
### Configuration ###
8086

8187
`StiBehavior` supports following options:
@@ -84,7 +90,7 @@ An `ImagesTable` will share `files` db table and match only specified mime types
8490
* `discriminator` - default discriminator value, `$table->alias()` by default
8591
* `table` - db table to share, use this option or `$table->table()` method.
8692
* `checkRules` - `true` by default. Allows to enable/disable build-in rule check for a discriminator value.
87-
* `allowedDiscriminators` - a list of allowed discriminators.
93+
* `acceptedDiscriminators` - a list of accepted discriminators.
8894

8995
## StiParentBehavior
9096

0 commit comments

Comments
 (0)