Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\test;
  8. use Yii;
  9. use yii\db\Connection;
  10. use yii\di\Instance;
  11. use yii\base\Object;
  12. /**
  13. * DbFixture is the base class for DB-related fixtures.
  14. *
  15. * DbFixture provides the [[db]] connection to be used by DB fixtures.
  16. *
  17. * @author Qiang Xue <qiang.xue@gmail.com>
  18. * @since 2.0
  19. */
  20. abstract class DbFixture extends Fixture
  21. {
  22. /**
  23. * @var Connection|array|string the DB connection object or the application component ID of the DB connection.
  24. * After the DbFixture object is created, if you want to change this property, you should only assign it
  25. * with a DB connection object.
  26. * Starting from version 2.0.2, this can also be a configuration array for creating the object.
  27. */
  28. public $db = 'db';
  29. /**
  30. * @inheritdoc
  31. */
  32. public function init()
  33. {
  34. parent::init();
  35. $this->db = Instance::ensure($this->db, Object::className());
  36. }
  37. }