public function testGetDefaultHydrator()
 {
     $options = new NamespaceOptions();
     $this->assertInstanceOf('Zend\\Stdlib\\Hydrator\\ArraySerializable', $options->getHydrator());
     $options = new NamespaceOptions();
     $options->setEntityClass('stdClass');
     $this->assertInstanceOf('Zend\\Stdlib\\Hydrator\\ClassMethods', $options->getHydrator());
 }
Ejemplo n.º 2
0
 /**
  * Adds new namespace
  *
  * @param  array|NamespaceOptionsInterface $namespaceOptions
  * @param  string|null                     $namespace
  * @return void
  */
 public function addNamespace($namespaceOptions, $namespace = null)
 {
     if (!$namespaceOptions instanceof NamespaceOptionsInterface) {
         if (is_array($namespaceOptions)) {
             $namespaceOptions = new NamespaceOptions($namespaceOptions);
             if ($namespace !== null) {
                 $namespaceOptions->setName($namespace);
             }
         } else {
             throw new Exception\InvalidArgumentException(sprintf('%s expects parameter 1 to be array or an instance of HtSettingsModule\\Options\\NamespaceOptionsInterface, %s provided instead', __METHOD__, is_object($namespaceOptions) ? get_class($namespaceOptions) : gettype($namespaceOptions)));
         }
     } else {
         if (!$namespaceOptions->getName() && $namespace) {
             $namespaceOptions->setName($namespace);
         }
     }
     if ($namespace === null) {
         $namespace = $namespaceOptions->getName();
     }
     $this->namespaces[$namespace] = $namespaceOptions;
 }