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

Added composite hydrator naming strategy #6367

Conversation

ojhaujjwal
Copy link
Contributor

This naming strategy allows us to use different naming strategy for different property.

*
* @param string $name The name of the naming strategy to get.
*
* @throws \Zend\Stdlib\Exception\InvalidArgumentException
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@throws Exception\InvalidArgumentException

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@malukenho
Copy link
Member

I think this PR need to be rebased.

@adamlundrigan
Copy link
Contributor

@ojhaujjwal could you add a blurb to the documentation about how to use this?

* @throws Exception\InvalidArgumentException
* @return NamingStrategyInterface
*/
public function get($name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would get rid of all these getters/setters as per discussion on the other PRs :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I will!

@Ocramius
Copy link
Member

Re-checked this: needs to be refactored in following API IMO:

final class CompositeNamingStrategy
{
    public function __construct(array $strategies, NamingStrategyInterface $defaultStrategy = null) { /* ... */ }

    public function hydrate(...) { /**/ }
    public function extract(...) { /**/ }
}

* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2015 ;)

@ojhaujjwal ojhaujjwal force-pushed the feature/composite-hydrator-naming-strategy branch 2 times, most recently from 9aa4ea2 to b3ac9fa Compare January 3, 2015 03:32
@ojhaujjwal ojhaujjwal force-pushed the feature/composite-hydrator-naming-strategy branch from b3ac9fa to 76dc234 Compare January 3, 2015 03:33
@ojhaujjwal
Copy link
Contributor Author

@Ocramius Done!

Ocramius added a commit that referenced this pull request Jan 3, 2015
Ocramius added a commit that referenced this pull request Jan 3, 2015
Ocramius added a commit that referenced this pull request Jan 3, 2015
Ocramius added a commit that referenced this pull request Jan 3, 2015
Ocramius added a commit that referenced this pull request Jan 3, 2015
…`defaultNamingStrategy` if no strategy was found
Ocramius added a commit that referenced this pull request Jan 3, 2015
Ocramius added a commit that referenced this pull request Jan 3, 2015
Ocramius added a commit that referenced this pull request Jan 3, 2015
Ocramius added a commit that referenced this pull request Jan 3, 2015
@Ocramius
Copy link
Member

Ocramius commented Jan 3, 2015

@ojhaujjwal merged, thanks! Please note that I also introduced a new IdentityNamingStrategy to simplify this logic on merge.

develop 688f5c1

@Ocramius Ocramius closed this Jan 3, 2015
@ojhaujjwal
Copy link
Contributor Author

@Ocramius 👍

gianarb pushed a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
gianarb pushed a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
gianarb pushed a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
gianarb pushed a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
gianarb pushed a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
gianarb pushed a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
… as a default value for the `$defaultNamingStrategy`
gianarb pushed a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
gianarb pushed a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
… logic by always using the `defaultNamingStrategy` if no strategy was found
gianarb pushed a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
gianarb pushed a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
gianarb pushed a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
gianarb pushed a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants