2017 © Pedro Peláez
 

symfony-bundle data-mapper-bundle

Allow mapping data to models

image

troytft/data-mapper-bundle

Allow mapping data to models

  • Friday, July 20, 2018
  • by Troytft
  • Repository
  • 4 Watchers
  • 9 Stars
  • 3,717 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 23 Versions
  • 10 % Grown

The README.md

Data Mapper Bundle

[DEPRECATED] Project is closed, for new applications should use https://github.com/troytft/rest-api-bundle, (*1)

Installation

Install using Composer:, (*2)

composer require troytft/data-mapper-bundle

Add the bundle to your AppKernel.php:, (*3)

``` php $bundles = array( // ... new Troytft\DataMapperBundle\DataMapperBundle(), );, (*4)


## Usage Model: ``` php <?php namespace Common\Model; use Common\Constraint as AppAssert; use Symfony\Component\Validator\Constraints as Assert; use Troytft\DataMapperBundle\Annotation\DataMapper; class PostsFilter { /** * @DataMapper(type="string") */ protected $query; /** * @DataMapper(type="entity", options={"class": "CommonBundle:City"}) * @Assert\NotBlank */ protected $city; /** * @return mixed */ public function getCity() { return $this->city; } /** * @param mixed $value */ public function setCity($value) { $this->city = $value; return $this; } /** * @return string */ public function getQuery() { return $this->query; } /** * @param string $value */ public function setQuery($value) { $this->query = $value; return $this; } }

Controller: ``` php public function handleRequest($model, $clearMissing = true, $groups = ['Default'], $validationGroups = ['Default']) { /** @var Request $request */ $request = $this->get('request'); $data = $request->getRealMethod() == 'GET' ? $request->query->all() : $request->request->all();, (*5)

    /** @var DataMapperManager $manager */
    $manager = $this->get('data_mapper.manager');

    return $manager
        ->setGroups($groups)
        ->setValidationGroups($validationGroups)
        ->setIsClearMissing($clearMissing)
        ->handle($model, $data);
}

```, (*6)

The Versions

24/04 2018

dev-fix-array-of-datetime

dev-fix-array-of-datetime

Allow mapping data to models

  Sources   Download

MIT

The Requires

 

The Development Requires

24/04 2018

dev-php7.2

dev-php7.2

Allow mapping data to models

  Sources   Download

MIT

The Requires

 

The Development Requires

20/04 2018

2.4.0

2.4.0.0

Allow mapping data to models

  Sources   Download

MIT

The Requires

 

The Development Requires

20/04 2018

2.3.0

2.3.0.0

Allow mapping data to models

  Sources   Download

MIT

The Requires

 

The Development Requires

28/02 2018

2.2.0

2.2.0.0

Allow mapping data to models

  Sources   Download

MIT

The Requires

 

The Development Requires

27/02 2018

2.1.0

2.1.0.0

Allow mapping data to models

  Sources   Download

MIT

The Requires

 

The Development Requires

20/11 2017

2.0.4

2.0.4.0

Allow mapping data to models

  Sources   Download

MIT

The Requires

 

The Development Requires

20/11 2017

2.0.3

2.0.3.0

Allow mapping data to models

  Sources   Download

MIT

The Requires

 

The Development Requires

24/10 2017

2.0.2

2.0.2.0

Allow mapping data to models

  Sources   Download

MIT

The Requires

 

The Development Requires

20/10 2017

2.0.1

2.0.1.0

Allow mapping data to models

  Sources   Download

MIT

The Requires

 

The Development Requires

18/08 2017

2.0.0

2.0.0.0

Allow mapping data to models

  Sources   Download

MIT

The Requires

 

The Development Requires

08/06 2017

1.5.0

1.5.0.0

Allow mapping data to models

  Sources   Download

MIT

The Requires

 

The Development Requires

03/04 2017

1.4.0

1.4.0.0

Allow mapping data to models

  Sources   Download

MIT

The Requires

 

The Development Requires

24/03 2017

1.3.1

1.3.1.0

Allow mapping data to models

  Sources   Download

MIT

The Requires

 

The Development Requires

24/03 2017

1.3.0

1.3.0.0

Allow mapping data to models

  Sources   Download

MIT

The Requires

 

The Development Requires

27/02 2017

1.1.0

1.1.0.0

Allow mapping data to models

  Sources   Download

MIT

The Requires

 

18/04 2016

0.0.3

0.0.3.0

Allow mapping data to models

  Sources   Download

MIT

The Requires