Download the PHP package kassko/data-mapper without Composer

On this page you can find all versions of the php package kassko/data-mapper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package data-mapper

data-mapper

Build Status Total Downloads

A php mapper very tunable, cross-orm and cross-DBMS

Installation

Note that:

Using a version in 0.12 is recommended. Versions in 0.13 are no longer maintained.

Example of good requirement:

Basic usage

Run tests

Ensures phpunit is installed phpunit

Installation: precisions

If you use annotations, register the autoloader:

And run the environment:

Accessing datas

Data-mapper style

Doctrine style

With data-mapper, you only need to call a getter, the access logic is in a configuration.

The configuration is either in the object php file or in a separated file. If it's in the object file, the configuration is in annotations or a method returns it in a php array or in a yaml string. If it's in a separated file, the configuration is in a php or a yaml file.

For simplicity, the usage is documented with annotations format. But in this documentation, you can find reference guide for the others formats.

Hydrating your object

Hydrating your object using inline data sources

Hydrating your object using a data source store

A DataSource store is usefull

If you prefer to group your sources in one place:

Or if you have a source which hydrate several properties:

Note that you don't have to expose the setters. Expose them only if you have specific logic to write. I advise you not to make "public" these setters since the properties they wrapp are loaded (and so managed) with a data source.

Working with sources and dependency injection

CarRepository has some dependencies too (the entity manager), it is instantiated with a resolver class-resolver. Reminder: you can see more details here.

Run environment and register dependencies:

You can send an object which implements \ArrayAccess:

Or send an object which have "get" and "has" methods:

And you specify your dependency id like below:

Source annotation details

Data-mapper is not an ORM so it cannot generate for you some sql statement. But it can wrapp the use of an ORM like Doctrine ORM so that you can take advantage of the two. It also can help you to make relations between different DBMS.

Example with a relation with a Doctrine source

Features: details

=======================================================================================================

Basic usage

Given an object:

Use the ResultBuilder:

The result builder allows you to hydrate all a collection from a result that contains several records. It also allows you to get only one result even if the result contains several records.

The code above will display:

Inversely, you can extract values of an object or of an object collection:

Above, we use the default hydrator. But you often need to customize hydration because column names are different of properties name and for many other reasons.

To customize the hydration you should provide a mapping configuration. Severals formats are available but in this documentation we choose to use the annotation format (more details about all mapping configuration format are available here).

Use the result builder

You can find below all the ways to get results with the ResultBuilder:

Enforce type of fields

This section will be written later.

Apply converters before hydration or extraction

Converter

readDateConverter contains the format of the string to transform into Date object. Internally, DataMapper uses the Php function DateTime::createFromFormat() to create a Date object from a raw string.

writeDateConverter contains the string format in which you want to serialize your Date object. Internally, DataMapper uses the Php function DateTime::createFromFormat() to serialise the Date object in a string.

Given this code:

Your output will be:

If the created_date had a bad format, an exception would have been thrown. For example, the format given above in the read date converter is 'Y-m-d H:i:s', so a create_date like '2014 09 14 12h36m52s' is not correct.

Date converter

This section will be written later.

Add callbacks before or after hydration process

This section will be written later.

Customize getters and setters

DataMapper automatically recognize getter (or isser or haser) and setter of a field.

To retrieve the corresponding getter, DataMapper look in order at:

You also can specify corresponding getters/setters:

Hydrate nested objects

This section will be written later.

Configure a php object hydrator instead of using a mapping configuration

This section will be written later.

Work with object complex to create, like service

This section will be written later.

Work with other mapping configuration format

This section will be written later.

Outer mapping configuration format

This section will be written later.

Inner mapping configuration format

This section will be written later.

Improve persistance ignorance

This section will be written later.

Choose a mapping configuration at runtime

You can use the same model with various mapping configuration but you must work with one of the outer mapping configuration and not with mapping embedded in the object. So 'yaml_file' or 'php_file' are correct mapping format but 'annotations', 'inner_php' or 'inner_yaml' are bad format.

A english data source with the mapping in yaml:

A french data source with the mapping in yaml:

