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

SQL exp_channel_data_field question

News and General

designstation's avatar
designstation
48 posts
5 years ago
designstation's avatar designstation

I’m working on a site that has been running on ExpressionEngine since ExpressionEngine 1 (though it’s been upgraded from 2 to 3 and on to 5 over the years). I was looking at the SQL database recently and noticed that new channel data fields are now creating their own tables (starting with exp_channel_data_field_104). Is that normal behaviour or should I be concerned that this is a sign that things could start to go a bit wrong with my ExpressionEngine install and its database?

Anyway, I appreciate any insights or advice anyone has to offer—I’m definitely far from knowledgeable about SQL. Thank you!

       
Andrés Molina's avatar
Andrés Molina
43 posts
5 years ago
Andrés Molina's avatar Andrés Molina

yes, but now have an api, for example im write an Plugin (pi.pljuign_name.php) and have this function

public function getCanal(){
  $this->channel_id = (ee()->TMPL->fetch_param('channel_id'))?ee()->TMPL->fetch_param('channel_id'):0;
  $entradas=array();
  $entries = ee('Model')->get('ChannelEntry')
      ->filter('author_id', ee()->session->userdata('member_id'))
      ->filter('channel_id',$this->channel_id ) // or whatever you want/need to filter on
      ->order('title', 'ASC');
  foreach($entries->all() as $ent){
   $entradas[]=array(
      "chan_title"=>$ent->title,
      "chan_url_title"=>$ent->url_title,
      "chan_entry_id"=>$ent->entry_id,
   );
  }
  
  return ee()->TMPL->parse_variables(ee()->TMPL->tagdata, $entradas);
 
 }

and you can get Custom Fields by Field ID like

$ent->field_id_1//or the id of your Custom Field

or

$field = ee('Model')->get('ChannelField')
  ->filter('field_name', $ci) // or whatever you want/need to filter on
  ->first();
  $fieldid="field_id_".$field->field_id;
   $ent->{$fieldid}
       
Brian Litzinger's avatar
Brian Litzinger
693 posts
5 years ago
Brian Litzinger's avatar Brian Litzinger

> is a sign that things could start to go a bit wrong with my ExpressionEngine install

Not necessarily. All new fields are created with the new schema, EE’s models know how to handle that. As long as any add-on that is modifying entry data uses the models instead of querying exp_channel_data directly, then it will continue to work just fine.

? 1
       

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.