hasMany through: my neverending problem?
I have two tables: attractions accessibilities. I want to display which people can go on which rides so I invented a new, joined table called accessibilities_attractions. Here's a visual representation of it: https://lh6.googleusercontent.com/-nvhLQ93GqnY/Ut6PLdpucjI/ADU/ZHLBmBMJWB4/s1600/table.jpg Data in table attraction (id - name) can be: 1 - Rollercoaster name 2 - Big Rollercoaster name 3 - Realy Big Rollercoaster name 4 - Biggest Rollercoaster ever seen name Table accessibilities (id - name) has exactly 3 records: 1 - Forbidden 2 - Accessible with supervisor 3 - Accessible Data in accessibilities_attractions (accessibility_id - attraction_id - min - max) can be: Forbidden - Big Rollercoaster name - null - 110 Accessible with supervisor - Big Rollercoaster name - 110 - 130 Accessibile - Big Rollercoaster name - 130 - null Forbidden - Biggest Rollercoaster ever seen name - Forbidden - null - 140 Accessibile - Biggest Rollercoaster ever seen name - 140 - null As I am developping a CMS system, I've made a plugin called CoasterCMS. By this way, I implement a whole CMS system to CRUD the website elements of my favourite theme park (e.g. attractions, animals, events, ...) To go further, I've created three models: *Accessibility.php* ?php class Accessibility extends CoasterCmsAppModel { public $hasMany = array( 'CoasterCms.AccessibilityAttraction' ); } *Attraction.php* class Attraction extends CoasterCmsAppModel { ... public $hasMany = array( 'CoasterCms.AccessibilityAttraction' ); ... } *AccessibilityAttraction.php* ?php class AccessibilityAttraction extends CoasterCmsAppModel { public $belongsTo = array( 'CoasterCms.Accessibility', 'CoasterCms.Attraction' ); } Now, I've created a model so I can insert, change and delete records in table accessibilities_attractions: *AccessibilitiesAttractionsController.php* ?php class AccessibilitiesAttractionsController extends CoasterCmsAppController { public $helpers = array('Html', 'Form', 'Session'); public $components = array('Session'); public function index() { debug($this-AccessibilityAttraction-find('all')); } ... } And that's the point where my problem comes in. Every time I try to get the records via the find('all') method in my index action, I'm not getting an object at all: Error: Call to a member function find() on a non-object File: D:\Websites\BellewaerdeFun 2014\03 - Online\app\Plugin\CoasterCms\Controller\AccessibilitiesAttractionsController.php Line: 10 I realy don't understand what goes wrong, because I ordered myself to stick on the CakePHP name conventions so nothing can go wrong... Can anyone see what I'm doing wrong? After 2 days of searching, I cannot povide the solution on my own... Thanks in advance :) -- 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.
Little trick to return json
Sorry for the poor english. I created a piece of code that solved my problem in returning a JSON object and helped me not to re-write all views. I await your feedback pros and cons. class AppController extends Controller { public $components = array('RequestHandler'); function beforeRender() { if ($this-RequestHandler-*isAjax*()) { $this-layout = '*ajax*'; $this-RequestHandler-setContent('*json*', ' *application/json*'); $this-*viewVars *= json_encode($this-*viewVars*); *return false*; } } } If an Ajax request is performed automatically be returns a JSON object with the query result. $.ajax({ url: http://localhost/aplication/users;, type: POST, dataType: *json* }); -- 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.
cookbook
As I am studying CakePHP, the 2.0 cookbook is essential. I discovered many places in it where the level of knowledge needed to understand a topic is raised. In these conditions I think it's a heroic act to start learning Cake. I propose to you that the cookbook or any other introductory manual be organized as a wiki project. Something like the php manual in html form, with many comments at the base of the page: extremely useful. The learning curve could be steeper. The overall productivity and user base will increase. With a translation tool on each page. With many links to explain the terms. -- 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 bake command not working in CLI
In Ubuntu Linux I had to install it using the following command: apt-get install cakephp-scripts then it worked: cake bake luni, 30 septembrie 2013, 16:40:25 UTC+3, Victor Musvibe a scris: I have got an application that i am working on built using Cakephp 1.3 problem that i am having is that i am failing to bake using CLI. I am using Windows 7 and xampp as my localserver. This is how i have added my Environment Variables. C:\xampp\php;C:\xampp\htdocs\myappname\cake\console\ When i type cake command in the CLI i get an error 'cake' is not recognized as an internal or external command, operable program or batch file. Does anyone have an idea on how to fix this. I have also asked the same question on SO and i dont seem to get answer - http://stackoverflow.com/questions/19094349/cakephp-bake-command-not-working-in-cli -- 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.
HMVC vs MVC
I kindly ask you all if HMVC (Hierarhical MVC) in cakePHP is actually MVC with controllers+actions. -- 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: cookbook
No one is stopping you to do so. Dave Maharaj Freelance Designer | Developer Description: header_logo www.movepixels.com | mailto:d...@movepixels.com d...@movepixels.com | 709.800.0852 From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of MihaiTL Sent: Tuesday, January 21, 2014 8:10 PM To: cake-php@googlegroups.com Subject: cookbook As I am studying CakePHP, the 2.0 cookbook is essential. I discovered many places in it where the level of knowledge needed to understand a topic is raised. In these conditions I think it's a heroic act to start learning Cake. I propose to you that the cookbook or any other introductory manual be organized as a wiki project. Something like the php manual in html form, with many comments at the base of the page: extremely useful. The learning curve could be steeper. The overall productivity and user base will increase. With a translation tool on each page. With many links to explain the terms. -- 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. -- 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. image001.jpg
Re: cookbook
Hello Mihaitl, In order to learn cake or any other framework, you should first had knowledge of OO programming, i really dont feel like aa heroe...haha, and im pretty new to cake. Give it a try again, it is really simple to start and the learning curve is quite short. Have my best regards. 2014/1/21 MihaiTL maft...@gmail.com As I am studying CakePHP, the 2.0 cookbook is essential. I discovered many places in it where the level of knowledge needed to understand a topic is raised. In these conditions I think it's a heroic act to start learning Cake. I propose to you that the cookbook or any other introductory manual be organized as a wiki project. Something like the php manual in html form, with many comments at the base of the page: extremely useful. The learning curve could be steeper. The overall productivity and user base will increase. With a translation tool on each page. With many links to explain the terms. -- 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. -- *Carlos Baeza Negroni* +56985644026 http://carlosbaeza.net @cjbaezilla http://cl.linkedin.com/in/cjbaeza http://cl.linkedin.com/in/cjbaeza -- 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: Router redirect pass all parameters to another domian
As Reuben said - you will be far better off with a Web Server based redirect. This way your application will not get called at all. On Monday, 20 January 2014 23:49:09 UTC+2, gonzela2006 wrote: Hello, I want to use *Router::redirect* to redirect to another domain and pass all parameters to this domain Example: Redirect this url http://domain-*one*.com/posts/view/1 to http://domain-*two*.com/posts/view/1 I tried the following Router::redirect( '/*', 'http://domain-*two*.com/', array('persist' = true) ); but it redirect to http://domain-*two*.com/ without parameters. Please advise Thanks -- 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: Little trick to return json
Where is the magic? What's so special? Simply spitting out the results in JSON……… and? Dave Maharaj Freelance Designer | Developer Description: header_logo www.movepixels.com | mailto:d...@movepixels.com d...@movepixels.com | 709.800.0852 From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Rubensvsx Sent: Tuesday, January 21, 2014 12:29 PM To: cake-php@googlegroups.com Subject: Little trick to return json Sorry for the poor english. I created a piece of code that solved my problem in returning a JSON object and helped me not to re-write all views. I await your feedback pros and cons. class AppController extends Controller { public $components = array('RequestHandler'); function beforeRender() { if ($this-RequestHandler-isAjax()) { $this-layout = 'ajax'; $this-RequestHandler-setContent('json', 'application/json'); $this-viewVars = json_encode($this-viewVars); return false; } } } If an Ajax request is performed automatically be returns a JSON object with the query result. $.ajax({ url: http://localhost/aplication/users;, type: POST, dataType: json }); -- 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. -- 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. image001.jpg
Re: Little trick to return json
This is an excellent idea. Thx for sharing. Sent from my BlackBerry 10 smartphone on the TELUS network. From: RubensvsxSent: Wednesday, January 22, 2014 4:07 AMTo: cake-php@googlegroups.comReply To: cake-php@googlegroups.comSubject: Little trick to return jsonSorry for the poor english.I created a piece of code that solved my problem in returning a JSON object and helped me not to re-write all views. I await your feedback pros and cons.class AppController extends Controller { public $components = array('RequestHandler'); function beforeRender() {if ($this-RequestHandler-isAjax()) { $this-layout = 'ajax'; $this-RequestHandler-setContent('json', 'application/json'); $this-viewVars = json_encode($this-viewVars); return false;} }}If an Ajax request is performed automatically be returns a JSON object with the query result.$.ajax({ url: "http://localhost/aplication/users", type: "POST", dataType: "json"}); -- 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. -- 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: Little trick to return json
You could cut down your code by almost have and drop every second line when following the documentation regarding JsonView: http://book.cakephp.org/2.0/en/views/json-and-xml-views.html No need to fight the framework and manually set response type and alike Also, I highly recommend using /users.json as request url. This way you also trigger a lot of Cake magic as well. And you are down to none of your code above, as CakePHP would do all that for you right away. See www.dereuromark.de/2014/01/09/ajax-and-cakephp Am Dienstag, 21. Januar 2014 16:59:11 UTC+1 schrieb Rubensvsx: Sorry for the poor english. I created a piece of code that solved my problem in returning a JSON object and helped me not to re-write all views. I await your feedback pros and cons. class AppController extends Controller { public $components = array('RequestHandler'); function beforeRender() { if ($this-RequestHandler-*isAjax*()) { $this-layout = '*ajax*'; $this-RequestHandler-setContent('*json*', ' *application/json*'); $this-*viewVars *= json_encode($this-*viewVars*); *return false*; } } } If an Ajax request is performed automatically be returns a JSON object with the query result. $.ajax({ url: http://localhost/aplication/users;, type: POST, dataType: *json* }); -- 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.