Re: Complex Find Conditions

2009-08-18 Thread gjofum
I have no idea. I tried many things and nothing works. For exampple: $this->Item->find("all", array("fields" => array("Item.id", "Item.thumb"), "contain" => array( "ItemContent" => array( "conditions" => array("ItemContent.language_id" => $this- >language_id), "fields" => ar

Complex Find Conditions

2009-08-18 Thread gjofum
I don't know how to make my own sql code into Complex Find Conditions. Especially with use of INNER JOIN or LEFT INNER. For example: $items = $this->Tag->query("SELECT Item.id, Item.thumb, ItemContent.name, ItemContent.description, ItemContent.url, Module.code FROM items AS Item INNER JOIN items_

Re: Pagination $this->Model->query()

2009-08-17 Thread gjofum
Maybe you're right. But even I can't make silimar cakephp find method to my own sql code. For example: If I use brian's code above I got error: Unknown column 'ItemContent.language_id' in 'where clause'. It's because table ItemContent is just used at 2. query. And I do not know how to set conditi

Re: Pagination $this->Model->query()

2009-08-17 Thread gjofum
array('ItemContent.language_id' => > $this->language_id); > > The reason for that is you can use $this->language_id when defining a > class variable. > > If you can't figure out how to turn your query() into a Cake find(), > you could look into using PEAR::pager as a v

Pagination $this->Model->query()

2009-08-16 Thread gjofum
I'd like to paginate $this->Model->query(). For example I have this in my controller: $this->Item->query("SELECT Item.id, Item.thumb, ItemContent.name, ItemContent.description, Module.code FROM items AS Item INNER JOIN items_content AS ItemContent ON ItemContent.item_id = Item.id INNER JOIN modul

Re: Update with WHERE Clause

2009-08-07 Thread gjofum
to do is ONLY save if language_id = a certain > value, then you can test for that before you save. > > - Jamie > > On Aug 6, 5:02 pm, gjofum wrote: > > > I'd like to update data in db, but I have a problem. > > > If I use $this->...->save(...); it'

primaryKey

2009-08-06 Thread gjofum
I can set up primaryKey in model by variable $primaryKey. But how can I set up that I don't have primaryKey or I don't want it? (Actually I don't want to use primaryKey from my db.) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Go

Update with WHERE Clause

2009-08-06 Thread gjofum
I'd like to update data in db, but I have a problem. If I use $this->...->save(...); it'll only use id (primaryKey) in clause WHERE. But I need one more (id = ? and language_id = ? in clause WHERE). How can I do that? --~--~-~--~~~---~--~~ You received this message

Re: Data Validation - What's wrong?

2009-07-17 Thread gjofum
                  "rule" => array("maxLength", 10), >                                 "message" => "max" >                         ), >                 ) >         ); > > (note where I've moved 'required' to - it needs t

Re: Data Validation - What's wrong?

2009-07-17 Thread gjofum
I am setting data a then validate them. $this->Module->set($this->data); if($this->Module->validates()) print "YES"; else print "NO"; But I have one more problem. I get 2 errors with just validate rule below. Warning (2):

Re: Data Validation - What's wrong?

2009-07-17 Thread gjofum
It doesn't help. On Jul 17, 9:58 am, joshua wrote: > Mine: > > > > > 'email' => array( > > 'noEmpty' => array( > > 'rule' => 'email', > > 'allowEmpty' => false, > > 'message' =

Re: Data Validation - What's wrong?

2009-07-17 Thread gjofum
I add notEmpty and it still doesn't work. var $validate = array( "module_data" => array( "module_dataRule1" => array( "rule" => "notEmpty", "message" => "empty"

Data Validation - What's wrong?

2009-07-15 Thread gjofum
I have this validate in Model: var $validate = array( "module_data" => array( "module_dataRule1" => array( "rule" => array("minLength", 5), "message" => "min" ),