New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] additional fields in select query #83
Comments
Thank you for this contribution.
Since ORM uses setters to assign values to object members, why not go through such a solution: class User {
...
private function updateFullname(){
$this->fullname = $this->firstname . ' ' . $this->lastname;
$this->_rest['fullname'] = $this->fullname;
}
public function setFirstname($firstname) {
$this->firstname = $firstname;
$this->updateFullname();
}
public function setLastname($lastname) {
$this->lastname = $lastname;
$this->updateFullname();
}
} or we would need to add a Transformer on the models, but this doesn't exist yet... |
What I mentioned in previous post was a simple example query of what I meant. What a bout formula field, or |
If we compare the query to php processing, in a raw query context: yes
It would be less time-consuming if it was done on UQueries, such as Doctrine with DQL I'll do some tests (not right now I'm working on something else), and I'll keep you informed. |
@parsfanavar hi, i hope you are doing well. |
@UlasSAYGINIM I think the DAOPreparedQueries should do that. Since these objects are stored, it is possible to add mapping information to them. In practiceDAO::prepareGetAll('users',\models\User::class);
DAO::getPrepared('users')->addMember('CONCAT(firstname," ",lastname)','fullname');
$users=DAO::executePrepared('users');//each user will have a fullname additional member Concerned classes:
|
How can add additional field in select query which include its value to object properties (_rest)
select table.*, concat(firstname," ",lastname) as fullname
The text was updated successfully, but these errors were encountered: