1

I have a query like this in a CakePHP application

            // Check for txn_id
            $txns = $this->$transaction_class->find('count', array(
                'conditions' => array(
                    $transaction_class.'.txn' => $txnId 
                )   
            ));

As you can see, my variable transaction_class is a dynamic variable. Form some reason this does not work. I even tried to put the variables inside {} like:

            // Check for txn_id
            $txns = $this->{$transaction_class}->find('count', array(
                'conditions' => array(
                    $transaction_class.'.txn' => $txnId 
                )   
            ));

But that didn't work either. Does anybody know how I can make this work please?

Thanks

user765368
  • 19,590
  • 27
  • 96
  • 167

1 Answers1

0

First check your model is imported on this page or not or added in $uses array.

Rahul Dhande
  • 483
  • 5
  • 9