yii

How do I run PHPUnit Selenium tests over a ssh connection?

I'm using the yii framework and trying to get its unit tests running while connected over ssh on a CentOS server. When I run phpunit, it tries to launch Firefox, which fails with the error "no display specifiied" ...

Modifying a model attribute won't make it to the DB in Yii's CActiveRecord::beforeSave()

I'm implementing HTML sanitization for form fields, on the beforeSave() method of a model. But it doesn't work. Example: public function beforeSave() { $this->anAttribute = 'somevalue'; var_dump( $this->anAttribute ); } somevalue is actually outputted, but it never gets to the DB, so in between beforeSave() and save() the value is l...

In MySQL, is it faster to delete and then insert or is it faster to update existing rows?

First of all, let me just say that I'm using the PHP framework Yii, so I'd like to stay within its defined set of SQL statement if possible. I know I could probably create one huge long SQL statement that would do everything, but I'd rather not go there. OK, imagine I have a table Users and a table FavColors. Then I have a form where us...

How to make criteria with complex query in Yii framework?

I have query like this: SELECT * FROM activity WHERE (((userId = 1 OR userId IN(SELECT userId FROM follower WHERE followerId = 1)) AND activityType IN(1, 2, 3)) OR (targetId = 24 AND aType IN(1, 2, 3, 4, 5))) ORDER BY id DESC; I have try to use model()->findAllBySql($sql) and it works. But I want to make it using CDbCriteria, if you h...

Call function in another controller in Yii

I've created 2 controllers in my Yii application: FirstController.php and SecondController.php in default controller path. FirstController.php: <?php class FirstController extends Controller { public static function returnFunc() { return 'OK'; } } SecondController.php: <?php class SecondController extends Controller { public f...

Wrong return url in Yii framework

I have used Yii::app()->user->returnUrl but it always redirect me to localhost/index.php. Is there any particular configuration or some pieces of code that other programs that I must write? If you have another solutions let me know it. ...

extension question,YiiFramework

I use the module user http://yiiframework.com/extension/yii-user/ then open localhost/testdrive and get an error - trying to get property of non-object on line - array('url'=>Yii::app()->getModule('user')->loginUrl, did everything according to instructions from the link ...