Skip to Content Skip to Menu

Migration: What class should I use now?

7 years 5 months ago #294042 by asierraserna
Migration: What class should I use now? was created by asierraserna
Hello team,

Still discovering the new stuff in CB and GJ, and adapting my solution to the new stuff.

Guys, I used to use the following classes in my code, but now it changed. What would be the "equivalent" of this classes?

cbgjData::getGroups( null, array( 'id', '=', (int) $b ), null, null, false );
cbgjData::getCategories( null, array( 'id', '=', (int) $a->category ), null, null, false );
CBuser::getInstance( null );

Your help is greatly appreciated!


Alejandro

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48449
  • Thanks: 8280
  • Karma: 1443
7 years 5 months ago #294063 by krileon
Replied by krileon on topic Migration: What class should I use now?

cbgjData::getGroups( null, array( 'id', '=', (int) $b ), null, null, false );
cbgjData::getCategories( null, array( 'id', '=', (int) $a->category ), null, null, false );

Both of those are for grabbing a specific group or category. You'd use standard database objects for that now, which would be as follows.

Group
Code:
$group = new GroupTable(); $group->load( (int) $id );
Category
Code:
$category = new CategoryTable(); $category->load( (int) $id );

You can also use the below, which have their own caching behavior.

Group
Code:
$group = CBGroupJive::getGroup( $id );
Category
Code:
$category = CBGroupJive::getCategory( $id );

All of this is namespaced so you need to use a "use" statement to include the namespace or you need to specify it at your usage. Suggest loading your Joomla install into an editor like phpstorm to make this easier. For example the above cached usages are namespaced with CB\Plugin\GroupJive\CBGroupJive.

CBuser::getInstance( null );

Still exists. That would return a guest user CBuser object though.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: asierraserna

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum