Skip to content

AbstractDbMapper and ClassMethods hydrator #70

@n1te1337

Description

@n1te1337

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions