// description
// in progress
#[Ignore()] is like #[Groups()] with empty array of groups. If You do not define the groups for property, then Default will be assignment as a property group. Only Origin can decide about group assignment in the process.
| Declaration place | Normalization | Denormalization | Transformation |
|---|---|---|---|
| Origin | Source: ✔️ Target: ✔️ |
Source: ✔️ Target: ✔️ |
Source: ✔️ Target: ✔️ |
| Source | Source: ✖️ Target: ✖️ |
Source: ✖️ Target: ✖️ |
Source: ✖️ Target: ✖️ |
| Target | Source: ✖️ Target: ✖️ |
Source: ✖️ Target: ✖️ |
Source: ✖️ Target: ✖️ |
| Declaration place | Mapping |
|---|---|
| Origin | Source: ✔️ Target: ✔️ |
| Source | Source: ✖️ Target: ✖️ |
| Target | Source: ✖️ Target: ✖️ |
INFO
The table is implemented byPBaszak\UltraMapper\Mapper\Domain\Matcher\Matcher::matchClassBlueprints().
The behavior of the #[TargetProperty()] attribute depends on the class in which you declare it (origin, source, target). The table below presents the relationship between the declaration place and the active process, and how the attribute changes the name (or path) of the property. Placing an attribute in an origin class has no effect on any process unless the origin class is also a source class, a target class, or both.
Target Property attribute works like Symfony\SerializedName for Normalization, Denormalization and Transformation. It changes property name when data are normalized.
| Declaration place | Normalization | Denormalization | Transformation |
|---|---|---|---|
| Origin | Source: ✖️ Target: ✖️ |
Source: ✖️ Target: ✖️ |
Source: ✖️ Target: ✖️ |
| Source | Source: ✖️ Target: ✖️ |
Source: ✔️ Target: ✖️ |
Source: ✔️ Target: ✖️ |
| Target | Source: ✖️ Target: ✔️ |
Source: ✖️ Target: ✖️ |
Source: ✖️ Target: ✔️ |
Target Property attribute links properties from different blueprints for Mapping. It works with other processes or alone.
| Declaration place | Mapping |
|---|---|
| Origin | Source: ✖️ Target: ✖️ |
| Source | Source: ✖️ Target: ✔️ |
| Target | Source: ✔️ Target: ✖️ |
use PBaszak\UltraMapper\Mapper\Application\Attribute\TargetProperty;
class SourceClass {
#[TargetProperty(name: "mappedProperty")]
public string $originalProperty;
}
class TargetClass {
public string $mappedProperty;
}The Ultra Mapper library operates based on blueprints and attributes to map, normalize, denormalize, and transform data between various formats. Here's a step-by-step overview of each process:
- Normalization: Converts a class object into an anonymous object, associative array, or flat array.
- Denormalization: Converts an anonymous object, associative array, or flat array back into a class object.
- Mapping: Maps data from one class object to another, e.g., DTO to entity.
- Transformation: Converts an anonymous object, associative array, or flat array to another structure of the same type.
The TargetProperty attribute is used to specify how properties are mapped or transformed, ensuring that the correct properties are connected even if their names differ.
// in progress
Start local environment using this command:
bash start.shIf You don't have node_modules directory run:
npm installFirst release:
npm run version:first-releaseMajor, Minor, Patch version update:
npm run version:major
# or
npm run version:minor
# or
npm run version:patchPush tags:
npm run version:release
# or
npm run releaseCheck package.json for understand what commands do.
Main command:
docker exec php composer code:analysebut, if You need to add errors to ignored:
docker exec php composer code:analyse:bdocker exec php composer code:fixCreate new file in Your project: .vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for xDebug",
"type": "php",
"request": "launch",
"port": 5902,
"hostname": "0.0.0.0",
"pathMappings": {
"/app/": "${workspaceRoot}"
}
}
]
}Uncomment environments in .env.local:
XDEBUG_MODE=develop,debug
XDEBUG_CONFIG=" client_port=5902 idekey=VSCODE client_host=host.docker.internal discover_client_host=0 start_with_request=yes"Type Ctrl + Shift + D and run Listen for xDebug.