This file contains 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
/** | |
* Пользователь | |
* Без внешного ключа, по этому нет проверки целосности | |
*/ | |
CREATE TABLE IF NOT EXISTS `user` ( | |
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT, | |
`name` VARCHAR(255), | |
`city_id` INT UNSIGNED NOT NULL, | |
PRIMARY KEY `pk_id`(`id`), | |
INDEX `city_id_idx` (`city_id` ASC) -- Индекс. Для быстрой выборки |
This file contains 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 | |
defined('YII_DEBUG') or define('YII_DEBUG', true); | |
defined('YII_ENV') or define('YII_ENV', 'dev'); | |
require(__DIR__ . '/../vendor/autoload.php'); | |
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php'); | |
require(__DIR__ . '/../common/config/bootstrap.php'); | |
require(__DIR__ . '/../frontend/config/bootstrap.php'); | |
$config = yii\helpers\ArrayHelper::merge( |
This file contains 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 | |
return [ | |
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor', | |
'components' => [ | |
'cache' => [ | |
'class' => 'yii\caching\FileCache', | |
], | |
'authManager' => [ | |
'class' => 'yii\rbac\DbManager', | |
], |
This file contains 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
DROP TABLE IF EXISTS `user`; | |
DROP TABLE IF EXISTS `video`; | |
CREATE TABLE IF NOT EXISTS `user` ( | |
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT, | |
`name` VARCHAR(255), | |
`access` TINYINT UNSIGNED, | |
PRIMARY KEY `pk_id`(`id`) | |
) ENGINE = InnoDB; |
This file contains 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
{ | |
// The tab key will cycle through the settings when first created | |
// Visit http://wbond.net/sublime_packages/sftp/settings for help | |
// sftp, ftp or ftps | |
"type": "sftp", | |
"save_before_upload": true, | |
"upload_on_save": true, | |
"sync_down_on_open": true, |
This file contains 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 | |
/** | |
* Я переписал предложенный код в соответствии с моим комментарием ниже и моим видением(учитывая что остального кода, кроме этого фрагмента я не видел) | |
*/ | |
class AnyModel extends SomeBaseModel { | |
/** | |
* AnyModel constructor. | |
* | |
* @param int $userId |
This file contains 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
#### model: | |
```php | |
class Article extends ActiveRecord { | |
public static tableName() { | |
return 'article'; | |
} | |
} |
This file contains 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 | |
return [ | |
'components' => [ | |
... | |
'mailer' => [ | |
'class' => 'yii\swiftmailer\Mailer', | |
'viewPath' => '@common/mail', | |
// send all mails to a file by default. You have to set |
This file contains 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
{ | |
"require": { | |
"swiftmailer/swiftmailer": "@stable" | |
} | |
} |
This file contains 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
/** | |
* @param {string} str testable string | |
* | |
* @return {boolean} | |
*/ | |
function verify(str) { | |
if (typeof str !== 'string') return false; | |
var pairs = { | |
'(' : ')', |
OlderNewer