Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
DbExport.php
Go to the documentation of this file.
1<?php
2
3namespace Ubiquity\db\export;
4
9
20class DbExport {
21 protected $manyToManys = [ ];
22
23 public function __construct() {
24 }
25
26 public function exports() {
27 $result = [ ];
28 $config = Startup::getConfig ();
29 $models = CacheManager::getModels ( $config, true );
30 foreach ( $models as $model ) {
31 $tableExport = new TableExport ( $model );
32 $result [] = $tableExport->exports ( $this );
33 }
34 foreach ( $this->manyToManys as $target => $ManyToManyParser ) {
35 $ManyToManyParser->init ();
36 $sqlExport = new SqlExport ();
37 $members = [ $ManyToManyParser->getFkField (),$ManyToManyParser->getMyFkField () ];
38 $fields = SqlUtils::getFieldList ( $members, $target );
39 $result [] = $sqlExport->exports ( $target, $fields );
40 }
41 return \implode ( "\n", $result );
42 }
43
44 public function addManyToMany($jointable, $memberTargetEntity) {
45 if (! isset ( $this->manyToManys [$jointable] )) {
46 $this->manyToManys [$jointable] = new ManyToManyParser ( $memberTargetEntity ["class"], $memberTargetEntity ["member"] );
47 }
48 }
49}
Manager for caches (Router, Rest, models).
Starts the framework.
Definition Startup.php:19
SQL utilities.
Definition SqlUtils.php:13
static getFieldList($fields, $tableName=false)
Definition SqlUtils.php:135
addManyToMany($jointable, $memberTargetEntity)
Definition DbExport.php:44