Ubiquity  2.0.3
php rapid development framework
DbExport.php
Go to the documentation of this file.
1 <?php
2 namespace Ubiquity\db\export;
3 
7 
8 class DbExport{
9  protected $manyToManys=[];
10 
11  public function __construct(){
12 
13  }
14 
15  public function exports(){
16  $result=[];
17  $config=Startup::getConfig();
18  $models=CacheManager::getModels($config,true);
19  foreach ($models as $model){
20  $tableExport=new TableExport($model);
21  $result[]=$tableExport->exports($this);
22  }
23  foreach ($this->manyToManys as $target=>$ManyToManyParser){
24  $ManyToManyParser->init();
25  $sqlExport=new SqlExport();
26  $fields=[$ManyToManyParser->getFkField(),$ManyToManyParser->getMyFkField()];
27  $result[]=$sqlExport->exports($target,$fields);
28  }
29  return \implode("\n", $result);
30  }
31 
32  public function addManyToMany($jointable,$memberTargetEntity){
33  if(!isset($this->manyToManys[$jointable])){
34  $this->manyToManys[$jointable]=new ManyToManyParser($memberTargetEntity["class"], $memberTargetEntity["member"]);
35  }
36  }
37 }
static getModels(&$config, $silent=false)
addManyToMany($jointable, $memberTargetEntity)
Definition: DbExport.php:32