Phalcon\Test\ModelTestCase::populateTable PHP Метод

populateTable() публичный Метод

Populates a table with default data
public populateTable ( string $table, null $records = null )
$table string
$records null
    public function populateTable($table, $records = null)
    {
        // Empty the table first
        $this->emptyTable($table);
        $connection = $this->di->get('db');
        $parts = explode('_', $table);
        $suffix = '';
        foreach ($parts as $part) {
            $suffix .= ucfirst($part);
        }
        $class = 'Phalcon\\Test\\Fixtures\\' . $suffix;
        $data = $class::get($records);
        foreach ($data as $record) {
            $sql = "INSERT INTO {$table} VALUES " . $record;
            $connection->execute($sql);
        }
    }