Skip to content

Commit

Permalink
Merge pull request #1527 from tripal/tv4g0-issue1522-dependencyInjection
Browse files Browse the repository at this point in the history
Use dependency injection in Chado Vocal + ID Space classes
  • Loading branch information
laceysanderson committed May 31, 2023
2 parents 5ec62a1 + e9b803a commit c497adf
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 131 deletions.
2 changes: 1 addition & 1 deletion tripal/src/Plugin/TripalIdSpace/TripalDefaultIdSpace.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ protected function loadIdSpace() {
/**
* {@inheritDoc}
*/
public function create() {
public function createRecord() {
$conn = \Drupal::service('database');

// Check if the record already exists in the database, if it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public function setLabel($label) {
/**
* {@inheritDoc}
*/
public function create() {
public function createRecord() {

// Check if the record already exists in the database, if it
// doesn't then insert it. We don't yet have the definition,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
interface TripalCollectionPluginInterface extends PluginInspectionInterface {

/**
* Creates this collection.
* Creates the records needed for this collection.
*
* This must only be called once on this new collection instance that has
* just been created by its collection plugin manager.
*/
public function create();
public function createRecord();

/**
* Destroys this collection.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function createCollection($name, $pluginId) {
if ($collection->isValid()) {
$result = $db->insert($this->table)->fields(["name" => $name, "plugin_id" => $pluginId])->execute();
if ($collection->recordExists() == False) {
$collection->create();
$collection->createRecord();
}
return $collection;
}
Expand Down Expand Up @@ -167,7 +167,7 @@ public function loadCollection($name) {
$collection = $this->createInstance($first["plugin_id"], ["collection_name" => $name]);

if ($collection->isValid() and $collection->recordExists() == False) {
$collection->create();
$collection->createRecord();
}

return $collection;
Expand Down

0 comments on commit c497adf

Please sign in to comment.