public function merge(Entity $entity, array $raw) { try { $processor = new Processor(); $configuration = $this; $config = $processor->processConfiguration($configuration, array('database' => $raw)); $entity->setUser($config['username']); $entity->setPassword($config['password']); $entity->setPath($config['database']); $entity->setType($config['phptype']); $entity->setMemory($config['memory']); } catch (\Exception $e) { throw new InvalidConfigException($e->getMessage()); } return $entity; }
public function merge(Entity $entity, array $raw) { try { $processor = new Processor(); $configuration = $this; $config = $processor->processConfiguration($configuration, array('database' => $raw)); $entity->setSchema($config['schema']); $entity->setUser($config['username']); $entity->setPassword($config['password']); $entity->setType($config['type']); $entity->setPort($config['port']); $entity->setHost($config['host']); $entity->setCharset($config['charset']); } catch (\Exception $e) { throw new InvalidConfigException($e->getMessage()); } return $entity; }
public function merge(Entity $entity, array $raw) { try { $processor = new Processor(); $configuration = $this; $config = $processor->processConfiguration($configuration, array('database' => $raw)); $entity->setUser($config['username']); $entity->setPassword($config['password']); if ($config['path'] === false && $config['memory'] === false) { throw new InvalidConfigException('Neither path or memory are set one option must be chosen'); } if ($config['path'] === false) { $entity->setMemory($config['memory']); } else { $entity->setPath($config['path']); } $entity->setType($config['type']); } catch (\Exception $e) { throw new InvalidConfigException($e->getMessage()); } return $entity; }
/** * Loads a config Entity * * @access public * @param string $name the file name * @return Entity a config entity */ public function load($name = '', EntityInterface $ent) { if (empty($name)) { $name = self::DEFAULTNAME . self::EXTENSION; } $config_ary = $this->getIo()->load($name, null); //send it to be validated and normalized using out configTree; if ($config_ary === NULL) { return NULL; } else { $ent->setType($config_ary['type']); $ent->setCharset($config_ary['charset']); $ent->setHost($config_ary['host']); $ent->setMemory($config_ary['memory']); $ent->setPassword($config_ary['password']); $ent->setPath($config_ary['path']); $ent->setPort($config_ary['port']); $ent->setSchema($config_ary['schema']); $ent->setUnixSocket($config_ary['socket']); $ent->setUser($config_ary['user']); } return $ent; }