for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
// Import System/Cli/Commands/MigrateCommand
Yii::import('system.cli.commands.MigrateCommand');
/**
* This class is an injection container for CDbMigration which permits us to
* directly access CDbMigrations from our web application without having
* access to CLI or knowing before hand what our DSN is.
*
* Under no circumstances, should this be called directly from command line.
*/
class CiiMigrateCommand extends MigrateCommand
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
{
* @var array $dsn
* The DSN and CDbConnectionString information from CWebApplication
public $dsn = array();
* This is our overloaded getDbConnection, allowing us to tell yii what our db connection is
* without it having to go through
public function getDbConnection()
$connection = new CDbConnection("mysql:host={$this->dsn['host']};dbname={$this->dsn['dbname']}", $this->dsn['username'], $this->dsn['password']);
sprintf
$this
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.
// Instead of $x = "foo $bar $baz"; // Better use either $x = "foo " . $bar . " " . $baz; $x = sprintf("foo %s %s", $bar, $baz);
$connection->setActive(true);
return $connection;
}
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.