Skip to content
This repository was archived by the owner on Nov 19, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Codesleeve/Fixture/Drivers/DriverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ interface DriverInterface
*
* @param string $tableName
* @param array $records
* @param array $config
* @return array
*/
public function buildRecords($tableName, array $records);
public function buildRecords($tableName, array $records, array $config);

/**
* Truncate a table.
Expand Down
8 changes: 7 additions & 1 deletion src/Codesleeve/Fixture/Drivers/Eloquent.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,21 @@ public function __construct(PDO $db, Str $str)
*
* @param string $tableName
* @param array $records
* @param array $config
* @return array
*/
public function buildRecords($tableName, array $records)
public function buildRecords($tableName, array $records, array $config)
{
$insertedRecords = array();
$this->tables[$tableName] = $tableName;

foreach ($records as $recordName => $recordValues) {
$model = $this->generateModelName($tableName);

// Prefix namespace if comes from configuration.
if (isset($config['namespace'])) {
$model = sprintf('%s\%s', $config['namespace'], $model);
}
$record = new $model;

foreach ($recordValues as $columnName => $columnValue) {
Expand Down
3 changes: 2 additions & 1 deletion src/Codesleeve/Fixture/Drivers/Standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ public function __construct(PDO $db)
*
* @param string $tableName
* @param array $records
* @param array $config
* @return array
*/
public function buildRecords($tableName, array $records)
public function buildRecords($tableName, array $records, array $config)
{
$insertedRecords = array();
$this->tables[$tableName] = $tableName;
Expand Down
2 changes: 1 addition & 1 deletion src/Codesleeve/Fixture/Fixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,6 @@ protected function loadFixture($fixture)

}

$this->fixtures[$tableName] = $this->driver->buildRecords($tableName, $records);
$this->fixtures[$tableName] = $this->driver->buildRecords($tableName, $records, $this->config);
}
}