Category: Yii


Declaration of Symfony\Component\Translation\TranslatorInterface::setLocale($locale) must be compatible with


Declaration of Symfony\Component\Translation\TranslatorInterface::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale) http://pagsoft.com.br/ Isso ocorreu porque dei o comando “composer update” no servidor da aplicação, ele atualizou o framework Symfony para requerir uma versão maior do PHP que o servidor suporta, a solução foi: Editar em: Symfony/translation-contracts/composer.json Para Adicionar em: project/composer.json Por fim, rodar o comando: https://laracasts.com/discuss/channels/laravel/installation-fresh-laravel?page=1#reply=558018

Yii/PostgreSQL: Erro de apóstrofo


yii framework

Recentemente me deparei com um problema de segurança no framework Yii. Quando ao pesquisar por um registro como na grid (zii.widgets.grid.CGridView). “SELECT * FROM tb_pessoa WHERE nome like ‘%Joana d’Arc%'”; A solução foi fazer um bindParam do PDO para tratamento de valores antes de inserir na base de dados: $sql = “SELECT * FROM tb_pessoa […]

Yii Model


yii framework

Yii Model Delete <?php $model=User::model()->findByPk($id); if($model){ $model->delete(); } # OR $model=User::model()->deleteAll(); # OR $model=User::model()->deleteAll(array(“condition”=>”userid=’$id'”)); # OR $mode=User::model()->deleteAll(“status=’A'”); ?> Yii Model Update <?php $model=User::model()->updateByPk( $ID, array(“status”=>’DECLINED’) ); # OR $model=User::model()->updateAll(array( ‘first_name’=>”$firstname”, ’email’=>”$email” ), “UserID=$id and status IS NULL ” ); # OR $model=User::model()->updateAll( array(‘status’ => 1), ‘UserID =’.$userid ); ?>


CDbCommand Yii 1


yii framework

A good practice of programming is to use “statement”, to do CRUD actions in a safe and scalable way. The Yii framework has by default its library for ease of development. SELECT Queryng with the template referencing the primary key: INSERT DELETE


Yii Error: include(Controller.php): failed to open stream: No such file or directory


yii framework

This error occurred because the references to the classes were not equal to the file name, but the application was always installed on Windows Server, which is not “case sensitive “, so it worked. The error appeared from the moment we put it on AWS with a Linux server, which is case sensitive. But to […]


Yii Error: CDbConnection failed to open the DB connection: could not find driver


yii framework

Error: CDbConnection failed to open the DB connection: could not find driver C:\xampp72\htdocs\DEV\project\protected\models\SystemConfiguration.php(50) Solution: In php.ini, enable the configurations according to the base used: extension=mbstringextension=exif ; Must be after mbstring as it depends on itextension=mysqli;extension=oci8_12c ; Use with Oracle Database 12c Instant Client;extension=odbc;extension=openssl;extension=pdo_firebirdextension=pdo_mysql;extension=pdo_oci;extension=pdo_odbcextension=pdo_pgsqlextension=pdo_sqliteextension=pgsql;extension=shmop


Yii Error: permission denied for relation my_table


yii framework

ERROR: permission denied for relation site_adzone This error occurs because you need to give the database user permission. Solution, execute the query: GRANT ALL PRIVILEGES ON TABLE userdb.table_xpto TO userdb;


Yii Error: short tag


yii framework

Error: user->isGuest) { $this->redirect(array(‘login’)); } else { $sqlUser = “SELECT CASE WHEN us.data_senha_date <= now() THEN 1 ELSE 0 END AS ativo FROM database.tb_users as us WHERE us.usuario_id =” . Yii::app()->user->id; $uer = Yii::app()->db->createCommand($sqlUser)->queryRow(); Yii::app()->session[‘webUserExpirado’] = $usuario; if ($usuario[‘ativo’] == 1) { $this->redirect(array(‘usuario/changePassword’, ‘ns’ => 1)); } else { //$array = Yii::app()->session[‘webUserClientesList’]; //print_r(Yii::app()->session[‘webUserPerfil’]); //$array = (Yii::app()->session[‘webUserUFTest’]); //print_r($array[“0”][“uf_sigla”]); //print(Yii::app()->session[‘webUserExpirado’]); //print_r(Yii::app()->session[‘webUserTest’]); […]


Moeda Tipo Valor
Dollar Compra R$ 5,97
Dollar Venda R$ 5,97
Data 22/01/2025

January 2025
S M T W T F S
 1234
567891011
12131415161718
19202122232425
262728293031