public static function PopulateOrderViewModel($order) { $model = new OrderViewModel(); $model->id = $order->order_id; $model->account_id = $order->account_id; $model->branch = BranchService::GetById($order->branch_id)->name; $model->date_order = $order->date_order->format('Y-m-d H:i:s'); $model->status_id = Statusorder::find(['statusorder_id' => $order->statusorder_id])->name; return $model; }
public static function GetByName($statusName) { return Statusorder::find(array('name' => $statusName)); }