layout | title | keywords |
---|---|---|
default |
Data Mapper |
data mapper, pdo, query builder |
![](/assets/images/version-{{ pageVersion }}.svg)
These components have been heavily influenced by Aura PHP and Atlas PHP
{: .alert .alert-warning }
The Data Mapper pattern as described by Martin Fowler in Patterns of Enterprise Application Architecture is:
A layer of Mappers that moves data between objects and a database while keeping them independent of each other and the mapper itself.
{: .alert .alert-info }
The Phalcon\DataMapper
namespace contains components to help with accessing your data source, with the [Data Mapper][pattern].
One of the components required by this implementation is a PDO connector. The Phalcon\DataMapper\Pdo\Connection offers a wrapper to PHP's PDO implementation, making it easier to maintain connections.
Connecting to a source