public static function testget() { return function ($request, $response) { $brand = Brand::findById($request->id); echo $brand; }; }
public function setBrand($value) { if ($value instanceof Brand) { $this->_orm->brand_id = $value->id; return true; } $brand = Brand::findById($value); if ($brand) { $this->_orm->brand_id = $value; return true; } else { throw new Exception("Brand does not exist"); } }
<?php require "../brand.php"; //$brand = new Brand(); //$brand->name = "Avon Naturals"; //$brand->save(); $brand = Brand::findById(3); echo $brand->products[1]->as_joined_json();