public function addDatabase($db)
    {
        if ($db instanceof Database) {
            $db->setAppData($this);
            if ($db->getPlatform() === null) {
                if ($config = $this->getGeneratorConfig()) {
                    $pf = $config->getConfiguredPlatform(null, $db->getName());
                    $db->setPlatform($pf ? $pf : $this->platform);
                } else {
                    $db->setPlatform($this->platform);
                }
            }
            $this->dbList[] = $db;

            return $db;
        } else {
            // XML attributes array / hash
            $d = new Database();
            $d->setAppData($this);
            $d->loadFromXML($db);

            return $this->addDatabase($d); // calls self w/ different param type
        }
    }
public function addDatabase($db)
    {
        if ($db instanceof Database) {
            $db->setAppData($this);
            if ($db->getPlatform() === null) {
                if ($config = $this->getGeneratorConfig()) {
                    $pf = $config->getConfiguredPlatform(null, $db->getName());
                    $db->setPlatform($pf ? $pf : $this->platform);
                } else {
                    $db->setPlatform($this->platform);
                }
            }
            $this->dbList[] = $db;

            return $db;
        } else {
            // XML attributes array / hash
            $d = new Database();
            $d->setAppData($this);
            $d->loadFromXML($db);

            return $this->addDatabase($d); // calls self w/ different param type
        }
    }
public function addDatabase ( $ db ) { if ( $ db instanceof Database ) { $ db -> setAppData ( $ this ) ; if ( $ db -> getPlatform ( ) === null ) { if ( $ config = $ this -> getGeneratorConfig ( ) ) { $ pf = $ config -> getConfiguredPlatform ( null , $ db -> getName ( ) ) ; $ db -> setPlatform ( $ pf ? $ pf : $ this -> platform ) ; } else { $ db -> setPlatform ( $ this -> platform ) ; } } $ this -> dbList [ ] = $ db ; return $ db ; } else { // XML attributes array / hash $ d = new Database ( ) ; $ d -> setAppData ( $ this ) ; $ d -> loadFromXML ( $ db ) ; return $ this -> addDatabase ( $ d ) ; // calls self w/ different param type } }
Add a database to the list and sets the AppData property to this
AppData

@param Database|string $db the database to add

@return Database
Add a database to the list and sets the AppData property to this AppData