AddFieldToFilter And inside OR condition
I want to achieve the following query in magento custom model.
select * form calendar where date >='2015-04-13' AND start_date <='2015-04-14' AND (is_available != 1 or (is_available == 1 and rooms_avil<=0))
How to achieve this in magento with AddFieldToFilter ? Not AddAttributeToFilter.
Method addAttributeToFilter is used for module whose model supports EAV structure like: catalog/category, catalog/product etc. We generally use addFieldToFitler for custom module (whose model doesn’t support EAV structure)
Answering on your question: how to create
condition OR (condition AND condition)
I think you can't do it using addFieldToFilter. So my advice is:
->getSelect()->where( /* put here all of your conditions */)