You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sed -ri 's/"symfony\/([^"]+)": "[^"]+"/"symfony\/\1": "${{ matrix.symfony-version }}"/g' composer.json
43
+
# symfony/clock does not exist for 5.4 (added in 6.2); keep it installable on 5.4 jobs
44
+
if [ "${{ matrix.symfony-version }}" = "5.4.*" ]; then
45
+
sed -ri 's/"symfony\/clock": "[^"]+"/"symfony\/clock": "^6.2 | ^7.0"/' composer.json
46
+
fi
47
+
48
+
- name: Constrain Doctrine ORM version
49
+
run: |
50
+
sed -ri 's/"doctrine\/orm": "[^"]+"/"doctrine\/orm": "${{ matrix.doctrine-orm-version }}"/' composer.json
51
+
# Symfony 8 requires doctrine-bundle 3.1+, which requires doctrine/persistence ^4. ORM 3.0/3.1 only support persistence ^3. Use ORM 3.5.* (supports ^3.3.1 || ^4) for SF 8.
52
+
if [ "${{ matrix.symfony-version }}" = "8.0.*" ] && [ "${{ matrix.doctrine-orm-version }}" = "3.0.*" ]; then
53
+
sed -ri 's/"doctrine\/orm": "[^"]+"/"doctrine\/orm": "3.5.*"/' composer.json
This should have been done automagically if you are using [Symfony Flex](https://flex.symfony.com). Otherwise, just register it by yourself.
38
+
This is done automatically if you use [Symfony Flex](https://flex.symfony.com). Otherwise, register it manually.
39
39
40
-
41
-
Let's suppose we have a `App\Entity\Article` doctrine entity we want to track created and update dates.
42
-
All you have to do is to implement `Andante\TimestampableBundle\Timestampable\TimestampableInterface` and use `Andante\TimestampableBundle\Timestampable\TimestampableTrait` trait.
40
+
Suppose you have an `App\Entity\Article` Doctrine entity and want to track created and updated dates.
41
+
All you need to do is implement `Andante\TimestampableBundle\Timestampable\TimestampableInterface` and use the `Andante\TimestampableBundle\Timestampable\TimestampableTrait` trait.
43
42
44
43
```php
45
44
<?php
@@ -75,26 +74,25 @@ class Article implements TimestampableInterface // <-- implement this
75
74
}
76
75
77
76
// ...
78
-
// Some others beautiful properties and methods ...
77
+
// Other properties and methods ...
79
78
// ...
80
79
}
81
80
```
82
-
Make sure to update you database schema following your doctrine workflow (`bin/console doctrine:schema:update --force` if you are a badass devil guy or with a [migration](https://www.doctrine-project.org/projects/doctrine-migrations/en/3.0/reference/introduction.html)if you choosed the be a better developer!).
81
+
Update your database schema using your usual Doctrine workflow (e.g. `bin/console doctrine:schema:update --force`, or use [migrations](https://www.doctrine-project.org/projects/doctrine-migrations/en/3.0/reference/introduction.html)for a safer approach).
83
82
84
-
You shoud see a new columns named `created_at` and `updated_at` ([can i change this?](#configuration-completely-optional)) or something similar based on your [doctrine naming strategy](https://www.doctrine-project.org/projects/doctrine-orm/en/2.8/reference/namingstrategy.html).
83
+
You should see new columns named `created_at` and `updated_at` ([can I change this?](#configuration-completely-optional)), or similar names depending on your [Doctrine naming strategy](https://www.doctrine-project.org/projects/doctrine-orm/en/2.8/reference/namingstrategy.html).
85
84
86
-
#### Congrats! You're done! 🎉
85
+
#### You're done! 🎉
87
86
88
-
Remember that `TimestampableInterface` and `TimestampableTrait` are shortcut to use `CreatedAtTimestampableInterface`+`CreatedAtTimestampableTrait` and `UpdatedAtTimestampableInterface`+`UpdatedAtTimestampableTrait` at the same time!
89
-
If you need to track only **create date** or **update date** you can use these more specific interfaces!
87
+
`TimestampableInterface` and `TimestampableTrait` are shortcuts that combine `CreatedAtTimestampableInterface` + `CreatedAtTimestampableTrait` and `UpdatedAtTimestampableInterface` + `UpdatedAtTimestampableTrait`. To track only **created** or **updated** dates, use the more specific interfaces and traits below.
90
88
91
-
| To keep track of | Implement interface | Use this Trait |
|**Both create and update dates**|`Andante\TimestampableBundle\Timestampable\TimestampableInterface`|`Andante\TimestampableBundle\Timestampable\TimestampableTrait`|
91
+
|**Created date only**|`Andante\TimestampableBundle\Timestampable\CreatedAtTimestampableInterface`|`Andante\TimestampableBundle\Timestampable\CreatedAtTimestampableTrait`|
92
+
|**Updated date only**|`Andante\TimestampableBundle\Timestampable\UpdatedAtTimestampableInterface`|`Andante\TimestampableBundle\Timestampable\UpdatedAtTimestampableTrait`|
@@ -152,32 +150,31 @@ class Article implements TimestampableInterface // <-- implement this
152
150
}
153
151
}
154
152
```
155
-
This allows you to, for instance, to have **a different name** for your properties (E.g. `created` instead of `createdAt` and `updated` instead of `updatedAt`).
156
-
But you will need to explicit this in [bundle configuration](#configuration-completely-optional).
153
+
This lets you use different property names (e.g. `created` and `updated` instead of `createdAt` and `updatedAt`). You must specify these in the [bundle configuration](#configuration-completely-optional).
157
154
158
155
## Configuration (completely optional)
159
-
This bundle is build thinking how to save you time and follow best practices as close as possible.
156
+
This bundle is built to save you time and follow best practices out of the box.
160
157
161
-
This means you can even ignore to have a`andante_timestampable.yml` config file in your application.
158
+
You do not need an`andante_timestampable.yml` config file in your application.
162
159
163
-
However, for whatever reason (legacy code?), use the bundle configuration to change most of the behaviors as your needs.
160
+
If you need to customize it (e.g. for legacy code), you can change most behavior via the bundle configuration:
0 commit comments