Welcome, Guest
Username: Password: Remember me

TOPIC: Get the table name having the model

Get the table name having the model 14 Sep 2017 03:33 #15290

  • vlemos
  • vlemos's Avatar
  • Offline
  • Elite Member
  • Posts: 294
  • Thank you received: 41
  • Karma: 21
Hello Admin, I am trying to quickly get the table name "#__foo_users" via the model "User" and can't seem to find it. Can you help? Thanks V
The administrator has disabled public write access.

Get the table name having the model 15 Sep 2017 08:43 #15291

  • Romkabouter
  • Romkabouter's Avatar
  • Offline
  • Elite Member
  • Posts: 290
  • Thank you received: 125
  • Karma: 48
Try:
$table= JTable::getInstance('user', 'FooTable');
$name = $table->getTableName();

Not via the model, but the shortest way I think.
Last Edit: 15 Sep 2017 08:44 by Romkabouter.
The administrator has disabled public write access.
The following user(s) said Thank You: vlemos

Get the table name having the model 17 Sep 2017 02:00 #15292

  • vlemos
  • vlemos's Avatar
  • Offline
  • Elite Member
  • Posts: 294
  • Thank you received: 41
  • Karma: 21
Hello Romkabouter, not exactly what I was looking for, but thanks for the reply. Warm regards, V
The administrator has disabled public write access.

Get the table name having the model 18 Sep 2017 15:21 #15293

  • vlemos
  • vlemos's Avatar
  • Offline
  • Elite Member
  • Posts: 294
  • Thank you received: 41
  • Karma: 21
Was to share this for a while, but time was against me.
	$table = $model->getTable();	
	$tablename = $table->getTableName();

Warm regards
v
The administrator has disabled public write access.
The following user(s) said Thank You: admin

Get the table name having the model 20 Sep 2017 09:21 #15300

  • Romkabouter
  • Romkabouter's Avatar
  • Offline
  • Elite Member
  • Posts: 290
  • Thank you received: 125
  • Karma: 48
Ah, you needed it from the model indeed.
Nice one :)
The administrator has disabled public write access.

Get the table name having the model 20 Sep 2017 10:59 #15303

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3702
  • Thank you received: 975
  • Karma: 141
Joomla has a so nice architecture.
Try such thing with Wordpress... lol
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.083 seconds

Get Started