mark-gerarts / mark-gerarts/automapper-plus
Map to object where properties are in a single associative array
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 562
- Forks
- 32
- PR merge metrics
- No merged PRs in 30d
Description
Hey there,
I was wondering if there was an easy way to map to a destination object where all the properties are in a single associative array?
For example
```
class Employee
{
private $id;
private $firstName;
private $lastName;
private $birthYear;
public function __construct($id, $firstName, $lastName, $birthYear)
{
$this->id = $id;
$this->firstName = $firstName;
$this->lastName = $lastName;
$this->birthYear = $birthYear;
}
public function getId()
{
return $this->id;
}
// And so on...
}
```
and MapTo
```
class EmployeeEntity
{
private $_propDict = [];
public function getId()
{
return $_propDict['id'] ?? null;
}
public function setId($val)
{
$_propDict['id'] = $val;
}
// And so on...
}
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue does not name a source file, test, or entry point. Start by tracing the existing MapTo mapping API and how destination properties are assigned; define expected behavior for EmployeeEntity's $_propDict representation, then add coverage for the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100