protected function packageDataModels()
    {
        static $packagedDataModels;

        if (is_null($packagedDataModels)) {

            $dataModels = $this->getDataModels();
            $dataModel = array_shift($dataModels);
            $packagedDataModels = array();

            $platform = $this->getGeneratorConfig()->getConfiguredPlatform();

            foreach ($dataModel->getDatabases() as $db) {
                foreach ($db->getTables() as $table) {
                    $package = $table->getPackage();
                    if (!isset($packagedDataModels[$package])) {
                        $dbClone = $this->cloneDatabase($db);
                        $dbClone->setPackage($package);
                        $ad = new AppData($platform);
                        $ad->setGeneratorConfig($this->getGeneratorConfig());
                        $ad->setName($dataModel->getName());
                        $ad->addDatabase($dbClone);
                        $packagedDataModels[$package] = $ad;
                    }
                    $packagedDataModels[$package]->getDatabase($db->getName())->addTable($table);
                }
            }
        }

        return $packagedDataModels;
    }
protected function packageDataModels()
    {
        static $packagedDataModels;

        if (is_null($packagedDataModels)) {

            $dataModels = $this->getDataModels();
            $dataModel = array_shift($dataModels);
            $packagedDataModels = array();

            $platform = $this->getGeneratorConfig()->getConfiguredPlatform();

            foreach ($dataModel->getDatabases() as $db) {
                foreach ($db->getTables() as $table) {
                    $package = $table->getPackage();
                    if (!isset($packagedDataModels[$package])) {
                        $dbClone = $this->cloneDatabase($db);
                        $dbClone->setPackage($package);
                        $ad = new AppData($platform);
                        $ad->setGeneratorConfig($this->getGeneratorConfig());
                        $ad->setName($dataModel->getName());
                        $ad->addDatabase($dbClone);
                        $packagedDataModels[$package] = $ad;
                    }
                    $packagedDataModels[$package]->getDatabase($db->getName())->addTable($table);
                }
            }
        }

        return $packagedDataModels;
    }
protected function packageDataModels ( ) { static $ packagedDataModels ; if ( is_null ( $ packagedDataModels ) ) { $ dataModels = $ this -> getDataModels ( ) ; $ dataModel = array_shift ( $ dataModels ) ; $ packagedDataModels = array ( ) ; $ platform = $ this -> getGeneratorConfig ( ) -> getConfiguredPlatform ( ) ; foreach ( $ dataModel -> getDatabases ( ) as $ db ) { foreach ( $ db -> getTables ( ) as $ table ) { $ package = $ table -> getPackage ( ) ; if ( ! isset ( $ packagedDataModels [ $ package ] ) ) { $ dbClone = $ this -> cloneDatabase ( $ db ) ; $ dbClone -> setPackage ( $ package ) ; $ ad = new AppData ( $ platform ) ; $ ad -> setGeneratorConfig ( $ this -> getGeneratorConfig ( ) ) ; $ ad -> setName ( $ dataModel -> getName ( ) ) ; $ ad -> addDatabase ( $ dbClone ) ; $ packagedDataModels [ $ package ] = $ ad ; } $ packagedDataModels [ $ package ] -> getDatabase ( $ db -> getName ( ) ) -> addTable ( $ table ) ; } } } return $ packagedDataModels ; }
Packages the datamodels to one datamodel per package

This applies only when the the packageObjectModel option is set. We need to
re-package the datamodels to allow the database package attribute to control
which tables go into which SQL file.

@return array The packaged datamodels
Packages the datamodels to one datamodel per package