20.11.2014 Views

O Guia Definitivo do Yii 1.1

O Guia Definitivo do Yii 1.1

O Guia Definitivo do Yii 1.1

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

% cd WebRoot/testdrive<br />

% protected/yiic shell<br />

<strong>Yii</strong> Interactive Tool v1.0<br />

Please type 'help' for help. Type 'exit' to quit.<br />

>> model User<br />

generate User.php<br />

The 'User' class has been successfully created in the following file:<br />

D:\wwwroot\testdrive\protected\models\User.php<br />

If you have a 'db' database connection, you can test it now with:<br />

$model=User::model()->find();<br />

print_r($model);<br />

>> crud User<br />

generate UserController.php<br />

mkdir D:/wwwroot/testdrive/protected/views/user<br />

generate create.php<br />

generate update.php<br />

generate list.php<br />

generate show.php<br />

generate admin.php<br />

generate _form.php<br />

Crud 'user' has been successfully created. You may access it via:<br />

http://hostname/path/to/index.php?r=user<br />

Acima, utilizamos o coman<strong>do</strong> yiic shell para interagir com nossa aplicação esqueleto. Na<br />

linha de coman<strong>do</strong>, podemos digitar <strong>do</strong>is subcoman<strong>do</strong>s: model User e crud User. O<br />

primeiro gera a classe modelo para a tabela User, enquanto que o segun<strong>do</strong> coman<strong>do</strong> lê a<br />

classe modelo User e gera o código necessário para as operações <strong>do</strong> tipo CRUD.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!