public function addEntityDirectory($namespace, $directory)
    {
        if (!is_dir($directory)) {
            return;
        }
        $files = new \DirectoryIterator($directory);

        foreach ($files as $file) {
            if ($file->isDir() && !$file->isDot()) {
                $this->addEntityDirectory($namespace.'\\'.basename($file->getPathname()) , $file->getPathname());
                continue;
            }

            if (!$file->isFile()) {
                continue;
            }

            $class = $namespace.'\\'.$file->getBasename('.php');
            $r = new \ReflectionClass($class);
            if ($r->isSubclassOf('ActiveDoctrine\Entity\Entity') && !$r->isAbstract()) {
                $this->addEntityClass($class);
            }
        }
    }