Revision #40 has been created by
rackycz on Oct 14, 2025, 2:00:19 PM with the memo:
edit
« previous (#39) next (#41) »
Changes
Title
unchanged
Yii3 - How to start
Category
unchanged
Tutorials
Yii version
unchanged
3.0
Tags
unchanged
Content
changed
[...]
## Dependency injection + container
Check [this YouTube video](https://www.youtube.com/watch?v=TqMXzEK0nsA) for explanation
## invoke()
The `__invoke()` public method is called when you call the **instance** as a method.
Like this:(Therefore the constructor was already executed)
```php[...]
```
Note that "property promotion" should be only used in `__construct()`.
## Hash annotations for class attributes
PHP 8 introduces annotations like this (not only for class attributes):
- `#[Column(type: 'primary')]`
- `#[Column(type: 'string(255)', nullable: true)]`
- `#[Entity(repository: UserRepository::class)]`[...]