Skip to content

Commit

Permalink
Fix method calls
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Dec 19, 2019
1 parent 5cd8002 commit 83b8008
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Command/FixtureCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ protected function _generateRecords(TableSchemaInterface $table, int $recordCoun
break;
case 'string':
case 'binary':
$isPrimary = in_array($field, $table->primaryKey());
$isPrimary = in_array($field, $table->getPrimaryKey());
if ($isPrimary) {
$insert = Text::uuid();
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/Command/ModelCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public function findBelongsTo(Table $model, array $associations): array
{
$schema = $model->getSchema();
foreach ($schema->columns() as $fieldName) {
if (!preg_match('/^.+_id$/', $fieldName) || ($schema->primaryKey() === [$fieldName])) {
if (!preg_match('/^.+_id$/', $fieldName) || ($schema->getPrimaryKey() === [$fieldName])) {
continue;
}

Expand Down Expand Up @@ -384,7 +384,7 @@ public function findTableReferencedBy(TableSchema $schema, string $keyField): ?s
public function findHasMany(Table $model, array $associations): array
{
$schema = $model->getSchema();
$primaryKey = $schema->primaryKey();
$primaryKey = $schema->getPrimaryKey();
$tableName = $schema->name();
$foreignKey = $this->_modelKey($tableName);

Expand Down Expand Up @@ -600,7 +600,7 @@ public function getFields(Table $table, Arguments $args)
foreach ($table->associations() as $assoc) {
$fields[] = $assoc->getProperty();
}
$primaryKey = $schema->primaryKey();
$primaryKey = $schema->getPrimaryKey();

return array_values(array_diff($fields, $primaryKey));
}
Expand Down Expand Up @@ -651,7 +651,7 @@ public function getValidation(Table $model, array $associations, Arguments $args
}

$validate = [];
$primaryKey = $schema->primaryKey();
$primaryKey = $schema->getPrimaryKey();
$foreignKeys = [];
if (isset($associations['belongsTo'])) {
foreach ($associations['belongsTo'] as $assoc) {
Expand Down

0 comments on commit 83b8008

Please sign in to comment.