Bolt\Storage\Database\Schema\Manager::getTableName PHP Method

getTableName() public method

Get the database name of a table from an alias.
public getTableName ( string $name ) : string | null
$name string
return string | null
    public function getTableName($name)
    {
        $tableName = null;
        if (isset($this->app['schema.tables'][$name])) {
            /** @var BaseTable $table */
            $table = $this->app['schema.tables'][$name];
            $tableName = $table->getTableName();
        }
        return $tableName;
    }

Usage Example

Example #1
0
 /**
  * Set the taxonomy.
  *
  * @param string $contentKey
  * @param string $className
  * @param Table  $table
  */
 public function setTaxonomies($contentKey, $className, $table)
 {
     if (!isset($this->contenttypes[$contentKey]['taxonomy'])) {
         return;
     }
     foreach ($this->contenttypes[$contentKey]['taxonomy'] as $taxonomytype) {
         $taxonomyConfig = $this->taxonomies[$taxonomytype];
         if (isset($taxonomyConfig['alias'])) {
             $taxonomy = $taxonomyConfig['alias'];
         } else {
             $taxonomy = $taxonomytype;
         }
         $mapping = ['fieldname' => $taxonomy, 'type' => 'null', 'fieldtype' => $this->typemap['taxonomy'], 'target' => $this->schemaManager->getTableName('taxonomy')];
         $this->metadata[$className]['fields'][$taxonomy] = $mapping;
         $this->metadata[$className]['fields'][$taxonomy]['data'] = $taxonomyConfig;
     }
 }