Difference between #39 and #40 of
Yii3 - How to start

Revision #40 has been created by rackycz 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)]`
[...]
2 0
5 followers
Viewed: 42 299 times
Version: 3.0
Category: Tutorials
Tags:
Written by: rackycz rackycz
Last updated by: rackycz rackycz
Created on: Oct 8, 2025
Last updated: 2 months ago
Update Article

Revisions

View all history