Re: model links, question from noob.
Great, you saved me a lot of time! And to answer your question, well i just missed it, yes, it's more logical to name that field category_id On 11 фев, 19:41, jodator wrote: > Add containable behavior (http://book.cakephp.org/view/474/ > Containable) > > then: > > $this->Fest->find('first', > array( > 'conditions' => array( > 'Fest.id' => $id, > ), > 'contain' => array( > 'Linup' => array( > 'order' => array('Lineup), > //other stuff > ), > //'Category' is not fetched > ), > ) > ); > > ps.; why do you have: > > 'foreignKey' => 'category' // not 'category_id' ?? > > On Feb 11, 2:41 pm, johnbl4ck wrote: > > > > > Hi all! > > > I love this feature of cakephp, however i have some questions. > > > this is my model: > > > class Fest extends AppModel { > > var $name = 'Fest'; > > var $useTable = 'fests'; > > > var $belongsTo = array( > > 'Category' => array( > > 'className' => 'Category', > > 'foreignKey' => 'category' > > ) > > ); > > > var $hasMany = array( > > 'Lineup' => array( > > 'className' => 'Lineup', > > 'foreignKey' => 'fest_id' > > ) > > ); > > > } > > > as you can see it defines hasMany link, so when i do $this->Fest- > > > >find('all') it pulls Lineup for each item of Fest. > > > The question is: > > Lineup is also linked to Artist by belongsTo bond. Is it possible to > > fetch all required data (Fest->Lineup->Artist) in one single Fest > > call? That would be awesome but i don't know how to do that and stick > > to > > > $f = $this->Fest->find($id); > > $l = $this->Lineup->find('all', array('conditions'=> > > array('fest_id' > > => $id), 'order' => 'Lineup.status DESC')); > > > which i think is not the best solution. 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
model links, question from noob.
Hi all! I love this feature of cakephp, however i have some questions. this is my model: class Fest extends AppModel { var $name = 'Fest'; var $useTable = 'fests'; var $belongsTo = array( 'Category' => array( 'className' => 'Category', 'foreignKey' => 'category' ) ); var $hasMany = array( 'Lineup' => array( 'className' => 'Lineup', 'foreignKey' => 'fest_id' ) ); } as you can see it defines hasMany link, so when i do $this->Fest- >find('all') it pulls Lineup for each item of Fest. The question is: Lineup is also linked to Artist by belongsTo bond. Is it possible to fetch all required data (Fest->Lineup->Artist) in one single Fest call? That would be awesome but i don't know how to do that and stick to $f = $this->Fest->find($id); $l = $this->Lineup->find('all', array('conditions'=> array('fest_id' => $id), 'order' => 'Lineup.status DESC')); which i think is not the best solution. 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
Re: Wordpress CakePHP Authorization Integration
hi there! please share this stuff, i have a monstrous size blog and small but very important app on cakephp, i also would like to use your solution. On 12 дек 2009, 18:40, jgadbois wrote: > So I got it working (still not sure if it's the best way). I made a > WP Authentication Component that copies Wordpress's mechanism for > authentication (does a bunch of hash stuff on a cookie). I also made > it work with a CakePHP User model that accesses the WP user database > so that I can use that for more fine grained permissions down the > road. > > Thanks, > John > > On Dec 12, 12:50 am, "Dr. Loboto" wrote: > > > One my collegue did it from other side: let user authorize from > > CakePHP site part only and catch cake session in wordpress. > > > On Dec 12, 8:47 am, jgadbois wrote: > > > > I have a Wordpress site with a lot of content that I want to integrate > > > CakePHP into. I want to required users to be logged in to be able to > > > use the application so I want to integrate the CakePHP Auth component > > > with Wordpress. I've thought of a couple possible ways of doing this. > > > > 1. Create a WP plugin that calls the User login method in the cakePHP > > > controller, then redirects from within CakePHP to wherever Wordpress > > > would normally send the user. This seems possible, but I'm not sure > > > how to handle the redirection properly. > > > > 2. Somehow automatically log in the user to CakePHP after WP by > > > setting the approriate Auth session variables. > > > > 3. Override CakePHP's authorization check somehow by just checking > > > the WP session. > > > > I'm not 100% sure on how to do any of these yet, but I'm sure one > > > would work. Anyone have any suggestions? I'm looking for the > > > preferred approach plus some details on how to implement as I'm not an > > > Auth component expert by any means. > > > > Thanks, > > > John 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
Re: stuck with Configure::store
yeah actually after i posted this message i found that solution too. thanks On 18 нояб, 05:03, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote: > I use this in APP/config/bootstrap.phphttp://bin.cakephp.org/saved/34212 > > HTH, > - Dardo Sordi. > > On Mon, Nov 17, 2008 at 9:45 AM, johnbl4ck <[EMAIL PROTECTED]> wrote: > > > i'm writing small config controller to store application-wide > > variables. i read them through Configure::read, everything is ok, but > > configure::store drives me insane. > > > initial custom config file looks like: > > > $config['hotcake'] = array( > > 'sitename' => 'hotcake 2.0 alpha', > > 'version' => '2.0.alpha', > > 'title' => 'My Application', > > 'feedbackemail' => '[EMAIL PROTECTED]', > > 'furls' => 1 > > ); > > > $config['rus'] = array( > > 'sitename' => 'Название сайта', > > 'version' => 'Версия', > > 'title' => 'Тайтл', > > 'feedbackemail' => 'Емейл, на который будет уходить обратная > > связь', > > 'furls' => 'Friendly URLs' > > > ); > > > $config['hotcake'] is settings array and $config['rus'] is form labels > > array. > > > but when i call > > > Configure::store('hotcake', 'hotcake.config', array('hotcake' => $this- > >>data['config'])); > > > it writes > > > > $config = array(); > > $config['hotcake']['hotcake'] = array('sitename' => 'hotcake 2.0 > > alpha', 'version' => '2.0.alpha', 'title' => 'My Application', > > 'feedbackemail' => '[EMAIL PROTECTED]', 'furls' => '1', ); > > > to app/tmp/cache/persistent/hotcake.config.php without trailing "?>" > > but i assume it should save to /config/hotcake.config.php > > > how can i solve this issue? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
stuck with Configure::store
i'm writing small config controller to store application-wide variables. i read them through Configure::read, everything is ok, but configure::store drives me insane. initial custom config file looks like: $config['hotcake'] = array( 'sitename' => 'hotcake 2.0 alpha', 'version' => '2.0.alpha', 'title' => 'My Application', 'feedbackemail' => '[EMAIL PROTECTED]', 'furls' => 1 ); $config['rus'] = array( 'sitename' => 'Название сайта', 'version' => 'Версия', 'title' => 'Тайтл', 'feedbackemail' => 'Емейл, на который будет уходить обратная связь', 'furls' => 'Friendly URLs' ); $config['hotcake'] is settings array and $config['rus'] is form labels array. but when i call Configure::store('hotcake', 'hotcake.config', array('hotcake' => $this- >data['config'])); it writes 'hotcake 2.0 alpha', 'version' => '2.0.alpha', 'title' => 'My Application', 'feedbackemail' => '[EMAIL PROTECTED]', 'furls' => '1', ); to app/tmp/cache/persistent/hotcake.config.php without trailing "?>" but i assume it should save to /config/hotcake.config.php how can i solve this issue? --~--~-~--~~~---~--~~ 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: getting mysql error 1064 when use execute(), but syntax is right!
thanks a lot that worked. strangely i didn't find info about deprecation of execute() man you saved my day ;) On 7 нояб, 15:43, Daniel Hofstetter <[EMAIL PROTECTED]> wrote: > Hi, > > > > > upgrading my app to work with cake 1.2 rc3 on local dev machine and > > got strange issue. > > > $queryt = $this->Section->execute('select * from sections;'); > > > produces error > > > >SQL Error: 1064: You have an error in your SQL syntax; check the manual > > >that corresponds to your >MySQL server version for the right syntax to use > > >near '' at line 1 [CORE/cake/libs/model/datasources/dbo_source.php, line > > >521] > > > >$sql = "execute" > > >$error = "1064: You have an error in your SQL syntax; check the > > >manual that corresponds to your >MySQL server version for the right syntax > > >to use near '' at line 1" > > >$out = null > > >Query: execute > > > and so with every sql query via execute call. the syntax of sql is ok > > but still getting this error. everything worked fine in 1.1 > > > or may be this is due php or mysql configuration? > > Well, you get this error because the execute() method no longer exists > in Cake 1.2. You have to use the query() method instead, or in your > example you could also use $this->Section->find('all'); > > Hope that helps! > > -- > Daniel Hofstetterhttp://cakebaker.42dh.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 -~--~~~~--~~--~--~---
getting mysql error 1064 when use execute(), but syntax is right!
upgrading my app to work with cake 1.2 rc3 on local dev machine and got strange issue. $queryt = $this->Section->execute('select * from sections;'); produces error >SQL Error: 1064: You have an error in your SQL syntax; check the manual that >corresponds to your >MySQL server version for the right syntax to use near '' >at line 1 [CORE/cake/libs/model/datasources/dbo_source.php, line 521] > >$sql = "execute" >$error = "1064: You have an error in your SQL syntax; check the manual >that corresponds to your >MySQL server version for the right syntax to use >near '' at line 1" >$out = null >Query: execute and so with every sql query via execute call. the syntax of sql is ok but still getting this error. everything worked fine in 1.1 or may be this is due php or mysql configuration? --~--~-~--~~~---~--~~ 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: how can i set one controller to render actions from another controller in cakephp 1.2
yes i got that. but http://127.0.0.2/sections/view/14/autocard/4 actually calls sections controller with method view and param 14, autocard is method of cars controller and it's param should be 4 but i can't get how to handle this via requestAction On 28 окт, 14:09, zwobot <[EMAIL PROTECTED]> wrote: > Passing parameters via URL: > / > > > Parameters are added with slashes into the URL after the action name, > so if you have an action autocard in your controller: (let's assume it > is called PostsController) > > function autocard ($param1, $param2) { > echo $param1; > echo $param2; > > } > > Now you can call this function with the URL /posts/autocard/hello/ > world > and it would print you in the view: hello world --~--~-~--~~~---~--~~ 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: how can i set one controller to render actions from another controller in cakephp 1.2
and then again, how can i pass some parameters via url. e.g. i have url like http://127.0.0.2/sections/view/14/autocard-3 this means that i call some controller with method autocard to get record with id = 3. if ($ctrlr != 'sections') { (isset($action)) ? $action : $action = 'index'; $cAct = explode('-', $action); $this->set('pish', $this->requestAction(array('controller' => $ctrlr, 'action' => $cAct[0]), array('return'))); } this will work but wil not do what i need. but if i change $this->set('pish', $this->requestAction(array('controller' => $ctrlr, 'action' => $cAct[0]), array('return'))); to $this->set('pish', $this->requestAction(array('controller' => $ctrlr, 'action' => $cAct[0]($cAct[1])), array('return'))); cakephp ends up with error Fatal error: Call to undefined function autocard() in /var/www/hotcake/app/controllers/sections_controller.php on line 55 On 28 окт, 12:37, johnbl4ck <[EMAIL PROTECTED]> wrote: > hello, i'm new to cakephp. in my app there's controller named sections > which renders pages and there're multiple controllers for special > actions (e.g. photos, shop, etc). > > what i'm trying to do is to create whole pages structure with sections > controller and set some pages to be rendered by other controllers in > backend. > > i found out that renderAction will do this task > > e.g. > > $this->set('pish', $this->requestAction(array('controller' => 'photo', > 'action' => 'index'), array('return'))); > > is it ok to use renderAction or there's better way to do it? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
how can i set one controller to render actions from another controller in cakephp 1.2
hello, i'm new to cakephp. in my app there's controller named sections which renders pages and there're multiple controllers for special actions (e.g. photos, shop, etc). what i'm trying to do is to create whole pages structure with sections controller and set some pages to be rendered by other controllers in backend. i found out that renderAction will do this task e.g. $this->set('pish', $this->requestAction(array('controller' => 'photo', 'action' => 'index'), array('return'))); is it ok to use renderAction or there's better way to do it? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---