Yii3 - How to start

Comparing #39 with #40

Revision #40 was created by rackycz rackycz on Oct 14, 2025, 2:00:19 PM.

edit

Content

[...]
## 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)]`
[...]