Skip to content

Commit

Permalink
1.2.2 fixed an issue with custom table
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Dyan committed Jun 6, 2016
1 parent ee12208 commit c7c6bb9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Changelog
=========
1.2.2
-----
* Added getDB() in Bean
* Check if the custom table exists (because sugar returns the name without checking)

1.2.1
-----
* Added "update_date_modified" in bean in case we want to force the date_modified
Expand Down
17 changes: 16 additions & 1 deletion src/Bean.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ public function getBeansList()
return $this->beanList;
}

/**
* Get the DB
*
* @return DB
*/
public function getDb()
{
return $this->db;
}

/**
* Get a Bean from SugarCRM
*
Expand Down Expand Up @@ -783,8 +793,13 @@ public function getModuleTable($module)
public function getModuleCustomTable($module)
{
$sugarBean = $this->getBean($module);
$customTable = $sugarBean->get_custom_table_name();
$data = $this->db->query("SHOW TABLES LIKE '$customTable'");
if (empty($data)) {
return '';
}

return $sugarBean->get_custom_table_name();
return $customTable;
}

/**
Expand Down

0 comments on commit c7c6bb9

Please sign in to comment.