Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 560565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:21:26+00:00 2026-05-13T12:21:26+00:00

Here’s an example… I’m using a table to manage all of my Statuses with

  • 0

Here’s an example…

I’m using a table to manage all of my Statuses with the tree behavior. I have a Book model which has a status for it’s condition and one for it’s availability. So the Book model HABTM Statuses even thought it can only have one condition and one availability.

Is there a way to use the $paginator->sort(‘Condition’, ‘?’) with a HABTM ? I would like to sort the title from the array below.

This is what $this->data is giving me :

[Status] => Array
    (
        [0] => Array
            (
                [id] => 2
                [parent_id] => 1
                [lft] => 2
                [rght] => 3
                [title] => Mint
                [created] => 2010-01-18 16:20:54
                [modified] => 2010-01-18 16:20:54
                [active] => 1
                [BooksStatus] => Array
                    (
                        [id] => 7
                        [book_id] => 3
                        [status_id] => 2
                    )

            )

    )
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:21:26+00:00Added an answer on May 13, 2026 at 12:21 pm

    i would use 2 x belongsTo with different names.

    $belongsTo = array(
      'BookStatus' => array(
        'className' => 'Status',
        'foreignKey' => 'book_status_id'
      ),
      'BookCondition' => array(
        'className' => 'Status',
        'foreignKey' => 'book_condition_id'
      )
    )
    

    dont know how this would then fit into your tree strut

    if that doesnt work then Try $paginator->sort(‘Condition’, ‘BooksStatus.status_id’);
    you will need to make sure the query used to retrieve the above does a join(unBind/bind on the fly)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is a link my example of the misaligned table rows Click preview in
Here is an example table: ID time data type 0 0100 xyz 0 1
Here's task: We have an sql server database. which is hosted at our server.
Here's a problem I ran into recently. I have attributes strings of the form
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior
Here is a simplification of my database: Table: Property Fields: ID, Address Table: Quote
Here is my code, which takes two version identifiers in the form 1, 5,
Here we go again, the old argument still arises... Would we better have a
Here, i have coded to get data from DB. I want to store the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.