Skip to content
This repository was archived by the owner on Jun 5, 2022. It is now read-only.

Commit 1507b82

Browse files
authored
Update BaseTable.php
1 parent 7d300a2 commit 1507b82

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/BaseTable.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ public function __construct(\Nette\Database\Context $connection, \Nette\Caching\
2626
*/
2727
protected function getTable()
2828
{
29-
return $this->connection->table($this->tableName);
29+
return $this->connection->table($this->getTableName());
3030
}
3131

3232
public function truncate()
3333
{
34-
$this->connection->query("TRUNCATE ". $this->delimitedTableName);
34+
$this->connection->query("TRUNCATE ". $this->getDelimitedTableName());
3535
}
3636

3737
public function getTableName()
3838
{
39-
$name = $this->getReflection()->getShortName();
39+
$name = (new \ReflectionClass($this))->getShortName();
4040
$name = lcfirst($name);
4141
$name = preg_replace('/[A-Z]/', '_${0}', $name);
4242
$name = strtolower($name);
@@ -57,8 +57,8 @@ public function getPrimary()
5757

5858
protected function getTableColumns()
5959
{
60-
return $this->getCache()->load(str_replace('\\', '-', $this->reflection->name) . '-' . __FUNCTION__, function() {
61-
$data = $this->connection->fetchAll("DESCRIBE ". $this->delimitedTableName);
60+
return $this->getCache()->load(str_replace('\\', '-', (new \ReflectionClass($this))->name) . '-' . __FUNCTION__, function() {
61+
$data = $this->connection->fetchAll("DESCRIBE ". $this->getDelimitedTableName());
6262
foreach($data as $column) {
6363
$columns[$column['Field']] = $column['Field'];
6464
}

0 commit comments

Comments
 (0)