lundi 6 mars 2023

Data mapping - what pattern to use in php oop? [duplicate]

I'm looking for a right pattern to implement the mapping of data in php oop app. I've looked at Data Mapper pattern, but it seems to be dealing with different stuff.

What I'm trying to do is the following:

There's an external_services table in my db, which is populated with a list of services coming from external api. Some of the external services are the same as internal services in my services table only named differently, so I want to map those to my internal services in mapped_to_id column.

external_services
+--------------------------+
| id | name | mapped_to_id |
+--------------------------+

services
+-----------+
| id | name |
+-----------+

So what would be the right design pattern (php oop) to implement the class that will be responsible for mapping services? I'm a bit confused about Data Mapper design pattern, is it what I need or not?

Aucun commentaire:

Enregistrer un commentaire