如何为 Phalcon 模型设置 SQL 别名。方法alias()不存在。
我需要的样本:
$modelA = ModelA::query()
->alias('q')
->columns(['q.*','concat(q.id,r.id))
->join('ModelB', 'q.id = r.model_a_id', 'r', 'LEFT');
Run Code Online (Sandbox Code Playgroud)
如何创建q别名?
有人曾经使用过HttpStatus.IM_USED(226 - IM 使用)吗?在什么情况下使用?
我有2节课
class A {
// Do some stuff here!
}
Run Code Online (Sandbox Code Playgroud)
和
class B {
public $class = 'A';
public function getClass(){
//Case 1
$class = $this->class;
return new $class(); //work
//Case 2
return new $this->class(); //NOT work
//or to be precise something like this
return new {$this->class}();
}
// Do some other stuff here!
}
Run Code Online (Sandbox Code Playgroud)
为什么将类属性传递给var工作并直接访问NOT,就像你在上面的类中看到的那样,案例1与案例2?