Skip to content

Commit

Permalink
fix getWithClass for HABTM relations
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielsolomon committed Aug 21, 2016
1 parent 847428c commit da1de03
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/Records/Relations/HasAndBelongsToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ protected function initJoinFields()

/**
* Simple select query from the link table
* @param bool $specific
* @return Query
*/
public function getLinkQuery($specific = true)
Expand All @@ -91,8 +92,6 @@ public function getLinkQuery($specific = true)
return $query;
}



/**
* @param RecordCollection $collection
* @return RecordCollection
Expand Down Expand Up @@ -168,6 +167,11 @@ protected function _delete()
}


public function getWithClass()
{
return $this->getName();
}

/**
* @return Connection
*/
Expand Down
7 changes: 6 additions & 1 deletion src/Records/Relations/Relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,15 @@ public function getWith()

public function initWith()
{
$className = inflector()->pluralize($this->getName());
$className = $this->getWithClass();
$this->setWithClass($className);
}

public function getWithClass()
{
return inflector()->pluralize($this->getName());
}

/**
* @param string $name
*/
Expand Down

0 comments on commit da1de03

Please sign in to comment.