Does anyone know good examples for a PHP application using the following 4 โLayersโ
ServiceLayer --> Model --> DataMapper --> DAO
I'm not sure if it makes sense, but when I use such a project, I need to do the following to create a new record in my database:
$servcie = new Service(new Mapper(new Dao));
$service->save($data)
The service creates a new data object and passes it to Mapper, Mapper transfers the data to the provided Dao ..
What is the intention to use such constructions?
Why not just:
$model = new Model();
$model->save($data)
The model saves in the database.
source
share