Re: mysql join query gives too much results, twice.
Hi, To have the categories of a product, I would search from Product model. If recursive = 1 the associated categories would be in the result. $this-Category-Product-find('first', array( 'conditions' = array('Product.id'=$pid) )); Or you can use Containable behavior to control what you want in the result. You have in your Product model : public $actsAs = array('Containable'); public $hasAndBelongsToMany = array( 'Category' = array( 'className' = 'Category', 'joinTable' = 'cat_connect', 'foreignKey' = 'product_id', 'associationForeignKey' = 'category_id', ) ); to find the categories from the Controller : $this-Product-find('first', array( 'conditions' = array('Product.id'=$pid), 'contain' = array('Category.name') )); sorry if I have not answered the question, hope this helps BenJ Le mardi 15 octobre 2013 11:48:40 UTC+2, UltraMarkus a écrit : Hi, As im new to this group, i first want to apologize for my bad english. Just starded to use cakePHP 2 weeks ago, and i must say, great work!!! I managed to get my things to be done and Im gratefull for excistence of it. But hey, now im stuck with my query, and believe me, i searched a lot. However, I might not understand what Im doing or it's just a hard trick. Here is my query: $this-set('categorienAdded', $this-Categorie-find('all',array('joins' = array( array( 'table' = 'categories', 'alias' = 'cat', 'type' = 'inner', 'foreignKey' = false, 'conditions'= array('') ), array( 'table' = 'cat_connects', 'alias' = 'cat_con', 'type' = 'inner', 'foreignKey' = false, 'conditions'= array( 'cat.id = cat_con.categorie_id', 'cat_con.product_id' = $pid) ) ) ))); My tables are : cat_connect: id product_id categorie_id 1 65 4 2 64 2 3 64 1 categories: id naam 1 Categorie 1 2 Test 3 Work 4 Temp As my $pid = 64 I whould like to have only 'Categorie 1' and 'Test' in my result. However, i get all Names twice. How should i build my query? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Issues have moved to Github
As it's about a part of the CakePHP framework, I don't see why it should be wrong to put it into its issue list. https://github.com/cakephp/cakephp/issues Marc Am Dienstag, 15. Oktober 2013 09:01:50 UTC+2 schrieb Reuben: Where might one submit an issue about installing via Composer for CakePHP 2.4.1? I couldn't see a repository responsible for the Vendor/bin/cake.bat file imported or generated when performing a CakePHP install via Composer. Regards Reuben Helms On Saturday, 12 October 2013 12:41:57 UTC+10, mark_story wrote: The CakePHP team is happy to announce that as of today both issues and pull requests will be managed at github. We have archived the lighthouse projects and made them read-only. All open tickets from lighthouse have been migrated to their respective github projects. We'll be continuing to wrangle and update tickets in github over the next few days. We'll also be updating the links on the various CakePHP sites to reflect this change, and ask your patience while we get all the information updated. ## Why change? While moving bug trackers is rarely a pleasant experience, we think the move to github will be positive for the community. Since our move to lighthouse in 2009, the ticket management features provided by github have improved dramatically. With excellent search and tight integration with pull requests we feel the ticketing features provided by github now offer a number of advantages over lighthouse. We hope that moving issues to github makes it easier and simpler for new and existing contributors to continue making CakePHP a fantastic project. We'd like to thank lighthouse for the excellent service and hosting over the past 4 years. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Pagination Help
Now this used to work, but now it does not.. Not sure what happened. I have standard pagination but offer the ability to paginate listings based on featured. ?php $this-Paginator-options(array('url'= array($this-params['pass'])));? So if featured was passed it would then only display featured listings and paginate correct. Now it just defaults back to standard (non-featured) listings. Initial page of featured is fine but all the pagination links do not continue to carry the listings/featured/page:xxx it goes to listings/page:xxx Any insight would be great. Version 2.3.8 Thanks, Dave -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Where to place this logic?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Reuben, thank you for your answer. I will try araound a bit and will let you know what finally worked for me! Calamity Jane Am 15.10.2013 09:28, schrieb Reuben: I can't say what is best practice, but here are things that I've done in the past. Putting in a component: For a little bit, I was shoving things that did not need to be directly in the Model, into a component. This is great, as long as you only need to access that logic from a Controller. However, if the existing logic is already in a Model, and you want to move it out, then I would not suggest the component. For me, the Component is about subtlely changing the behavior of the controller, making use of startUp, shutdownDown and the lifecycle flow. If the logic doesn't have anything to do with lifecycle of the controller, then I wouldn't bother putting it in the component. Putting in a lib: My next pattern was putting functionality into a Lib/* directory. I was particularly fond of doing this for SOAP Web Services. The controller would still call a model, but then the model would call the Web Service to perform SOAP call. The advantage was that these Web Service libraries would be available from controllers and components as well. My 2 cents. Go nuts with the structure if your app. If you have an obese model that is filled with helper functions that don't directly need services provided by the model, don't be afraid to add structure that suites you. I would create a ModelHelper directory, and then create model helper classes that the model would call as required. i.e. Model/MyObeseModel.php ModelHelper/MyObeseModelHelper.php and in MyObeseModel.php App::uses('MyObeseModelHelper', 'ModelHelper'); Then you can create a new instance of MyObeseModelHelper as you need it, or instantiate it in the constructor, so it's always available. If they're really helper methods, you might get away with having them be static, and pass the model in. At least by using ModelHelper, you avoid a Lib directory that could get filled with all sorts of cruft, and know that ModelHelper contains helpers for models. You could go one step further have have Model\Helper\MyObeseModelHelper.php. I think that might be possible with CakePHP 2.x and the App::uses() clause, and would probably do rather well in CakePHP 3.0, when we can start using namespaces properly. This might not be the best way, but it's a way, and I'd also love to hear if anyone else has a recommendation or two. Regards Reuben Helms On Sunday, 13 October 2013 23:49:14 UTC+10, acl68 wrote: Hello everybody, I have a slightly advanced question. I just build an app which at some point goes through a lot of evaluation methods to find a certain value in a heap of values. I want to follow the fat model theory also because it makes methods easier for unit tests. Now my model shows a tendency to not only become fat, but obese and I consider putting the advanced logic in another place. The question is: What could that be? Normally I would create models which would extend my obese model and place the methods there so they are out of the way. But most of these methods don't need direct dealing with the database so I could just put them elsewhere shuffle data in and get the output out after they went though this black evaluation box. Would a component be this place? Or a model without db table? What would be the professional CakePHP way of doing this? Thanky for any hints in advance as always! Anja -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlJe62UACgkQbOdiIJzHNKExhQCfcTrVbuR74CTOQAVY7GNV8HWR YlkAn2JdoxAefiJmJJmENXGkAGzTj8rG =Ec3A -END PGP SIGNATURE- -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: cakephp 1 cakes to power multiple sites
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 14.10.2013 12:52, schrieb Abc: Did you all know how to do different layout with different domain in same app? I never did that so far, but how about calling different templates with a switch on the $_SERVER['HTTP_HOST'] ( I guess that is the correct one). Maybe not elegant, but the first ide, which came to my mind. Calamity Jane -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlJe7BkACgkQbOdiIJzHNKExhQCgje9497xFz66fn80qggAEHWAd ZPIAn2MNNrbgA7zIaCYrByJnCUALCFjv =EArk -END PGP SIGNATURE- -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
$this-requestAction() in commandline
Hi All, anyone has able to manage $this-requestAction in commandline, CakeRoute and Router::parse ? regards, -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.