Skip to content

Commit c15ce33

Browse files
Add Meta Informations to the common Message object
1 parent 1ca7b05 commit c15ce33

File tree

2 files changed

+33
-14
lines changed

2 files changed

+33
-14
lines changed

Changelog.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# Change Log
22

3-
The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.
3+
The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.
44

55
## UNRELEASED
66

7+
### Changed
8+
9+
- Add meta informations from the profiler to `Translation\Common\Model\Message`
10+
711
## 0.3.2
812

913
### Changed
@@ -58,19 +62,19 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee
5862
### Changed
5963

6064
- `Translation\Bundle\Service\CatalogueFetcher` moved to `Translation\Bundle\Catalogue\CatalogueFetcher`
61-
- Made most (if not all) classes final.
65+
- Made most (if not all) classes final.
6266
- `CatalogueFetcher` requires a `Configuration` object.
6367

6468
### Removed
6569

6670
- Dead code in the `SymfonyProfilerController`
67-
- `FileStorage` was moved to `php-translation/symfony-storage`
71+
- `FileStorage` was moved to `php-translation/symfony-storage`
6872

6973
### Fixed
7074

71-
- The bundle works without any configuration.
75+
- The bundle works without any configuration.
7276
- You may have an config named "default".
7377

7478
## 0.1.0
7579

76-
First release.
80+
First release.

Model/SfProfilerMessage.php

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,30 @@ public static function create(array $data)
121121
*
122122
* @return Message
123123
*/
124-
public function convertToMessage()
125-
{
126-
return new Message(
127-
$this->key,
128-
$this->domain,
129-
$this->locale,
130-
$this->translation
131-
);
132-
}
124+
public function convertToMessage()
125+
{
126+
$meta = [];
127+
128+
if (!empty($this->getParameters())) {
129+
$meta['parameters'] = $this->getParameters();
130+
}
131+
132+
if (!empty($this->getCount())) {
133+
$meta['count'] = $this->getCount();
134+
}
135+
136+
if (!empty($this->getTransChoiceNumber())) {
137+
$meta['transChoiceNumber'] = $this->getTransChoiceNumber();
138+
}
139+
140+
return new Message(
141+
$this->key,
142+
$this->domain,
143+
$this->locale,
144+
$this->translation,
145+
$meta
146+
);
147+
}
133148

134149
/**
135150
* @return int

0 commit comments

Comments
 (0)