Answer the question
In order to leave comments, you need to log in
How to create a table based on an existing yii2?
Hello. I am making an API for a web application, but in the original table in the database, one field is rather poorly arranged (consists of several important parts, and I didn’t need to change it), and for convenience, I divided it into parts in PHP code (split by commas , brackets, periods, etc.), while creating additional fields in ActiveRecord for these parts.
public function getAtt4(){
return $this->fields[3];
}
public function getAttr3(){
return $this->fields[2];
}
public function getAttr2(){
return $this->fields[1];
}
public function getAttr1(){
return $this->fields[0];
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question