And imagine we've got a spanish data source with the mapping in a php format.

Bind a mapping configuration to a property especially

Note that you can have value objects which contains value objects and so on. And each value object can use it's own mapping configuration format.

Bind a source to a property or a set of properties / hydrate object from multi-sources, multi-orm

Data source

Method arguments

This section will be written later.

Lazy loading

Below, we load properties "bestShop" and "keyboard" only when we use it.

Source store

Given this code:

We can remove the duplication:

Fallback source

Here, sourceB replace sourceA if its not stable:

Or:

Bad return values could be: "null", "false", "emptyString" or "emptyArray".

Processor

Or:

Depends

depends contains sources of which depends an other source. It's usefull when you need to ensures that a property is already available in a zone.

This section will be completed later.

Work with relations

This section will be written later.

How to have DataMapper/ResultBuilder ignorance in the client code

This section will be written later.

Use expression language

This section will be written later.

Basic usage of expression language

This section will be written later.

Add a function provider

This section will be written later.

Object listener

This section will be written later.

Add a custom mapping configuration format

This section will be written later.

Inherit mapping configuration

This section will be written later.

Component configuration reference

(1) availables types are annotations, yaml_file, php_file, inner_php, inner_yaml. And maybe others if you add some custom mapping loaders.

Mapping configuration reference

Config config

Annotation format:

Yaml format:

Php format:

CustomHydrator config

Annotation format:

Yaml format:

Php format:

The methods prototype:

DataSource config

Annotation format:

Yaml format:

Php format:

To know more about the "Method config" usage, please see its dedicated documentation "Method config".

DataSourcesStore config

Annotation format:

Yaml format:

Php format:

To know more about the "Method config" usage, please see its dedicated documentation "Method config".

ExcludeImplicitSource config

Annotation format:

Yaml format:

Php format:

Field config

Annotation format:

Yaml format:

Php format:

Getter config

Annotation format:

Yaml format:

Php format:

Id config

Annotation format:

Yaml format:

Php format:

IdCompositePart config

Annotation format:

Yaml format:

Php format:

Listeners config

Annotation format:

Yaml format:

Php format:

Method config

Annotation format:

Yaml format:

Php format:

Object config

Annotation format:

Yaml format:

Php format:

ObjectListeners config - DEPRECATED - SEE Listeners Config

Annotation format:

Yaml format:

Php format:

PostExtract config - DEPRECATED - SEE Listeners Config

Deprecated. Use Listeners config instead.

Annotation format:

Yaml format:

Php format:

PostHydrate config - DEPRECATED - SEE Listeners Config

Deprecated. Use Listeners config instead.

Annotation format:

Yaml format:

Php format:

PreExtract config - DEPRECATED - SEE Listeners Config

Deprecated. Use Listeners config instead.

Annotation format:

Yaml format:

Php format:

PreHydrate config - DEPRECATED - SEE Listeners Config

Deprecated. Use Listeners config instead.

Annotation format:

Yaml format:

Php format:

Provider config - DEPRECATED - SEE DataSource Config

Deprecated. Use DataSource config instead. Configuration is the same as DataSource.

ProvidersStore config - DEPRECATED - SEE DataSourcesStore Config

Deprecated. Use DataSourcesStore config instead. Configuration is the same as DataSourceStore.

RefImplicitSource config

Annotation format:

Yaml format:

Php format:

RefSource config

Annotation format:

Yaml format:

Php format: php use Kassko\DataMapper\Annotation as DM;

class SomeClass { /**

/**

class SomeClass { /**

class ValueObject { /**

class SomeClass { /**

========================================


All versions of data-mapper with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
kassko/class-resolver Version ^1.0
doctrine/common Version ^2.4|^3.0
symfony/config Version ^2.5|^3.0|^4.0|^5.0
symfony/event-dispatcher Version ^2.4|^3.0|^4.0|^5.0
symfony/expression-language Version ^2.4|^3.0|^4.0|^5.0
symfony/yaml Version ^2.5|^3.0|^4.0|^5.0
zendframework/zend-stdlib Version ^2.3|^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kassko/data-mapper contains the following files

Loading the files please wait ....