public function __construct($databaseName, $tableName, $dirPath) { $this->databaseName = $databaseName; $this->tableName = $tableName; $this->dirPath = $dirPath; $this->className = $this->getClassName($databaseName, $tableName); $this->baseClassName = self::$BASE_CLASS_PREFIX . $this->className; $this->baseClassDir = self::$BASE_CLASS_DIR; $this->con = \DBConnections::getConnection($this->getDatabaseName()); }
public function __construct($option = null) { $this->con = \DBConnections::getConnection(self::getDatabasename()); if (is_null($option)) { $option = self::OPTION_WITH_TRUNCATE; } if ($option == self::OPTION_WITHOUT_TRUNCATE) { return; } $this->con->exec('set foreign_key_checks = 0'); $this->truncate(); $this->con->exec('set foreign_key_checks = 1'); }
protected function setUp() { $databaseName = strtolower(preg_replace('/^(.+?)[A-Z].*$/', '$1', get_class($this))); $this->con = \DBConnections::getConnection($databaseName); }
protected function getConnection($databaseName) { return \DBConnections::getConnection($databaseName); }