Thursday, September 18, 2008

hasMany association with oracle DB - missing "ANY" statement

Hi dudes,

I'm running into problems when trying to establish a hasMany relation
between two models using an orcale DB.

My models:

-------------------
class MenuStructure extends AppModel
{
var $primaryKey = 'file_name';
var $useTable = 'menu_structure';

var $hasMany = array(
'PageAttribute' => array(
'className' => 'PageAttribute',
'foreignKey' => 'filename',
'conditions' => 'PageAttribute.nav_show = 1'
));
}
--------------------
class PageAttribute extends AppModel
{
var $primaryKey = 'filename';
}
--------------------

My Controller:

class PageAttributesController extends AppController
{
var $helpers = array('Javascript');

function index()
{
$this->loadModel('MenuStructure');

$res = $this->MenuStructure->findAll();
debug ($res);

}
}

---------------------

The produced SQL:

SELECT PageAttribute.id, PageAttribute.filename, PageAttribute.title,
[...many others, all fine...]
FROM page_attributes PageAttribute WHERE PageAttribute.nav_show = 1
AND PageAttribute.filename = ('home.html', 'profile.html', [...many
others, all fine...])

The resulting SQL-Error:
Warning (512): SQL Error: ORA-01797: this operator must be followed by
ANY or ALL [CORE/cake/libs/model/datasources/dbo_source.php, line 512]


I guess there is missing an ANY after "PageAttribute.filename = "

Any non-complete-dirty workarounds for this?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: