Yii Framework Forum: Visualizzare Sql da ActiveRecord - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Visualizzare Sql da ActiveRecord Rate Topic: -----

#1 User is offline   lcnlcn 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 01-October 14

Posted 20 October 2017 - 12:34 PM

Ciao a tutti è possibile visualizzare l' SQl di un activerecord ottenuto tramite funzioni all(), one(),....
per poter effettuare test?
grazie
0

#2 User is offline   Fabrizio Caldarelli 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,058
  • Joined: 21-March 13
  • Location:Rome, Italy

Posted 20 October 2017 - 03:22 PM

Certo. A partire da un'ActiveQuery (non ActiveRecord), es.

$query = Model::find()->where(....)->....;


Per avere il SQL:

$sql = $query->createCommand()->getRawSql();

Yii2 by example: my book about Yii2
https://www.packtpub...nt/yii2-example
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users