Bouncy Melons 0.2
declarative style orm
VModel.php
Go to the documentation of this file.
1 <?php
2 
3 namespace bm;
4 
5 class VModel implements IVModel {
6 
7  protected $bm;
8  protected $list;
9 
14  public function createList() {
15  return new AutoList($this);
16  }
17 
21  public function getListModel() {
22  if(empty($this->list)) {
23  $this->list = $this->createList();
24  }
25  return $this->list;
26  }
27 
28  public function setBm(BouncyMelons $bm) {
29  $this->bm = $bm;
30  }
31 
32  public function getBm() {
33  return $this->bm;
34  }
35 
36  public function getTableName() {
37  $list = $this->getListModel();
38  if($list instanceof AutoList) {
39  return str_replace("\\",".",strtolower(get_class($this)));
40  }
41  return $list->getTableName();
42  }
43 
44  public function getViewName() {
45  return $this->getListModel()->getViewName();
46  }
47 
48  public static function getSlug() {
49  return str_replace("\\",".",strtolower(static::class));
50  }
51 
55  public function readSlug() {
56  return static::getSlug();
57  }
58 
59  public function createViewAs($sql) {
60  return $this->getListModel()->createViewAs($sql);
61  }
62 
63  public function createTemptableAs($sql) {
64  return $this->getListModel()->createTemptableAs($sql);
65  }
66 
67 
68 }
createViewAs($sql)
Definition: VModel.php:59
getListModel()
Definition: VModel.php:21
getTableName()
Definition: VModel.php:36
getViewName()
Definition: VModel.php:44
getBm()
Definition: VModel.php:32
static getSlug()
Definition: VModel.php:48
setBm(BouncyMelons $bm)
Definition: VModel.php:28
createTemptableAs($sql)
Definition: VModel.php:63
readSlug()
Definition: VModel.php:55
createList()
Definition: VModel.php:14