Skip to content

Fix make method #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Get table name from eloquent model instead of calculating
Fixes issues with non standard table names
  • Loading branch information
ryanrobertsname committed Oct 28, 2014
commit dc2f18b31e8cdbf56d92a5e83f8aa0e48ee53bdf
15 changes: 1 addition & 14 deletions src/Way/Tests/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ protected static function setRootNamespace($class)
*/
public function fire($class, array $overrides = array())
{
$this->tableName = $this->parseTableName($class);
$this->class = $this->createModel($class);
$this->tableName = $this->class->getTable();

// First, we dynamically fetch the fields for the table
$columns = $this->getColumns($this->tableName);
Expand All @@ -153,19 +153,6 @@ public function fire($class, array $overrides = array())
return $this->class;
}

/**
* Calulate the table name
*
* @param string $class
* @return string
*/
protected function parseTableName($class)
{
return $this->isNamespaced($class)
? snake_case(str_plural(substr(strrchr($class, '\\'), 1)))
: snake_case(str_plural($class));
}

/**
* Initialize the given model
*
Expand Down