We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

ChannelField::getDataTable() always returns 'channel_data'

Developer Preview

Low's avatar
Low
407 posts
7 years ago
Low's avatar Low

I’m trying to determine where a given channel field is stored. Thought I could use the getDataTable() on the ChannelField model, but that always returns 'channel_data', even for Fluid fields, which will never be in that table.

       
Low's avatar
Low
407 posts
7 years ago
Low's avatar Low

I’m guessing it will be tricky to determine what to return when a given field can be stand-alone or part of a Fluid field… But, ideally, this method should return the table name where the content is stored. Is this going to be the case? It will be very useful for building custom queries that aren’t currently possible using Models (like calculating Haversine distance using 2 fields as lat and long values).

       
Seth Barber's avatar
Seth Barber
172 posts
7 years ago
Seth Barber's avatar Seth Barber

Low,

I’m adding the following method to FieldModel in the next release:

public function getDataStorageTable()
{
 if ( ! $this->hasProperty($this->getColumnPrefix().'legacy_field_data')
  || $this->getProperty($this->getColumnPrefix().'legacy_field_data') == TRUE)
 {
  return $this->getDataTable();
 }
 
 return $this->getTableName();
}
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.