Bouncy Melons 0.2
declarative style orm
view-model-base.php
Go to the documentation of this file.
1 <?php
2 namespace bm\example;
3 /*
4  * lists and singles are working with data only
5  * but in real world applications, we need to
6  * display this data and to connect data lists
7  * betwean each other
8  */
9 class VBrand extends \bm\VModel {
10 
11  /*
12  * we need to tell the system, which data list we will use
13  */
14  public function createList() {
15  return new Brands();
16  }
17 
18  /*
19  * to identify this vmodel among others we need slug
20  * by default lowercased class name will be used
21  */
22  public static function getSlug() {
23  return 'brands';
24  }
25 
26  /*
27  * @return human readable title
28  */
29  public function getTitle() {
30  return "Wine brands";
31  }
32 
33  public function isEditable() {
34  return true;
35  }
36 
37  public function getEditLink($single) {
38  return \vihv\Url::getSiteUrl()."/".self::getSlug()."/edit/".$single->getId();
39  }
40 
41 
42  /*
43  * see \bm\VModel documentation for full list of possible methods
44  */
45 }
46