Bouncy Melons 0.2
declarative style orm
view-model-base.php
<?php
namespace bm\example;
/*
* lists and singles are working with data only
* but in real world applications, we need to
* display this data and to connect data lists
* betwean each other
*/
class VBrand extends \bm\VModel {
/*
* we need to tell the system, which data list we will use
*/
public function createList() {
return new Brands();
}
/*
* to identify this vmodel among others we need slug
* by default lowercased class name will be used
*/
public static function getSlug() {
return 'brands';
}
/*
* @return human readable title
*/
public function getTitle() {
return "Wine brands";
}
public function isEditable() {
return true;
}
public function getEditLink($single) {
return \vihv\Url::getSiteUrl()."/".self::getSlug()."/edit/".$single->getId();
}
/*
* see \bm\VModel documentation for full list of possible methods
*/
}