Last active
December 23, 2015 10:19
-
-
Save akanehara/6621103 to your computer and use it in GitHub Desktop.
Yiiのアクティブレコード。問い合わせ上で導出できる論理属性の追加はこれじゃだめ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @property float $x_of_pos | |
* @property float $y_of_pos | |
*/ | |
class GlobalPosition | |
{ | |
public $x_of_pos; | |
public $y_of_pos; | |
public function beforeFind() | |
{ | |
parent::beforeFind(); | |
$criteria = new CDbCriteria(); | |
$criteria->select = "x(pos) AS x_of_pos, y(pos) AS y_of_pos"; | |
$this->dbCriteria->mergeWith($criteria); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
これ自体を直接findするときには問題ないけど、リレーションを辿ると機能しない。