Exemplo n.º 1
0
 /**
  * Get all the tables of the component that matches with the Joomla naming convention.
  *
  * @param   NenoContentElementGroup $group             Component name
  * @param   string                  $tablePattern      Table Pattern
  * @param   bool                    $includeDiscovered Included tables that have been discovered already
  *
  * @return array
  */
 public static function getComponentTables(NenoContentElementGroup $group, $tablePattern = null, $includeDiscovered = true)
 {
     /* @var $db NenoDatabaseDriverMysqlx */
     $db = JFactory::getDbo();
     $tables = $group->isOtherGroup() ? NenoHelperBackend::getTablesNotDiscovered() : $db->getComponentTables($tablePattern === null ? $group->getGroupName() : $tablePattern);
     $result = array();
     for ($i = 0; $i < count($tables); $i++) {
         // Get Table name
         $tableName = self::unifyTableName($tables[$i]);
         $table = null;
         $tablesIgnored = self::getDoNotTranslateTables();
         if (!in_array($tableName, $tablesIgnored)) {
             if (!self::isTableAlreadyDiscovered($tableName)) {
                 $table = self::createTableInstance($tableName, $group);
             } elseif ($includeDiscovered) {
                 $table = NenoContentElementTable::load(array('table_name' => $tableName, 'group_id' => $group->getId()));
             }
         }
         if (!empty($table)) {
             $result[] = $table;
         }
     }
     return $result;
 }