Re: How to search - A very strange find
If you want to specify model 2 fields in your fin's field or conditions arrays you need to force a join by changing the association from hasMany to hasOne using un/bindmodel otherwise find will run two queries fetching model1 first then running a separate query for model2 and combining the returned datasets. However if you only want to limit what fields find returs for the hasMany relationship you can do this with containable by specifying a fields array for each model you include in your contains array. HTH Paul Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: How to search - A very strange find
Hello, thanks for that idea ands that way, but after i try it, it will be shown the hole array of Model2. Where are my fault? Marcus On 27 Mrz., 06:11, Martin Radosta martinrado...@gmail.com wrote: |Your question is not clear, I guess you need this: $this-Model1-Behaviors-attach('Containable'); | $this-Model1-find('first', array( 'conditions' = array('Model1.id' = $id), 'contain' = array('Model2' = array('fields' = array('Model2.title', 'Model2.description', 'Model2.reservation_status'))), 'fields' = array('Model1.id','Model1.title','Model1.description') ) ); On 03/26/2010 09:10 PM, amarradi wrote: I have to go to bed good night Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: How to search - A very strange find
Now it runs Thanks a lot in that model. In the other way the Model contained Model1 is empty but why? Here is the code of my model1 $this-Model2-Behaviors-attach('Containable'); $this-set('var1', $this-Model2-find('first', array( 'conditions' = array('Model2.id' = $id), 'contain' = array('Model1' = array('fields'= array('Model1.register_password'))), 'fields' = array( 'Model2.id', 'Model1.id', 'Model1.register_password', 'Model2.id', 'Model2.description', ) ) ) ); The debug output looks so Array ( [WishlistEntry] = Array ( [wishlist_id] = 1 [id] = 2 [title] = Text [description] = Text [reservation_status] = FREE ) [Wishlist] = Array ( [register_password] = [id] = ) ) Whats wrong with it On 27 Mrz., 12:38, amarradi radis...@googlemail.com wrote: Hello, thanks for that idea ands that way, but after i try it, it will be shown the hole array of Model2. Where are my fault? Marcus On 27 Mrz., 06:11, Martin Radosta martinrado...@gmail.com wrote: |Your question is not clear, I guess you need this: $this-Model1-Behaviors-attach('Containable'); | $this-Model1-find('first', array( 'conditions' = array('Model1.id' = $id), 'contain' = array('Model2' = array('fields' = array('Model2.title', 'Model2.description', 'Model2.reservation_status'))), 'fields' = array('Model1.id','Model1.title','Model1.description') ) ); On 03/26/2010 09:10 PM, amarradi wrote: I have to go to bed good night Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: How to search - A very strange find
Now it runs Thanks a lot in that model. In the other way the Model contained Model1 is empty but why? Here is the code of my model1 $this-Model2-Behaviors-attach('Containable'); $this-set('var1', $this-Model2-find('first', array( 'conditions' = array('Model2.id' = $id), 'contain' = array('Model1' = array('fields'= array('Model1.register_password'))), 'fields' = array( 'Model2.id', 'Model1.id', 'Model1.register_password', 'Model2.id', 'Model2.description', ) ) ) ); The debug output looks so Array ( [Model2] = Array ( [model2_id] = 1 [id] = 2 [title] = Text [description] = Text [reservation_status] = FREE ) [Model1] = Array ( [register_password] = [id] = ) ) Whats wrong with it On 27 Mrz., 12:38, amarradi radis...@googlemail.com wrote: Hello, thanks for that idea ands that way, but after i try it, it will be shown the hole array of Model2. Where are my fault? Marcus On 27 Mrz., 06:11, Martin Radosta martinrado...@gmail.com wrote: |Your question is not clear, I guess you need this: $this-Model1-Behaviors-attach('Containable'); | $this-Model1-find('first', array( 'conditions' = array('Model1.id' = $id), 'contain' = array('Model2' = array('fields' = array('Model2.title', 'Model2.description', 'Model2.reservation_status'))), 'fields' = array('Model1.id','Model1.title','Model1.description') ) ); On 03/26/2010 09:10 PM, amarradi wrote: I have to go to bed good night Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: How to search - A very strange find
I knwo the fault because under that id in Model2 is no entry in model1 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: How to search - A very strange find
In Table of Model2 is the Model1_id and this id is the same like the id in model1 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: How to search - A very strange find
In Table of Model2 is the Model1_id and this id is the same like the id in model1 How did i build the select Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: How to search - A very strange find
The Bug is found in the model i have set an forgeignKey on hasOne. Thanks a lot for the help @everyone Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
How to search - A very strange find
Hello together Array ( [Model1] = Array ( [id] = 1 [title] =titletext [description] = description ) [Model2] = Array ( [0] = Array ( [id] = 2 [model1_id] = 1 [title] = titletext [description] = description [amount] = 1 [reservation_email] = [reservation_mail_sent] = [reservation_status] = FREE [token] = 4bad0da4-da9c-426a-b639-0aa423c87734 [created] = 2009-12-30 16:59:53 [modified] = 2010-02-25 15:50:25 ) [1] = Array ( [id] = 3 [model1_id] = 1 Thats an dump of an var-debug Thats my call $this-set('model1', $this-Model1-find('first',array( 'conditions' = array('Model1.id' = $id), 'recursive' = 1, 'fields' = array('Model1.id','Model1.title','Model1.description') ) ) ); How can i get with this call(!) fields of the Model2. The Model1.id has many Model2.ids if i use the fields like this way Model2.id Model2.title it doesn't change it. In Model2 is also an array [0][n] and this number is not the id How do i this. I ask because the application is very big i tried with read but there are to many values( amount, token, ...) which i don't need in this array so i want a smaller array can everyone help me please? many greeting Marcus Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: How to search - A very strange find
I have to correct it because in the that have to be an other value $this-set('variable', $this-Model1-find('first',array( 'conditions' = array('Model1.id' = $id), 'recursive' = 1, 'fields' = array('Model1.id','Model1.title','Model1.description') ) ) ); Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: How to search - A very strange find
try 'recursive' = -1 On 03/26/2010 05:23 PM, amarradi wrote: I have to correct it because in the that have to be an other value $this-set('variable', $this-Model1-find('first',array( 'conditions' = array('Model1.id' = $id), 'recursive' =1, 'fields' = array('Model1.id','Model1.title','Model1.description') ) ) ); Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: How to search - A very strange find
Thanks for the tip but i get this sql error Unknown column Model2.id' in 'field list' Because there is an array in Model2. [0] [1] I dont know how do i get an coorect dataset On 26 Mrz., 21:31, Martin Radosta martinrado...@gmail.com wrote: try 'recursive' = -1 On 03/26/2010 05:23 PM, amarradi wrote: I have to correct it because in the that have to be an other value $this-set('variable', $this-Model1-find('first',array( 'conditions' = array('Model1.id' = $id), 'recursive' = 1, 'fields' = array('Model1.id','Model1.title','Model1.description') ) ) ); Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: How to search - A very strange find
The Question is how do i get the information from an/the associated model Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: How to search - A very strange find
Which fields from Model2 do you want? Do you want anything from Model2? On Mar 26, 4:57 pm, amarradi radis...@googlemail.com wrote: The Question is how do i get the information from an/the associated model Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: How to search - A very strange find
I want the title description and in the first version reservation_status i try it over contains or recursive 2 But no change On 27 Mrz., 00:39, cricket zijn.digi...@gmail.com wrote: Which fields from Model2 do you want? Do you want anything from Model2? On Mar 26, 4:57 pm, amarradi radis...@googlemail.com wrote: The Question is how do i get the information from an/the associated model Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: How to search - A very strange find
I have to go to bed good night Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: How to search - A very strange find
|Your question is not clear, I guess you need this: $this-Model1-Behaviors-attach('Containable'); | $this-Model1-find('first', array( 'conditions' = array('Model1.id' = $id), 'contain' = array('Model2' = array('fields' = array('Model2.title', 'Model2.description', 'Model2.reservation_status'))), 'fields' = array('Model1.id','Model1.title','Model1.description') ) ); On 03/26/2010 09:10 PM, amarradi wrote: I have to go to bed good night Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.