Skip to content
This repository has been archived by the owner on Jan 24, 2020. It is now read-only.

Commit

Permalink
Renamed repository to doctrine-zend-hydrator and changed namespace ac…
Browse files Browse the repository at this point in the history
…cordingly
  • Loading branch information
michalbundyra committed Jan 25, 2019
1 parent 58e4461 commit bd2cdf5
Show file tree
Hide file tree
Showing 30 changed files with 80 additions and 80 deletions.
60 changes: 30 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# zend-doctrine-hydrator
# doctrine-zend-hydrator

[![Build Status](https://travis-ci.org/webimpress/zend-doctrine-hydrator.svg?branch=master)](https://travis-ci.org/webimpress/zend-doctrine-hydrator)
[![Coverage Status](https://coveralls.io/repos/github/webimpress/zend-doctrine-hydrator/badge.svg?branch=master)](https://coveralls.io/github/webimpress/zend-doctrine-hydrator?branch=master)
[![Build Status](https://travis-ci.org/webimpress/doctrine-zend-hydrator.svg?branch=master)](https://travis-ci.org/webimpress/doctrine-zend-hydrator)
[![Coverage Status](https://coveralls.io/repos/github/webimpress/doctrine-zend-hydrator/badge.svg?branch=master)](https://coveralls.io/github/webimpress/doctrine-zend-hydrator?branch=master)

This library provides Doctrine Hydrators for Zend Framework application.

Expand All @@ -10,7 +10,7 @@ This library provides Doctrine Hydrators for Zend Framework application.
Run the following to install this library:

```bash
$ composer require webimpress/zend-doctrine-hydrator
$ composer require webimpress/doctrine-zend-hydrator
```

## Usage
Expand All @@ -32,7 +32,7 @@ To create a Doctrine Hydrator, you just need one thing: an object manager (also
or Document Manager in Doctrine ODM):

```php
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;

$hydrator = new DoctrineHydrator($objectManager);
```
Expand Down Expand Up @@ -88,7 +88,7 @@ class City
Now, let's use the Doctrine hydrator:

```php
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;

$hydrator = new DoctrineHydrator($entityManager);
$city = new City();
Expand Down Expand Up @@ -152,7 +152,7 @@ class Appointment
Let's use the hydrator:

```php
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;

$hydrator = new DoctrineHydrator($entityManager);
$appointment = new Appointment();
Expand Down Expand Up @@ -295,7 +295,7 @@ DoctrineHydrator natively supports both cases.
When the association's entity already exists, all you need to do is simply give the identifier of the association:

```php
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;

$hydrator = new DoctrineHydrator($entityManager);
$blogPost = new BlogPost();
Expand Down Expand Up @@ -338,7 +338,7 @@ $data = [
If the association's entity does not exist, you just need to give the object:

```php
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;

$hydrator = new DoctrineHydrator($entityManager);
$blogPost = new BlogPost();
Expand Down Expand Up @@ -389,7 +389,7 @@ be hydrated before it is passed to the BlogPost entity.
**NOTE** : you're not really allowing users to be added via a blog post, are you?

```php
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;

$hydrator = new DoctrineHydrator($entityManager, 'Application\Entity\BlogPost');
$blogPost = new BlogPost();
Expand Down Expand Up @@ -565,7 +565,7 @@ Once again, two cases may arise: the tags already exist or they do not.
When the association's entity already exists, what you need to do is simply give the identifiers of the entities:

```php
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;

$hydrator = new DoctrineHydrator($entityManager);
$blogPost = new BlogPost();
Expand Down Expand Up @@ -609,7 +609,7 @@ $data = [
If the association's entity does not exist, you just need to give the object:

```php
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;

$hydrator = new DoctrineHydrator($entityManager);
$blogPost = new BlogPost();
Expand Down Expand Up @@ -678,14 +678,14 @@ The hydrator will check whether the setCity() method on the Entity allows null v

By default, every collections association has a special strategy attached to it that is called during the hydrating
and extracting phase. All those strategies extend from the class
`Zend\Doctrine\Hydrator\Strategy\AbstractCollectionStrategy`.
`Doctrine\Zend\Hydrator\Strategy\AbstractCollectionStrategy`.

The library provides four strategies out of the box:

1. `Zend\Doctrine\Hydrator\Strategy\AllowRemoveByValue`: this is the default strategy, it removes old elements that are not in the new collection.
2. `Zend\Doctrine\Hydrator\Strategy\AllowRemoveByReference`: this is the default strategy (if set to byReference), it removes old elements that are not in the new collection.
3. `Zend\Doctrine\Hydrator\Strategy\DisallowRemoveByValue`: this strategy does not remove old elements even if they are not in the new collection.
4. `Zend\Doctrine\Hydrator\Strategy\DisallowRemoveByReference`: this strategy does not remove old elements even if they are not in the new collection.
1. `Doctrine\Zend\Hydrator\Strategy\AllowRemoveByValue`: this is the default strategy, it removes old elements that are not in the new collection.
2. `Doctrine\Zend\Hydrator\Strategy\AllowRemoveByReference`: this is the default strategy (if set to byReference), it removes old elements that are not in the new collection.
3. `Doctrine\Zend\Hydrator\Strategy\DisallowRemoveByValue`: this strategy does not remove old elements even if they are not in the new collection.
4. `Doctrine\Zend\Hydrator\Strategy\DisallowRemoveByReference`: this strategy does not remove old elements even if they are not in the new collection.

As a consequence, when using `AllowRemove*`, you need to define both adder (eg. addTags) and remover (eg. removeTags).
On the other hand, when using the `DisallowRemove*` strategy, you must always define at least the adder, but the remover
Expand All @@ -708,8 +708,8 @@ remove elements directly from the collection.
Changing the strategy for collections is plain easy.

```php
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Zend\Doctrine\Hydrator\Strategy;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\Strategy;

$hydrator = new DoctrineHydrator($entityManager);
$hydrator->addStrategy('tags', new Strategy\DisallowRemoveByValue());
Expand All @@ -728,7 +728,7 @@ and hence bypass any logic you may include in your setters/getters).
To change the behaviour, just give the second parameter of the constructor to false:

```php
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;

$hydrator = new DoctrineHydrator($objectManager, false);
```
Expand Down Expand Up @@ -762,7 +762,7 @@ class SimpleEntity
Let's now use the hydrator using the default method, by value:

```php
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;

$hydrator = new DoctrineHydrator($objectManager);
$object = new SimpleEntity();
Expand All @@ -778,7 +778,7 @@ As we can see here, the hydrator used the public API (here getFoo) to retrieve t
However, if we use it by reference:

```php
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;

$hydrator = new DoctrineHydrator($objectManager, false);
$object = new SimpleEntity();
Expand Down Expand Up @@ -964,7 +964,7 @@ namespace Application\Form;

use Application\Entity\Tag;
use Doctrine\Common\Persistence\ObjectManager;
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
use Zend\Form\Fieldset;
use Zend\InputFilter\InputFilterProviderInterface;

Expand Down Expand Up @@ -1012,7 +1012,7 @@ namespace Application\Form;

use Application\Entity\BlogPost;
use Doctrine\Common\Persistence\ObjectManager;
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
use Zend\Form\Fieldset;
use Zend\InputFilter\InputFilterProviderInterface;

Expand Down Expand Up @@ -1068,7 +1068,7 @@ Here is the create form:
namespace Application\Form;

use Doctrine\Common\Persistence\ObjectManager;
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
use Zend\Form\Form;

class CreateBlogPostForm extends Form
Expand Down Expand Up @@ -1098,7 +1098,7 @@ And the update form:
namespace Application\Form;

use Doctrine\Common\Persistence\ObjectManager;
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
use Zend\Form\Form;

class UpdateBlogPostForm extends Form
Expand Down Expand Up @@ -1247,7 +1247,7 @@ namespace Application\Form;

use Application\Entity\User;
use Doctrine\Common\Persistence\ObjectManager;
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
use Zend\Form\Fieldset;
use Zend\InputFilter\InputFilterProviderInterface;

Expand Down Expand Up @@ -1295,7 +1295,7 @@ namespace Application\Form;

use Application\Entity\City;
use Doctrine\Common\Persistence\ObjectManager;
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
use Zend\Form\Fieldset;
use Zend\InputFilter\InputFilterProviderInterface;

Expand Down Expand Up @@ -1353,7 +1353,7 @@ be like this :
namespace Application\Form;

use Doctrine\Common\Persistence\ObjectManager;
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
use Zend\Form\Form;

class EditNameForm extends Form
Expand Down Expand Up @@ -1440,7 +1440,7 @@ EditUserForm :
namespace Application\Form;

use Doctrine\Common\Persistence\ObjectManager;
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
use Zend\Form\Form;

class EditNameForm extends Form
Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "webimpress/zend-doctrine-hydrator",
"name": "webimpress/doctrine-zend-hydrator",
"description": "Doctrine hydrators for Zend Framework applications",
"license": "BSD-2-Clause",
"keywords": [
"zf",
"zendframework",
"doctrine",
"hydrator"
"hydrator",
"zf",
"zendframework"
],
"support": {
"issues": "https://github.com/webimpress/zend-doctrine-hydrator/issues",
"source": "https://github.com/webimpress/zend-doctrine-hydrator",
"rss": "https://github.com/webimpress/zend-doctrine-hydrator/releases.atom"
"issues": "https://github.com/webimpress/doctrine-zend-hydrator/issues",
"source": "https://github.com/webimpress/doctrine-zend-hydrator",
"rss": "https://github.com/webimpress/doctrine-zend-hydrator/releases.atom"
},
"require": {
"php": "^7.1",
Expand All @@ -28,12 +28,12 @@
},
"autoload": {
"psr-4": {
"Zend\\Doctrine\\Hydrator\\": "src/"
"Doctrine\\Zend\\Hydrator\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"ZendTest\\Doctrine\\Hydrator\\": "test/"
"DoctrineTest\\Zend\\Hydrator\\": "test/"
}
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
bootstrap="vendor/autoload.php"
colors="true">
<testsuites>
<testsuite name="zend-doctrine-hydrator">
<testsuite name="doctrine-zend-hydrator">
<directory>./test</directory>
</testsuite>
</testsuites>
Expand Down
6 changes: 3 additions & 3 deletions src/DoctrineObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

declare(strict_types=1);

namespace Zend\Doctrine\Hydrator;
namespace Doctrine\Zend\Hydrator;

use DateTime;
use Doctrine\Common\Inflector\Inflector;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Zend\Hydrator\Strategy\AllowRemoveByReference;
use Doctrine\Zend\Hydrator\Strategy\AllowRemoveByValue;
use InvalidArgumentException;
use RuntimeException;
use Traversable;
use Zend\Doctrine\Hydrator\Strategy\AllowRemoveByReference;
use Zend\Doctrine\Hydrator\Strategy\AllowRemoveByValue;
use Zend\Hydrator\AbstractHydrator;
use Zend\Hydrator\Filter\FilterProviderInterface;
use Zend\Stdlib\ArrayUtils;
Expand Down
2 changes: 1 addition & 1 deletion src/Filter/PropertyName.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Zend\Doctrine\Hydrator\Filter;
namespace Doctrine\Zend\Hydrator\Filter;

use Zend\Hydrator\Filter\FilterInterface;

Expand Down
2 changes: 1 addition & 1 deletion src/Strategy/AbstractCollectionStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Zend\Doctrine\Hydrator\Strategy;
namespace Doctrine\Zend\Hydrator\Strategy;

use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
Expand Down
2 changes: 1 addition & 1 deletion src/Strategy/AllowRemoveByReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Zend\Doctrine\Hydrator\Strategy;
namespace Doctrine\Zend\Hydrator\Strategy;

/**
* When this strategy is used for Collections, if the new collection does not contain elements that are present in
Expand Down
2 changes: 1 addition & 1 deletion src/Strategy/AllowRemoveByValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Zend\Doctrine\Hydrator\Strategy;
namespace Doctrine\Zend\Hydrator\Strategy;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
Expand Down
2 changes: 1 addition & 1 deletion src/Strategy/DisallowRemoveByReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Zend\Doctrine\Hydrator\Strategy;
namespace Doctrine\Zend\Hydrator\Strategy;

/**
* When this strategy is used for Collections, if the new collection does not contain elements that are present in
Expand Down
2 changes: 1 addition & 1 deletion src/Strategy/DisallowRemoveByValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Zend\Doctrine\Hydrator\Strategy;
namespace Doctrine\Zend\Hydrator\Strategy;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
Expand Down
2 changes: 1 addition & 1 deletion test/Assets/ByValueDifferentiatorEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace ZendTest\Doctrine\Hydrator\Assets;
namespace DoctrineTest\Zend\Hydrator\Assets;

class ByValueDifferentiatorEntity
{
Expand Down
2 changes: 1 addition & 1 deletion test/Assets/ContextStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace ZendTest\Doctrine\Hydrator\Assets;
namespace DoctrineTest\Zend\Hydrator\Assets;

use Zend\Hydrator\Strategy\StrategyInterface;

Expand Down
4 changes: 2 additions & 2 deletions test/Assets/DifferentAllowRemoveByReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace ZendTest\Doctrine\Hydrator\Assets;
namespace DoctrineTest\Zend\Hydrator\Assets;

use Zend\Doctrine\Hydrator\Strategy\AllowRemoveByReference;
use Doctrine\Zend\Hydrator\Strategy\AllowRemoveByReference;

class DifferentAllowRemoveByReference extends AllowRemoveByReference
{
Expand Down
4 changes: 2 additions & 2 deletions test/Assets/DifferentAllowRemoveByValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace ZendTest\Doctrine\Hydrator\Assets;
namespace DoctrineTest\Zend\Hydrator\Assets;

use Zend\Doctrine\Hydrator\Strategy\AllowRemoveByValue;
use Doctrine\Zend\Hydrator\Strategy\AllowRemoveByValue;

class DifferentAllowRemoveByValue extends AllowRemoveByValue
{
Expand Down
Loading

0 comments on commit bd2cdf5

Please sign in to comment.