Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractDbMapper and ClassMethods hydrator #70

Open
n1te1337 opened this issue Feb 16, 2014 · 1 comment
Open

AbstractDbMapper and ClassMethods hydrator #70

n1te1337 opened this issue Feb 16, 2014 · 1 comment

Comments

@n1te1337
Copy link

In AbstractDbMapper the ClassMethods hydrator can be instantiated in two places in initialize()

    protected function initialize()
    {
        if ($this->isInitialized) {
            return;
        }

        if (!$this->dbAdapter instanceof Adapter) {
            throw new \Exception('No db adapter present');
        }

        if (!$this->hydrator instanceof HydratorInterface) {
            $this->hydrator = new ClassMethods;
        }

        if (!is_object($this->entityPrototype)) {
            throw new \Exception('No entity prototype set');
        }

        $this->isInitialized = true;
    }

and in getHydrator()

    public function getHydrator()
    {
        if (!$this->hydrator) {
            $this->hydrator = new ClassMethods(false);
        }
        return $this->hydrator;
    }

What's the reason behind having ClassMethods instantiated in initialize() with $underscoreSeparatedKeys = true(default) and having it in getHydrator() instantiated $underscoreSeparatedKeys = false?

@adamlundrigan
Copy link
Contributor

That's definitely a mistake. Class likely should be updated to use the getter everywhere and remove the hydrator init code from initialize()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants