AnsweredAssumed Answered

get all documents related to particular case using beanfactory

Question asked by ananth ananth on Oct 24, 2014
Latest reply on Oct 24, 2014 by Francesca Shiekh

I'm trying to get all the documents related to the particular cases. I'm able to do this using the simple query.

Query :

select * from documents join documents_cases  on = documents_cases.document_id where documents_cases = '9aa3e2-4bd3-d38a-0495-544a18f12a32'

But i want to do this using Bean Factory function like getBean. I'm not able to figure out , how to do this..

Example 1:

$documents = new documents();
        $documents->retrieve_by_string_fields(array('document_cases.cases_id' => '9aa3e2-4bd3-d38a-0495-544a18f12a32' ));

Example 2 :

$documents = BeanFactory::getBean('documents');
       $documents_list = $documents->get_full_list('documents.date_entered', 'documents_cases.cases_id="9aa3e2-4bd3-d38a-0495-544a18f12a32"');

I'm facing following error.


10/24/14 14:57:36 [2644][1][FATAL] Retrieving record WHERE documents_cases.cases_id = '9aa3e2-4bd3-d38a-0495-544a18f12a32' AND deleted=0: Query Failed: SELECT documents.* FROM documents  WHERE documents_cases.cases_id = '9aa3e2-4bd3-d38a-0495-544a18f12a32' AND deleted=0 LIMIT 0,1: MySQL error 1054: Unknown column 'documents_cases.cases_id ' in 'where clause'

Any help would be greatly appreciated.


Ananth. K