There's my code:
$data = self::query() ->columns('Raise\Basic\Models\Product.*,c.cat_name') ->leftJoin('Raise\Basic\Models\Category','c.cat_id=Raise\Basic\Models\Product.cat_id','c') ->orderBy('Raise\Basic\Models\Product.sort ASC') ->execute(); it's work;
when i not write namespace like this
$data = self::query() ->columns('Product.*,c.cat_name') ->leftJoin('Category','c.cat_id=Product.cat_id','c') ->orderBy('Product.sort ASC') ->execute();
it's not work!
this is my model code:
namespace Raise\Basic\Models;
class Product extends BaseModel {
/** * * @var integer */ public $pr_id; /** * * @var string */ public $pr_name; /** * * @var integer */ public $cat_id; /** * * @var double */ public $min_price; /** * * @var double */ public $max_price; /** * * @var double */ public $max_deduct_rate; /** * * @var double */ public $max_deduct_price; /** * * @var integer */ public $sort; /** * * @var integer */ public $add_time; public static function loadList() { $data = self::query() ->columns('Raise\Basic\Models\Product.*,c.cat_name') ->leftJoin('Raise\Basic\Models\Category','c.cat_id=Raise\Basic\Models\Product.cat_id','c') ->orderBy('Raise\Basic\Models1\Product.sort ASC') ->execute(); //return self::getPages($data,20); } public function getSource() { return $this->prefix.'product'; }
public static function model($className = CLASS) { return parent::model($className); }
}