atlas/mapper

A data mapper for the persistence model.

Maintainers

👁 pmjones

Package info

github.com/atlasphp/Atlas.Mapper

Homepage

pkg:composer/atlas/mapper

Statistics

Installs: 72 663

Dependents: 3

Suggesters: 0

Stars: 7

Open Issues: 5

1.4.1 2023-09-25 13:18 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT df92c4f53d7be22a793700c06a4340a48a90c8a8

ormsqldatamappingmapper


README

A data mapper implementation for Atlas. Though it is primarily intended as the heart of Atlas.Orm, it may be used independently of that package.

Getting Started

First, you will need to create the prerequsite data-source classes using Atlas.Cli 2.x.

Once you have done so, create a MapperLocator using the static new() method and pass your PDO connection parameters:

use Atlas\Table\MapperLocator;

$mapperLocator = MapperLocator::new('sqlite::memory:'')

You can then use the locator to retrieve a Mapper by its class name.

use Atlas\Testing\DataSource\Thread\ThreadMapper;

$threadMapper = $mapperLocator->get(ThreadMapper::CLASS)

From there you can fetch, insert, update, delete, and persist Record objects.

In the absence of full documentation, please review these Mapper methods instead:

  • fetchRecord()
  • fetchRecordBy()
  • fetchRecords()
  • fetchRecordsBy()
  • fetchRecordSet()
  • fetchRecordSetBy()
  • select()
  • insert()
  • update()
  • delete()
  • persist()