Re: To model or not to model
Still thinks that executing queries is needed? Yes. Sometimes You have uncommon database design, and You can't EFFECTIVELY receive data just by using standard, even magic, model functions. In that case you should create method in model that executes your custom query with inner, outer, left joins, subqueries and other fancy stuff :) But I agree that one should check if it's possible to do this with standard model, and then if isn't - write some queries. In my team I has some people that likes sql so much, that $this-Model- query was substitute even for findAll (sic!). I spent quite a long time explaining why it's not good. On Sep 24, 1:32 pm, Rafael Bandeira aka rafaelbandeira3 [EMAIL PROTECTED] wrote: First of all people: what Rule? It's not made of rules, it's a pattern to follow - but follow as you want. Second, no, it doesn't break the Rule it only makes your code uglier and hard to read - see above - but the thing is, why to use a hand made query when you can easily/prettier/readablier use Model built-in methods to accomplish the same? About performing custom find methods, with default/mandatory/pre- defined params you should read: http://rafaelbandeira3.wordpress.com/2008/08/28/the-new-way-to-define... http://cakebaker.42dh.com/2008/09/23/an-alternative-way-to-define-cus... About the rules: Even being annoying, executing hand made queries on the controller still leaves all the data transaction and structuration on the Model side, and it lets the pattern intended to be followed intact, but it's not the best practice. If even following the links presented - and links cited inside them, you still not find the solution for a more complex and featured query, try to implement it inside a model method to make your controller cleaner: $this-Model-find(where id=xyz) becomes $this-Model-find('axis', array('id' = 'xyz')); // following those links or $this-Model-getByAxis($axis); But in the specific case you presented, you could easily use Model methods overload by calling $this-Model-findById($id), $this-Model- findByFieldName($fieldValue); Still thinks that executing queries is needed? rafaelbandeira3http://rafaelbandeira3.wordpress.com but i heared if you direct query in controller will violate the MVC rule i.e if you use $this-Model-query(select * from models); the above query will violate the MVC rule. i heared the queries shouldnotbe written in controller it should be inmodeli.e in urmodel.php even i am alsonotabsolute on this part On Sep 23, 2:33 pm, forrestgump [EMAIL PROTECTED] wrote: Hey guys, Considering the fact that CakePhp follows the MVC architecture, id like to know...y we dont make function calls such as $this-find(where id=xyz) from function blocks typed out in Models rather than controllersim sure there is a logical reason to it...but someone asked me this question and i couldnotgive her a good enuf answerdoes making function calls to queries like find(), save() work better in models or controllers?.and is it good practice to pass conditions in your function call while using it in a controller? eg find(where id=1) ; Does using $this-find() in controller violate the MVC architecture in any manner? Can someone please clarify these question for us? Thanks in advance, forrestgump --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: To model or not to model
Still thinks that executing queries is needed? Yes. Sometimes You have uncommon database design, and You can't EFFECTIVELY receive data just by using standard, even magic, model Definetly correct, my sentence wasn't much happy. I meant for the cases he presented. Anyway, keep in mind that you should - as a good design principle - encapsulate hand made sql queries in Model methods, so you'll avoid having data fetching logic in your Controller. And take a good look at the built-in query structure, it covers lots of usages I got pretty complex queries for data reporting and they're all using cake's query structure. rafaelbandeira3 http://rafaelbandeira3.wordpress.com --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: To model or not to model
Thanks for the info guys...really appreciate it @RichardAtHome.whoops i forgot to mention the model inbetweentypo...thnx for pointing tht out Forrestgump On Sep 23, 2:54 pm, techiguy [EMAIL PROTECTED] wrote: hi forrestgump, using $this-find() in controller doesn't voilate the MVC architecture even if you use $this-find('all') but i heared if you direct query in controller will violate the MVC rule i.e if you use $this-Model-query(select * from models); the above query will violate the MVC rule. i heared the queries should not be written in controller it should be in model i.e in ur model.php even i am also not absolute on this part On Sep 23, 2:33 pm, forrestgump [EMAIL PROTECTED] wrote: Hey guys, Considering the fact that CakePhp follows the MVC architecture, id like to know...y we dont make function calls such as $this-find(where id=xyz) from function blocks typed out in Models rather than controllersim sure there is a logical reason to it...but someone asked me this question and i could not give her a good enuf answerdoes making function calls to queries like find(), save() work better in models or controllers?.and is it good practice to pass conditions in your function call while using it in a controller? eg find(where id=1) ; Does using $this-find() in controller violate the MVC architecture in any manner? Can someone please clarify these question for us? Thanks in advance, forrestgump --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: To model or not to model
First of all people: what Rule? It's not made of rules, it's a pattern to follow - but follow as you want. Second, no, it doesn't break the Rule it only makes your code uglier and hard to read - see above - but the thing is, why to use a hand made query when you can easily/prettier/readablier use Model built-in methods to accomplish the same? About performing custom find methods, with default/mandatory/pre- defined params you should read: http://rafaelbandeira3.wordpress.com/2008/08/28/the-new-way-to-define-find-methods/ http://cakebaker.42dh.com/2008/09/23/an-alternative-way-to-define-custom-find-types/ About the rules: Even being annoying, executing hand made queries on the controller still leaves all the data transaction and structuration on the Model side, and it lets the pattern intended to be followed intact, but it's not the best practice. If even following the links presented - and links cited inside them, you still not find the solution for a more complex and featured query, try to implement it inside a model method to make your controller cleaner: $this-Model-find(where id=xyz) becomes $this-Model-find('axis', array('id' = 'xyz')); // following those links or $this-Model-getByAxis($axis); But in the specific case you presented, you could easily use Model methods overload by calling $this-Model-findById($id), $this-Model- findByFieldName($fieldValue); Still thinks that executing queries is needed? rafaelbandeira3 http://rafaelbandeira3.wordpress.com but i heared if you direct query in controller will violate the MVC rule i.e if you use $this-Model-query(select * from models); the above query will violate the MVC rule. i heared the queries shouldnotbe written in controller it should be inmodeli.e in urmodel.php even i am alsonotabsolute on this part On Sep 23, 2:33 pm, forrestgump [EMAIL PROTECTED] wrote: Hey guys, Considering the fact that CakePhp follows the MVC architecture, id like to know...y we dont make function calls such as $this-find(where id=xyz) from function blocks typed out in Models rather than controllersim sure there is a logical reason to it...but someone asked me this question and i couldnotgive her a good enuf answerdoes making function calls to queries like find(), save() work better in models or controllers?.and is it good practice to pass conditions in your function call while using it in a controller? eg find(where id=1) ; Does using $this-find() in controller violate the MVC architecture in any manner? Can someone please clarify these question for us? Thanks in advance, forrestgump --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: To model or not to model
I dont think i asked anything bout using queries..i just wanted to know wht would be the best practice..but thnx for the info...will avoid $this-Model-query() On Sep 24, 4:32 pm, Rafael Bandeira aka rafaelbandeira3 [EMAIL PROTECTED] wrote: First of all people: what Rule? It's not made of rules, it's a pattern to follow - but follow as you want. Second, no, it doesn't break the Rule it only makes your code uglier and hard to read - see above - but the thing is, why to use a hand made query when you can easily/prettier/readablier use Model built-in methods to accomplish the same? About performing custom find methods, with default/mandatory/pre- defined params you should read: http://rafaelbandeira3.wordpress.com/2008/08/28/the-new-way-to-define... http://cakebaker.42dh.com/2008/09/23/an-alternative-way-to-define-cus... About the rules: Even being annoying, executing hand made queries on the controller still leaves all the data transaction and structuration on the Model side, and it lets the pattern intended to be followed intact, but it's not the best practice. If even following the links presented - and links cited inside them, you still not find the solution for a more complex and featured query, try to implement it inside a model method to make your controller cleaner: $this-Model-find(where id=xyz) becomes $this-Model-find('axis', array('id' = 'xyz')); // following those links or $this-Model-getByAxis($axis); But in the specific case you presented, you could easily use Model methods overload by calling $this-Model-findById($id), $this-Model- findByFieldName($fieldValue); Still thinks that executing queries is needed? rafaelbandeira3http://rafaelbandeira3.wordpress.com but i heared if you direct query in controller will violate the MVC rule i.e if you use $this-Model-query(select * from models); the above query will violate the MVC rule. i heared the queries shouldnotbe written in controller it should be inmodeli.e in urmodel.php even i am alsonotabsolute on this part On Sep 23, 2:33 pm, forrestgump [EMAIL PROTECTED] wrote: Hey guys, Considering the fact that CakePhp follows the MVC architecture, id like to know...y we dont make function calls such as $this-find(where id=xyz) from function blocks typed out in Models rather than controllersim sure there is a logical reason to it...but someone asked me this question and i couldnotgive her a good enuf answerdoes making function calls to queries like find(), save() work better in models or controllers?.and is it good practice to pass conditions in your function call while using it in a controller? eg find(where id=1) ; Does using $this-find() in controller violate the MVC architecture in any manner? Can someone please clarify these question for us? Thanks in advance, forrestgump --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: To model or not to model
Ohk...sry rafael...i did not read the entire thread On Sep 24, 5:17 pm, forrestgump [EMAIL PROTECTED] wrote: I dont think i asked anything bout using queries..i just wanted to know wht would be the best practice..but thnx for the info...will avoid $this-Model-query() On Sep 24, 4:32 pm, Rafael Bandeira aka rafaelbandeira3 [EMAIL PROTECTED] wrote: First of all people: what Rule? It's not made of rules, it's a pattern to follow - but follow as you want. Second, no, it doesn't break the Rule it only makes your code uglier and hard to read - see above - but the thing is, why to use a hand made query when you can easily/prettier/readablier use Model built-in methods to accomplish the same? About performing custom find methods, with default/mandatory/pre- defined params you should read: http://rafaelbandeira3.wordpress.com/2008/08/28/the-new-way-to-define... http://cakebaker.42dh.com/2008/09/23/an-alternative-way-to-define-cus... About the rules: Even being annoying, executing hand made queries on the controller still leaves all the data transaction and structuration on the Model side, and it lets the pattern intended to be followed intact, but it's not the best practice. If even following the links presented - and links cited inside them, you still not find the solution for a more complex and featured query, try to implement it inside a model method to make your controller cleaner: $this-Model-find(where id=xyz) becomes $this-Model-find('axis', array('id' = 'xyz')); // following those links or $this-Model-getByAxis($axis); But in the specific case you presented, you could easily use Model methods overload by calling $this-Model-findById($id), $this-Model- findByFieldName($fieldValue); Still thinks that executing queries is needed? rafaelbandeira3http://rafaelbandeira3.wordpress.com but i heared if you direct query in controller will violate the MVC rule i.e if you use $this-Model-query(select * from models); the above query will violate the MVC rule. i heared the queries shouldnotbe written in controller it should be inmodeli.e in urmodel.php even i am alsonotabsolute on this part On Sep 23, 2:33 pm, forrestgump [EMAIL PROTECTED] wrote: Hey guys, Considering the fact that CakePhp follows the MVC architecture, id like to know...y we dont make function calls such as $this-find(where id=xyz) from function blocks typed out in Models rather than controllersim sure there is a logical reason to it...but someone asked me this question and i couldnotgive her a good enuf answerdoes making function calls to queries like find(), save() work better in models or controllers?.and is it good practice to pass conditions in your function call while using it in a controller? eg find(where id=1) ; Does using $this-find() in controller violate the MVC architecture in any manner? Can someone please clarify these question for us? Thanks in advance, forrestgump --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: To model or not to model
On Wed, Sep 24, 2008 at 1:32 PM, Rafael Bandeira aka rafaelbandeira3 [EMAIL PROTECTED] wrote: First of all people: what Rule? Rule of thumb perhaps? :) -- Misanthropy unleashed: http://dsi.vozibrale.com/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: To model or not to model
Rule of thumb perhaps? :) If you really mean it: Let's say rule of thumb isn't exactly a rule. Now, if you were being ironic: Yay right, that's the kind of rule that can be applied to a pattern! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: To model or not to model
Well, calling find() in a controller is not a violation, but not the best practice if overused. Of course, calling find() from a controller is the fastest way to get your data, but usually, the find() call has other stuff around it, stuff that might be common to each call. The idea is to make fat models, thin controllers, meaning that you put as much as you can in your models. Maybe an example is better. Let's say you have a certain criteria for getting an article from the Article model. You can call this from a controller each time you want to get an article: $article = $this-Article-find ( 'first', array ( 'conditions' = array('Article.slug' = $slug), 'contain' = array('ArticleCategory', 'Rating') ) ); or you can make it cleaner and easier by declaring a function in your model, for example getArticle: function getArticle($slug) { $_slug = Sanitize::escape($slug); return $this-find ( 'first', array ( 'conditions' = array('Article.slug' = $_slug), 'contain' = array('ArticleCategory', 'Rating') ) ); } this makes your controller much thinner and easier to follow: $article = $this-Article-getSingle($slug); All you have to remember is that all apps work with some sort of data, and in Cake, models work with data, not controllers. I hope that helps a bit. ;) On Sep 23, 11:33 am, forrestgump [EMAIL PROTECTED] wrote: Hey guys, Considering the fact that CakePhp follows the MVC architecture, id like to know...y we dont make function calls such as $this-find(where id=xyz) from function blocks typed out in Models rather than controllersim sure there is a logical reason to it...but someone asked me this question and i could not give her a good enuf answerdoes making function calls to queries like find(), save() work better in models or controllers?.and is it good practice to pass conditions in your function call while using it in a controller? eg find(where id=1) ; Does using $this-find() in controller violate the MVC architecture in any manner? Can someone please clarify these question for us? Thanks in advance, forrestgump --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: To model or not to model
Also worth noting: A controller can have multiple Models. Which model would $this-find() use? On Sep 23, 12:28 pm, dr. Hannibal Lecter [EMAIL PROTECTED] wrote: Well, calling find() in a controller is not a violation, but not the best practice if overused. Of course, calling find() from a controller is the fastest way to get your data, but usually, the find() call has other stuff around it, stuff that might be common to each call. The idea is to make fat models, thin controllers, meaning that you put as much as you can in your models. Maybe an example is better. Let's say you have a certain criteria for getting an article from the Article model. You can call this from a controller each time you want to get an article: $article = $this-Article-find ( 'first', array ( 'conditions' = array('Article.slug' = $slug), 'contain' = array('ArticleCategory', 'Rating') ) ); or you can make it cleaner and easier by declaring a function in your model, for example getArticle: function getArticle($slug) { $_slug = Sanitize::escape($slug); return $this-find ( 'first', array ( 'conditions' = array('Article.slug' = $_slug), 'contain' = array('ArticleCategory', 'Rating') ) ); } this makes your controller much thinner and easier to follow: $article = $this-Article-getSingle($slug); All you have to remember is that all apps work with some sort of data, and in Cake, models work with data, not controllers. I hope that helps a bit. ;) On Sep 23, 11:33 am, forrestgump [EMAIL PROTECTED] wrote: Hey guys, Considering the fact that CakePhp follows the MVC architecture, id like to know...y we dont make function calls such as $this-find(where id=xyz) from function blocks typed out in Models rather than controllersim sure there is a logical reason to it...but someone asked me this question and i could not give her a good enuf answerdoes making function calls to queries like find(), save() work better in models or controllers?.and is it good practice to pass conditions in your function call while using it in a controller? eg find(where id=1) ; Does using $this-find() in controller violate the MVC architecture in any manner? Can someone please clarify these question for us? Thanks in advance, forrestgump --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: To model or not to model
hi forrestgump, using $this-find() in controller doesn't voilate the MVC architecture even if you use $this-find('all') but i heared if you direct query in controller will violate the MVC rule i.e if you use $this-Model-query(select * from models); the above query will violate the MVC rule. i heared the queries should not be written in controller it should be in model i.e in ur model.php even i am also not absolute on this part On Sep 23, 2:33 pm, forrestgump [EMAIL PROTECTED] wrote: Hey guys, Considering the fact that CakePhp follows the MVC architecture, id like to know...y we dont make function calls such as $this-find(where id=xyz) from function blocks typed out in Models rather than controllersim sure there is a logical reason to it...but someone asked me this question and i could not give her a good enuf answerdoes making function calls to queries like find(), save() work better in models or controllers?.and is it good practice to pass conditions in your function call while using it in a controller? eg find(where id=1) ; Does using $this-find() in controller violate the MVC architecture in any manner? Can someone please clarify these question for us? Thanks in advance, forrestgump --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: accessing model from inside another model
You can use: 1. app_model.php 2. request action in different controller 3. var uses if you want the 2 model in the same controller -- http://riky.kurniawan.us On 2/22/07, teesea [EMAIL PROTECTED] wrote: I'm trying to access a model from another model when I perform a save, there is no association between the two, but in the system i am trying to complete one does have a logically effect on the other and I would like to run code in one model which then runs code on another. Anyone know how to do this? Cheers Teesea --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: accessing model from inside another model
If there's no relation betweeen the two and you really need it, put this incide your model: loadModel('ModelB'); $ModelB = new ModelB(); And now you can use $ModelB as any normal model. -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog: http://www.MarianoIglesias.com.ar -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de teesea Enviado el: Jueves, 22 de Febrero de 2007 11:25 a.m. Para: Cake PHP Asunto: accessing model from inside another model I'm trying to access a model from another model when I perform a save, there is no association between the two, but in the system i am trying to complete one does have a logically effect on the other and I would like to run code in one model which then runs code on another. Anyone know how to do this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: accessing model from inside another model
wow, I never realize loadModul Thanx Mariano -- http://riky.kurniawan.us On 2/22/07, Mariano Iglesias [EMAIL PROTECTED] wrote: If there's no relation betweeen the two and you really need it, put this incide your model: loadModel('ModelB'); $ModelB = new ModelB(); And now you can use $ModelB as any normal model. -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog: http://www.MarianoIglesias.com.ar -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de teesea Enviado el: Jueves, 22 de Febrero de 2007 11:25 a.m. Para: Cake PHP Asunto: accessing model from inside another model I'm trying to access a model from another model when I perform a save, there is no association between the two, but in the system i am trying to complete one does have a logically effect on the other and I would like to run code in one model which then runs code on another. Anyone know how to do this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: accessing model from inside another model
Thanks both of you for your help :D On 22 Feb, 15:36, Riky Kurniawan [EMAIL PROTECTED] wrote: wow, I never realize loadModul Thanx Mariano -- http://riky.kurniawan.us On 2/22/07, Mariano Iglesias [EMAIL PROTECTED] wrote: If there's no relation betweeen the two and you really need it, put this incide your model: loadModel('ModelB'); $ModelB = new ModelB(); And now you can use $ModelB as any normal model. -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog:http://www.MarianoIglesias.com.ar -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de teesea Enviado el: Jueves, 22 de Febrero de 2007 11:25 a.m. Para: Cake PHP Asunto: accessing model from inside another model I'm trying to access a model from another model when I perform a save, there is no association between the two, but in the system i am trying to complete one does have a logically effect on the other and I would like to run code in one model which then runs code on another. Anyone know how to do this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: $this-Model-findAll() with a model over 5000 records.
Maybe you can even use pagination[1] :) HTH bye Davide 1. http://wiki.cakephp.org/tutorials:pagination signature.asc Description: OpenPGP digital signature
Re: $this-Model-findAll() with a model over 5000 records.
To retrieve that many records and instantiate the classes, it is using more than your PHP settings allow for a single script ( see memory_limit in your php.ini , default is 8MB ). So, you can either retrieve less records, or you can increase this memory limit. To only retrieve the 50 records that used to be the default for findAll (but was removed around v1.0), then just have $this-set('data', $this-Product-findAll(null,null,null,50)); Or, to increase the memory PHP can use for your script (if you do want all 5000 records) ini_set( 'memory_limit', '64M' ); (or whatever memory size seems appropriate for your server specs and load) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: $this-Model-findAll() with a model over 5000 records.
Thanks that did the trick! Apreciate your help. I guess I will have to learn how pagination works to display all that data. On 6/15/06, Grant Cox [EMAIL PROTECTED] wrote: To retrieve that many records and instantiate the classes, it is using more than your PHP settings allow for a single script ( see memory_limit in your php.ini , default is 8MB ). So, you can either retrieve less records, or you can increase this memory limit. To only retrieve the 50 records that used to be the default for findAll (but was removed around v1.0), then just have $this-set('data', $this-Product-findAll(null,null,null,50)); Or, to increase the memory PHP can use for your script (if you do want all 5000 records) ini_set( 'memory_limit', '64M' ); (or whatever memory size seems appropriate for your server specs and load) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: $this-Model-findAll() with a model over 5000 records.
Carlos Mauricio Samour ha scritto: Hi everyone. I am having this problem trying to retrieve the data from one of my models. In my controller I use: function index(){ $this-set('data', $this-Product-findAll()); } set to the findAll function a field array: get only the data you need ! $this-set('data', $this-Product-findAll(null,array('id','name','price',description))); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---