Like search
I want to do like search in multiple columns, for a few column it is %test and for others it is %test%. How to do you that? --~--~-~--~~~---~--~~ 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: Model without table
Bugger, I always get that one wrong, I obviously don't use it enough... On Mar 11, 8:05 pm, mscdex msc...@gmail.com wrote: On Mar 10, 7:32 am, Walther waltherl...@gmail.com wrote: Just add in your model: var $table = false; Close, it's actually $useTable. --~--~-~--~~~---~--~~ 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: Multiple language supports
Thanks for your reply. I want to translate dynamic content. so, i think second option is preferable. I try to do that by going through http://book.cakephp.org/view/92/Translate Thanks. --~--~-~--~~~---~--~~ 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: Like search
$this-Model-find('all', array( 'conditions' = array('Model.column LIKE' = '%keyword%') )); --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
File Uploading
Hello, I am a new user for cakePHP and I am using $form-file ('UserInfo.company_logo', array('size' = 40)); for uploading an image, but after post, I am getting array like Array ( [data] = Array ( [name] = Array ( [UserInfo] = Array ( [company_logo] = [user_photo] = ) ) [type] = Array ( [UserInfo] = Array ( [company_logo] = [user_photo] = ) ) [tmp_name] = Array ( [UserInfo] = Array ( [company_logo] = [user_photo] = ) ) [error] = Array ( [UserInfo] = Array ( [company_logo] = 4 [user_photo] = 4 ) ) [size] = Array ( [UserInfo] = Array ( [company_logo] = 0 [user_photo] = 0 ) ) ) ) Does anyone has some idea about how to upload an image with cakePHP? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
MVC Design Question
Hi, I am building a small cake application to learn MVC and cakePHP. I have a question about where to put business logic, I have read that controls should be skinny and models should be fat. Eg the business rules should live in the models. In my application I have the following models User, Portfolio, Currency. A user has 1 portfolio which has 1 currency. When I register a user I would like to create their portfolio and assign it the default currency. My question is where to do the creation of the portfolio? (Fat Controller) 1. Call the User model to create a new user. 2. Call the Currency model to get the default currency. 3. Call the Portfolio model to create a new portfolio for the new user with the default currency. Or (Fat Model) 1. The controller calls a custom function on the Users model. Eg registerUser($formData) 2. The User model validates and saves the new user. 3. The user model then calls the Portfolio model to create a new portfolio for the new user. 4. The Portfolio model calls the Currency model to get the default currency and creates the new portfolio for the new user. The advantage I can see to the Fat Model way is that the logic for registering a new user is all in one spot. So if I have many controllers that need to register a new user I can just use the same code. Is this on the right track? Thanks, Alex --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Auth component problem - Cannot login
I have the Auth component working correctly on my development site (localhost). I have a problem when I try to use it on my production server. If I try to access /users/login, I am sent to a 404 page (my web hosts, not a CakePHP page). I have a very simple Auth configuration; I'm using all default values (as described in the CakePHP 1.2 manual), my database has a username and password field, and I'm not trying anything tricky. My controller is called UsersController, my model User, and my view login.ctp. My login function is empty and my view is a very simple form. All taken from the 1.2 manual on the Auth component. Thanks ahead of time for any information. w --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Combining Zend_lucene, Vendors, Component does not my cake make
I have been, for days, trying to add Zend_lucene search to my cake site. It works perfectly when I use it in my controller (i.e. without the component) but I am not having much luck turning it into a component so that it will be available to all of my controllers. This is a site-wide search and the form is to appear on every page. The error I am getting is: Fatal error: Call to a member function query () on a non-object in C:\wamp\www\test\app\controllers\components \lucene.php on line 19 (The file lucene.php is shown in section 3, below.) I realise that this is likely to be more of a PHP error than a cake one, but I am getting the error, I believe, because of CakePHP's file structure and that I have forgotten to do something in the component or vendor sections (making it very much a Cake issue, for me). Below is what I've done. I have extracted the Zend library files into the vendors folder so the structure is: 1) - app/vendors/Zend/Search/Lucene/ - app/vendors/Zend/Search/Lucene.php - app/vendors/Zend/Search/Exception.php 2) In my controller that I want to access this component, I have declared var $components = array('lucene'); 3) The component, lucene.php, contains the following code: ?php $path = APP.'/vendors'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); App::import('Vendor','lucene',array('file'='Zend/Search/ Lucene.php')); class LuceneComponent extends Object { var $controller = null; function startup($controller) { $this-data = $controller; } function build() { $index = Zend_Search_Lucene::create('/tmp/my-index'); //* The line below causes the error** $company_rs = $this-controller-query('MY VALID SELECT STATEMENT'); //... more irrelevant code not included } } ? The query itself (not shown) is valid, so it's not the SQL. What have I done, or not done, to get this to work. Any help would be much appreciated. --~--~-~--~~~---~--~~ 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: Model without table
As per your direction, i have used this code in model: class contact extends AppModel { var $name = 'Contact'; var $table = false; } and this code in controller: class ContactsController extends AppController { var $name = 'Contacts'; var $components = array('RequestHandler'); var $helpers = array('Html', 'Form', 'Javascript', 'Validation'); //var $scaffold; function index() { if (!empty($this-data['Contact'])) { //code for mailing $msg = Successful; } } } Still it is giving this error: Missing Database Table Error: Database table contacts for model Contact was not found. What is wrong in my code? On Mar 11, 11:05 pm, mscdex msc...@gmail.com wrote: On Mar 10, 7:32 am, Walther waltherl...@gmail.com wrote: Just add in your model: var $table = false; Close, it's actually $useTable. --~--~-~--~~~---~--~~ 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: Model without table
On Mar 12, 2:21 am, kaushik kaushikwo...@gmail.com wrote: var $table = false; As previously noted, it should be $useTable and not $table. --~--~-~--~~~---~--~~ 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: Model1 hasMany Model2 with count(), how to get SQL like this?
When you specify fields you are telling Cake which fields to return... in this case only the count... nothing from the primary model. I think a * is enough as an additional field to get all fields. On Mar 12, 3:35 am, Svel svel.so...@gmail.com wrote: Thank You =) Little fix to your reply: $this-find('all', array('fields' = array('COUNT(BaseImage.id) as cnt', 'Base.id'), 'group' = array('BaseImage.id'), 'joins' = array( array( 'type' = null, // or INNER or LEFT - uppered, couse no automatic 'alias' = 'BaseImage', 'table' = 'base_images', // defaults to 'join_table' =) 'conditions' = array('Base.id = BaseImage.base_id') // but not array('Base.id' = 'BaseImage.base_id') ) ) )); What about 'foreignKey' for joins? all other keys found in cake/libs/model/datasources/dbo_source.php lines 1101-1105 and 1223-1229 and 1491-1494 resulting array looks like: array( [0] = array( [0] = array([cnt] = 1) [Base] = array(...) ) [1] = ... ) ... no [BaseImages] key PS: sorry for my english On 11 мар, 18:04, Martin Westin martin.westin...@gmail.com wrote: You probably want a little, slightly obscure, gem called joins. In use it looks something like: $this-find('all', array( 'conditions' = $conditions, 'joins' = array( array( 'table' = 'model2', 'alias' = 'Model2', 'type' = 'inner', 'foreignKey' = model1_id, 'conditions'= array( 'Model2.another_fk = Model1.id' ) ) ) )); Check out Nate's nice article on the subject: (he talks about habtm but it is just as useful for hasMany)http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-... /Martin On Mar 11, 2:39 pm,Svelsvel.so...@gmail.com wrote: Searching for 2 days and found nothing =( How i can build this SQL code: SELECT `m1`.`id`, COUNT(`m2`.`id`) as cnt FROM `m1` LEFT JOIN `m2` ON (`m1`.`id` = `m2`.`m1_id`) WHERE 1=1 GROUP BY `m2`.`m1_id` ORDER BY `m1`.`id` is it real without custom Model-query() ? --~--~-~--~~~---~--~~ 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: Error with use Upload Behaviour of MI-BASE
Yes the error is on the incorrect variable name (should be $fieldName). Many thanks On Mar 11, 4:08 pm, AD7six andydawso...@gmail.com wrote: On Mar 11, 11:43 am, marco.rizze...@gmail.com marco.rizze...@gmail.com wrote: Hi I try to use the upload and image_upload behaviour of MI-BASE project for add field photo to user model My code is: I've been updating the behaviors recently, that looks like an incorrect variable name (should be $fieldName). You'd be better off finding me on irc to discuss problems with code I've written (that isn't in the core) or for simple (or general) errors such as this - investigating/fixing/asking first. Cheers, AD --~--~-~--~~~---~--~~ 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: File Uploading
On Mar 12, 7:08 am, manisha pmanisha1...@gmail.com wrote: Hello, I am a new user for cakePHP and I am using $form-file ('UserInfo.company_logo', array('size' = 40)); for uploading an image, but after post, I am getting array like Array ( [data] = Array ( [name] = Array ( [UserInfo] = Array ( [company_logo] = [user_photo] = ) ) [type] = Array ( [UserInfo] = Array ( [company_logo] = [user_photo] = ) ) [tmp_name] = Array ( [UserInfo] = Array ( [company_logo] = [user_photo] = ) ) [error] = Array ( [UserInfo] = Array ( [company_logo] = 4 [user_photo] = 4 ) ) [size] = Array ( [UserInfo] = Array ( [company_logo] = 0 [user_photo] = 0 ) ) ) ) Does anyone has some idea about how to upload an image with cakePHP? In what way, if you're going to refer to $_POST instead of $this-data (hint), is that format a surprise? --~--~-~--~~~---~--~~ 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: Using invalidate() in a behavior
On Mar 12, 2:56 am, Miles J mileswjohn...@gmail.com wrote: So I have an uploader behavior that I built, but im trying to add validation for correct filetypes, etc. How do I trigger the validation for the corresponding parent model? I tried doing invalidate() but that doesn't work. Is this even possible? You could always, you know, use google. cakephp upload behavior would have either saved you the time of writing yet another one, or given you an example answer. AD --~--~-~--~~~---~--~~ 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: How is build CakeBook
On Mar 11, 11:53 pm, kicaj ki...@kdev.pl wrote: Hi, How is build book.cakephp.org? When I write Polish version (e.g.http://book.cakephp.org/pl/complete/14/Struktura-CakePHP), ...and when I click forhttp://book.cakephp.org/pl/view/19/CakePHP-File-Structure i see english (default language) text because there is no translated to Polish. My question is How does it work (exactly: display default version when there is no translated)? I try do this the same, but I don't know How? Hi, The book's source code is available on the chaw [1]. However you should probably start with the translate behavior [2] as it transparently does the task you're asking. Please feel free to translate any and all of the book's contents that pops up in English for you [3] :). Cheers, AD [1] http://thechaw.com/cakebook [2] http://book.cakephp.org/pl/view/92/Translate [3] http://book.cakephp.org/pl#Jak-to-dzia%C5%82a-526 --~--~-~--~~~---~--~~ 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: File Uploading
I, for one, would have expected something more like what is shown here: http://book.cakephp.org/view/303/File-Fields You didn't forget to make the form an upload form? $form-create('UserInfo', array('type' = 'file')); On Mar 12, 9:14 am, AD7six andydawso...@gmail.com wrote: On Mar 12, 7:08 am, manisha pmanisha1...@gmail.com wrote: Hello, I am a new user for cakePHP and I am using $form-file ('UserInfo.company_logo', array('size' = 40)); for uploading an image, but after post, I am getting array like Array ( [data] = Array ( [name] = Array ( [UserInfo] = Array ( [company_logo] = [user_photo] = ) ) [type] = Array ( [UserInfo] = Array ( [company_logo] = [user_photo] = ) ) [tmp_name] = Array ( [UserInfo] = Array ( [company_logo] = [user_photo] = ) ) [error] = Array ( [UserInfo] = Array ( [company_logo] = 4 [user_photo] = 4 ) ) [size] = Array ( [UserInfo] = Array ( [company_logo] = 0 [user_photo] = 0 ) ) ) ) Does anyone has some idea about how to upload an image with cakePHP? In what way, if you're going to refer to $_POST instead of $this-data (hint), is that format a surprise? --~--~-~--~~~---~--~~ 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: Combining Zend_lucene, Vendors, Component does not my cake make
Hi, I have a few comments: You should not have to mess with set_include_path at all. You never assign the controller to the $controller property. You assign it to $this-data for some reason. Even if you change that so that $this-controller is the controller you don't do database calls to controllers, which is what you are trying. The component need a reference to a model or at least a hint as to which model it should query. Then again, if you are just going to do a completely manual and hard-coded query you don't need any model, only the dbo. But that is definitely step 2 (or 3). A side note: I'd also choose to create the cached index in the applications tmp folder to eliminate any problems with deployment. Like this (or in some sub-folder): $index = Zend_Search_Lucene::create(TMP.'my-index'); On Mar 12, 5:13 am, DoughBasher gcdavi...@gmail.com wrote: I have been, for days, trying to add Zend_lucene search to my cake site. It works perfectly when I use it in my controller (i.e. without the component) but I am not having much luck turning it into a component so that it will be available to all of my controllers. This is a site-wide search and the form is to appear on every page. The error I am getting is: Fatal error: Call to a member function query () on a non-object in C:\wamp\www\test\app\controllers\components \lucene.php on line 19 (The file lucene.php is shown in section 3, below.) I realise that this is likely to be more of a PHP error than a cake one, but I am getting the error, I believe, because of CakePHP's file structure and that I have forgotten to do something in the component or vendor sections (making it very much a Cake issue, for me). Below is what I've done. I have extracted the Zend library files into the vendors folder so the structure is: 1) - app/vendors/Zend/Search/Lucene/ - app/vendors/Zend/Search/Lucene.php - app/vendors/Zend/Search/Exception.php 2) In my controller that I want to access this component, I have declared var $components = array('lucene'); 3) The component, lucene.php, contains the following code: ?php $path = APP.'/vendors'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); App::import('Vendor','lucene',array('file'='Zend/Search/ Lucene.php')); class LuceneComponent extends Object { var $controller = null; function startup($controller) { $this-data = $controller; } function build() { $index = Zend_Search_Lucene::create('/tmp/my-index'); //* The line below causes the error** $company_rs = $this-controller-query('MY VALID SELECT STATEMENT'); //... more irrelevant code not included } } ? The query itself (not shown) is valid, so it's not the SQL. What have I done, or not done, to get this to work. Any help would be much appreciated. --~--~-~--~~~---~--~~ 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: File Uploading
On Mar 12, 9:43 am, Martin Westin martin.westin...@gmail.com wrote: I, for one, would have expected something more like what is shown here:http://book.cakephp.org/view/303/File-Fields Yes but you're looking at $this-data and manisha isn't (http:// es2.php.net/manual/en/features.file-upload.multiple.php#53240) AD --~--~-~--~~~---~--~~ 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: MVC Design Question
+1 for your version 2 (Fat Model). It is the way I do things for similar cases. Sometimes you want to do it beforeSave (this model should be saved only if the other model can be created) and other times afterSave when things are the other way around. afterSave has a helpful parameter so you can know if this was a creation or an update. function afterSave($created) { } In beforeSave you would have to check for the existance of an id in the data (= an update) or not. On Mar 12, 4:51 am, Alex Jeffery alexanderjeff...@gmail.com wrote: Hi, I am building a small cake application to learn MVC and cakePHP. I have a question about where to put business logic, I have read that controls should be skinny and models should be fat. Eg the business rules should live in the models. In my application I have the following models User, Portfolio, Currency. A user has 1 portfolio which has 1 currency. When I register a user I would like to create their portfolio and assign it the default currency. My question is where to do the creation of the portfolio? (Fat Controller) 1. Call the User model to create a new user. 2. Call the Currency model to get the default currency. 3. Call the Portfolio model to create a new portfolio for the new user with the default currency. Or (Fat Model) 1. The controller calls a custom function on the Users model. Eg registerUser($formData) 2. The User model validates and saves the new user. 3. The user model then calls the Portfolio model to create a new portfolio for the new user. 4. The Portfolio model calls the Currency model to get the default currency and creates the new portfolio for the new user. The advantage I can see to the Fat Model way is that the logic for registering a new user is all in one spot. So if I have many controllers that need to register a new user I can just use the same code. Is this on the right track? Thanks, Alex --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
how to retrieving list of all models associated with a given model ..?
Hello, I'm new in cakephp and now i have one problem i have one model with nested associated with other model example: A - hasMany B B - hasMany C C - hasMany D C - hasMany E and if i call associated of A then the return result is Array ( [A] = Array ( [B] = Array ( [C] = Array ( [0] =[D] [1] =[E] ) ) ) ) how to retrieving list of all models associated with a given modell..?? thanks b4... --~--~-~--~~~---~--~~ 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: Using invalidate() in a behavior
None of the behaviors would work they way I need to. The system is pretty custom and I have to integrate Amazon S3. And I did try google to no avail. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Directory permissions
Hello, I have a problem with directories permissions created by CakePhp in a hosting server that I never had. The folder is created by this line of code: $folder = new Folder($path = $folderName, $create = true, $mode = '777'); The folder is created with these permissions on server drx--t The guys of server support told me that when CakePhp creates folders they have Apache permission and I have to change the configuration of CakePhp. I don't know how to solve this problem. Marco --~--~-~--~~~---~--~~ 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: Using invalidate() in a behavior
On Mar 12, 10:28 am, Miles J mileswjohn...@gmail.com wrote: None of the behaviors would work they way I need to. The system is pretty custom and I have to integrate Amazon S3. And I did try google to no avail. You're saying you used google and didn't find any example of a behavior implementing a validation rule? Forgive me if I don't believe you looked very hard. AD --~--~-~--~~~---~--~~ 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: Multiple language supports
Hi, I try to use Translate Behavior. I already create i18n table. I have product model and set var $actsAs = array( 'Translate'=array( 'name', 'short_desc', 'long_desc', 'features', 'specification' ) ); For my product model i already set $locale = 'fra' (for french) or $locale = 'ara'(for arabic). Then i try to insert a product. Product is added successfully and related records also inserted in i18n table but with the same name as i enter in english. Not translated. I can't figure out the problem.! Please help me to sort this problem. Thanks. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Plug in Module development
Hello Everybody, I am rookie in cakephp. I need to develop a application in cakephp which will 1. Have a user rights module (i.e. Admin will assign some writes to a user the user will only be able to access only those functionality which come under the rights assigned to the user by admin.) 2. I need to develop this project in such a manner that every module in this project is an plug in.So that at any given moment the plug in can be added or removed. I have implemented the point no 1. functionality as per my understanding logic. Looking forward for your reply Regards Anand Wankhede --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Expiry date
i m working on an application in which i have to enter starting date ending date in user table. now when user login in to his account and if his expiry date is equal to current date then the user can not login in to it's account. how can i perform this task. plz reply u r ideas ?? --~--~-~--~~~---~--~~ 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: Directory permissions
Hi Marco, You need to specify the permissions as 0777 (octal) with a leading zero: new Folder('/tmp/a', true, 0777); But be careful with that as it makes the created dir world read and writable. See http://php.net/manual/en/function.chmod.php for mor information on modes. -David On 12 Mrz., 12:13, Marco marco.perg...@gmail.com wrote: Hello, I have a problem with directories permissions created by CakePhp in a hosting server that I never had. The folder is created by this line of code: $folder = new Folder($path = $folderName, $create = true, $mode = '777'); The folder is created with these permissions on server drx--t The guys of server support told me that when CakePhp creates folders they have Apache permission and I have to change the configuration of CakePhp. I don't know how to solve this problem. Marco --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
how to create video sitemaps for the site
hello, i want to make the video sitemaps and according to google te xml should be like rss version=2.0 xmlns:media=http://search.yahoo.com/mrss; xmlns:dcterms=http://purl.org/dc/terms/; xmlns:gm=http:// www.google.com/schemas/gm/1.1 channel item pubDate2005-06-18/pubDate media:content url=http://www.google.com/samples/ localandmaps.mpeg type=video/mpeg media:titleGoogle Local and Google Maps/media:title media:descriptionHow to use Google Local and Google Maps to find local information./media:description media:player url=http://www.google.com/playerLaunch? id=localAndMaps / media:thumbnail url=http://www.google.com/images/ localAndMaps.jpg/ media:credit role=productioncompanyGoogle.com/ media:credit media:credit role=producerJoe Smith/media:credit media:categoryAds Promotional/media:category media:categoryNews/media:category /item /media:content /channel /rss how should i use Xml helper in my controller to make the namespace like above and get my sitemap working like that. --~--~-~--~~~---~--~~ 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: Expiry date
This would depend on how your login works but to me it would look like this: //Login Controller //get your expriry date $expiryDate = $this-data['UserModel']['expiryDateColumn']; //Get today's date $today = date('Y m d'); if($expiryDate = $today){ //Rejected //Could throw a flash message } else{ //login code } --~--~-~--~~~---~--~~ 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: Directory permissions
Hi Marco, You need to specify the mode as 0777 (octal number) with a leading zero: new Folder('/tmp/a/b', true, 0777); But be careful with that. This makes the directory world read and writable! See http://php.net/manual/en/function.chmod.php for more information on modes. -David On 12 Mrz., 12:13, Marco marco.perg...@gmail.com wrote: Hello, I have a problem with directories permissions created by CakePhp in a hosting server that I never had. The folder is created by this line of code: $folder = new Folder($path = $folderName, $create = true, $mode = '777'); The folder is created with these permissions on server drx--t The guys of server support told me that when CakePhp creates folders they have Apache permission and I have to change the configuration of CakePhp. I don't know how to solve this problem. Marco --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
how to create video sitemaps for the site
hello, i want to make the video sitemaps and according to google te xml should be like rss version=2.0 xmlns:media=http://search.yahoo.com/mrss; xmlns:dcterms=http://purl.org/dc/terms/; xmlns:gm=http:// www.google.com/schemas/gm/1.1 channel item pubDate2005-06-18/pubDate media:content url=http://www.google.com/samples/ localandmaps.mpeg type=video/mpeg media:titleGoogle Local and Google Maps/media:title media:descriptionHow to use Google Local and Google Maps to find local information./media:description media:player url=http://www.google.com/playerLaunch? id=localAndMaps / media:thumbnail url=http://www.google.com/images/ localAndMaps.jpg/ media:credit role=productioncompanyGoogle.com/ media:credit media:credit role=producerJoe Smith/media:credit media:categoryAds Promotional/media:category media:categoryNews/media:category /item /media:content /channel /rss how should i use Xml helper in my controller to make the namespace like above and get my sitemap working like that. --~--~-~--~~~---~--~~ 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: find() question
the model name should be singular(Teacher) but u r giving plural(Teachers) On Thu, Mar 12, 2009 at 12:06 AM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Not sure what I am doing here. Been trying to no avail. What I am trying to do is find the id of the logged in user from TEACHERS table WHERE the user_id is $this-Auth-user('id'); $conditions = array('Teachers.user_id'=$userId); $fields = 'Teachers.user_id'; $teacherID = $this-User-Teacher-find('list', compact('conditions', 'fields')); Ideas on what I am doing wrong? Dave -- Regards, Gayatri, IT Associate, IEG, Hyderabad. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
persistent when database are not local but remote
My web application has to connect to a remote database over a openvpn connection. Should I use persistent connections? Are there any disadvantages by doing so? I also looked into added support for compression to the mysql driver in cakephp. Should be pretty simple. Just add MYSQL_CLIENT_COMPRESS to the end of the connect statement. see https://trac.cakephp.org/ticket/6190 Could that help? --~--~-~--~~~---~--~~ 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: CakePHP in Google Summer of Code
Why not do something about cake's performance? On 11 mar, 13:14, Diego Caro A. diegoc...@gmail.com wrote: Hello everyone, today I went to a talk by Google Summer of Code[1], a google program for open source projects. This program offers student developers stipends to write code. Well, I want CakePHP in Google SoC. For this, we need a send a proposal with ideas to Google with a mentor (dedicated to the new developer guide), more info at [2]. My first idea for develop in this program are: - Mechanism to search into different models (like searchable-behaviour-for-cakephp [3]) for mysql and postgresql. Now, we need ideas, get a mentor and submit CakePHP into Google SoC Bye, and discuss this!. [1]:http://code.google.com/soc/ [2]:http://socghop.appspot.com/ [3]:http://code.google.com/p/searchable-behaviour-for-cakephp/ -- Diego Caro A. Estudiante Ing. Civil Informática diegocaro |http://diego.bloog.cl No tengo talentos especiales, pero sí soy profundamente curioso, Albert Einstein. --~--~-~--~~~---~--~~ 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: Unlimited Slugs for an Action
Thanks, jabocs. I'm currently using this type of URL scheme in my statically built site and wasn't sure if I was going to change it (and deal with mod_rewrite to redirect users to the new pages), or leave it the same. I'm guessing that in your view action for your SlugPagesController that you're calling the $getParms[0] controller method of $getParms[-1] (last index)? FWIW - The default PagesController handles physical directories just fine. :) On Mar 11, 3:14 pm, jabocs ja...@jnjhardy.com wrote: Ok, I kept digging, and found my own answer again across a couple different posts so in case it can help anybody else in the future: I added this to the very end of my routes.php: Router::connect('/*', array('controller' = 'slug_pages', 'action' = 'view')); to catch all wild card created sections to go to the view action of my SlugPagesController Then in my view action my first line of code is: $getParms = func_get_args(); so as in my example ofhttp://www.mysite.com/about/sub1/sub2/sub3/page1 I would get an array like this: Array ( [0] = about [1] = sub1 [2] = sub2 [3] = sub3 [4] = page1 ) --~--~-~--~~~---~--~~ 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: Combining Zend_lucene, Vendors, Component does not my cake make
If you end up getting this working, I'd love to hear how you managed to do it, if you have the time! On Mar 12, 12:13 am, DoughBasher gcdavi...@gmail.com wrote: I have been, for days, trying to add Zend_lucene search to my cake site. It works perfectly when I use it in my controller (i.e. without the component) but I am not having much luck turning it into a component so that it will be available to all of my controllers. This is a site-wide search and the form is to appear on every page. The error I am getting is: Fatal error: Call to a member function query () on a non-object in C:\wamp\www\test\app\controllers\components \lucene.php on line 19 (The file lucene.php is shown in section 3, below.) I realise that this is likely to be more of a PHP error than a cake one, but I am getting the error, I believe, because of CakePHP's file structure and that I have forgotten to do something in the component or vendor sections (making it very much a Cake issue, for me). Below is what I've done. I have extracted the Zend library files into the vendors folder so the structure is: 1) - app/vendors/Zend/Search/Lucene/ - app/vendors/Zend/Search/Lucene.php - app/vendors/Zend/Search/Exception.php 2) In my controller that I want to access this component, I have declared var $components = array('lucene'); 3) The component, lucene.php, contains the following code: ?php $path = APP.'/vendors'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); App::import('Vendor','lucene',array('file'='Zend/Search/ Lucene.php')); class LuceneComponent extends Object { var $controller = null; function startup($controller) { $this-data = $controller; } function build() { $index = Zend_Search_Lucene::create('/tmp/my-index'); //* The line below causes the error** $company_rs = $this-controller-query('MY VALID SELECT STATEMENT'); //... more irrelevant code not included } } ? The query itself (not shown) is valid, so it's not the SQL. What have I done, or not done, to get this to work. Any help would be much appreciated. --~--~-~--~~~---~--~~ 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: File Uploading
Ah, thought it looked strange. Haven't looked at that variable since 2006 probably :) On Mar 12, 9:58 am, AD7six andydawso...@gmail.com wrote: On Mar 12, 9:43 am, Martin Westin martin.westin...@gmail.com wrote: I, for one, would have expected something more like what is shown here:http://book.cakephp.org/view/303/File-Fields Yes but you're looking at $this-data and manisha isn't (http:// es2.php.net/manual/en/features.file-upload.multiple.php#53240) AD --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Date validation from Model
Hello all! I'm using 1.2.1 I used to just have Cake validate my data in the save() method. Now I need to validate the data before the save, so I call $this- validateData() inside my model before the save(). My dates used to validate fine when calling save(), now they all fail when I call validateData. It seems that save() changed the date array into a string before passing it to the date validation function. It seems I'll have to change the date array into a string before calling validateData then change it back to an array for save. I figure I'm missing something b/c Cake is usually much more programmer friendly! I have a date field that is created like this in my view: echo $form-input('Punch.workdate', array('maxYear'=$yr, 'minYear'=--$yr, 'div'=false, 'label'=false, 'dateFormat'='mDY')); In my model I have this validation: 'workdate' = array( 'rule' = array('date','ymd'), 'message' = 'Date is not valid.', 'allowEmpty' = false ), Then in my model I've customized the save() method: function save($data) { $bRet = false; // some logic against $data $this-data = $data; if ($this-invalidFields()) { return parent::save(); } return false; } Unfortunately, the data is never saved because the date fails (even though it is valid). The date array will look like this: data[Punch][workdate][month] = '03' data[Punch][workdate][day] = '12' data[Punch][workdate][year] = '2009' Any help would be greatly appreciated! S --~--~-~--~~~---~--~~ 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: CakePHP in Google Summer of Code
Or something oriented MDD. For example http://linux.softpedia.com/get/Programming/Code-Generators/DBDesigner-4-Scaffold-Tools-for-CakePHP-30893.shtml Or even better, working on real MDA tools by extending this Acceleo plugin : http://www.acceleo.org/pages/uml2-to-php-generator/en That would definitely make CakePHP the best framework ever ! Pierre On 12 mar, 15:00, jcorrea javier.cor...@gmail.com wrote: Why not do something about cake's performance? On 11 mar, 13:14, Diego Caro A. diegoc...@gmail.com wrote: Hello everyone, today I went to a talk by Google Summer of Code[1], a google program for open source projects. This program offers student developers stipends to write code. Well, I want CakePHP in Google SoC. For this, we need a send a proposal with ideas to Google with a mentor (dedicated to the new developer guide), more info at [2]. My first idea for develop in this program are: - Mechanism to search into different models (like searchable-behaviour-for-cakephp [3]) for mysql and postgresql. Now, we need ideas, get a mentor and submit CakePHP into Google SoC Bye, and discuss this!. [1]:http://code.google.com/soc/ [2]:http://socghop.appspot.com/ [3]:http://code.google.com/p/searchable-behaviour-for-cakephp/ -- Diego Caro A. Estudiante Ing. Civil Informática diegocaro |http://diego.bloog.cl No tengo talentos especiales, pero sí soy profundamente curioso, Albert Einstein. --~--~-~--~~~---~--~~ 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: Date validation from Model
I forgot to mention that I also tried other validation rule formats, e.g. 'rule' = array('date','mdy'), without any luck. The Validation::date method gets passed an array when calling validateData from my model while Model::save() sends it a string. Thanks again! On Mar 12, 11:16 am, starkey starkey...@gmail.com wrote: Hello all! I'm using 1.2.1 I used to just have Cake validate my data in the save() method. Now I need to validate the data before the save, so I call $this-validateData() inside my model before the save(). My dates used to validate fine when calling save(), now they all fail when I call validateData. It seems that save() changed the date array into a string before passing it to the date validation function. It seems I'll have to change the date array into a string before calling validateData then change it back to an array for save. I figure I'm missing something b/c Cake is usually much more programmer friendly! I have a date field that is created like this in my view: echo $form-input('Punch.workdate', array('maxYear'=$yr, 'minYear'=--$yr, 'div'=false, 'label'=false, 'dateFormat'='mDY')); In my model I have this validation: 'workdate' = array( 'rule' = array('date','ymd'), 'message' = 'Date is not valid.', 'allowEmpty' = false ), Then in my model I've customized the save() method: function save($data) { $bRet = false; // some logic against $data $this-data = $data; if ($this-invalidFields()) { return parent::save(); } return false; } Unfortunately, the data is never saved because the date fails (even though it is valid). The date array will look like this: data[Punch][workdate][month] = '03' data[Punch][workdate][day] = '12' data[Punch][workdate][year] = '2009' Any help would be greatly appreciated! S --~--~-~--~~~---~--~~ 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: Model without table
On Thu, Mar 12, 2009 at 3:21 AM, mscdex msc...@gmail.com wrote: On Mar 12, 2:21 am, kaushik kaushikwo...@gmail.com wrote: var $table = false; Also, make the c in contact uppercase:: class Contact extends AppModel --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
authorize.net redirect
Hi there, I am trying to hook up my cake application with authorize.net service, to use their secure payment form and Relay Response, but just can't get it to work. I have a form where my customer reports the payment amount. The form is processed in the back end class controller like this: 1. I update all needed tables. 2. I instantiate cake HttpSocket class into $MyHS. 3. I build all required fields for authorize.net and put them into a $post array 4. I call $response = $MyHS-post('authorize.net url', $post) According to authorize.net docs my customer should be presented their secure payment form, but that does not happens. I even can't be sure the post was made. Can anybody help? Thanks in advance, Sergio Torres --~--~-~--~~~---~--~~ 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: how to retrieving list of all models associated with a given model ..?
On Thu, Mar 12, 2009 at 5:08 AM, gunung pangrango gpangra...@gmail.com wrote: Hello, I'm new in cakephp and now i have one problem i have one model with nested associated with other model example: A - hasMany B B - hasMany C C - hasMany D C - hasMany E and if i call associated of A then the return result is Array ( [A] = Array ( [B] = Array ( [C] = Array ( [0] =[D] [1] =[E] ) ) ) ) how to retrieving list of all models associated with a given modell..?? I'll bet there's a simpler way but you could always run through: $this-A-hasMany $this-A-belongsTo etc. You'd want to abstract it with a loop through each of A's associations, then through those, basically: $this-{$assoc} --~--~-~--~~~---~--~~ 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: CakePHP in Google Summer of Code
Wow, are really good ideas. Please expand on it in http://bin.cakephp.org/saved/43627 And remember, March 13: Mentoring organization application deadline. :O (tomorrow!). Bye bye ;) On Thu, Mar 12, 2009 at 11:56 AM, Pierre MARTIN rea...@gmail.com wrote: Or something oriented MDD. For example http://linux.softpedia.com/get/Programming/Code-Generators/DBDesigner-4-Scaffold-Tools-for-CakePHP-30893.shtml Or even better, working on real MDA tools by extending this Acceleo plugin : http://www.acceleo.org/pages/uml2-to-php-generator/en That would definitely make CakePHP the best framework ever ! Pierre On 12 mar, 15:00, jcorrea javier.cor...@gmail.com wrote: Why not do something about cake's performance? On 11 mar, 13:14, Diego Caro A. diegoc...@gmail.com wrote: Hello everyone, today I went to a talk by Google Summer of Code[1], a google program for open source projects. This program offers student developers stipends to write code. Well, I want CakePHP in Google SoC. For this, we need a send a proposal with ideas to Google with a mentor (dedicated to the new developer guide), more info at [2]. My first idea for develop in this program are: - Mechanism to search into different models (like searchable-behaviour-for-cakephp [3]) for mysql and postgresql. Now, we need ideas, get a mentor and submit CakePHP into Google SoC Bye, and discuss this!. [1]:http://code.google.com/soc/ [2]:http://socghop.appspot.com/ [3]:http://code.google.com/p/searchable-behaviour-for-cakephp/ -- Diego Caro A. Estudiante Ing. Civil Informática diegocaro |http://diego.bloog.cl No tengo talentos especiales, pero sí soy profundamente curioso, Albert Einstein. -- Diego Caro A. Estudiante Ing. Civil Informática diegocaro | http://diego.bloog.cl No tengo talentos especiales, pero sí soy profundamente curioso, Albert Einstein. --~--~-~--~~~---~--~~ 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: authorize.net redirect
I have found that I have to make my forms actually point to Auth dot net's servers not make the post request in php. Sam D On Thu, Mar 12, 2009 at 8:47 AM, SergioTorresC. sergiotorr...@gmail.com wrote: Hi there, I am trying to hook up my cake application with authorize.net service, to use their secure payment form and Relay Response, but just can't get it to work. I have a form where my customer reports the payment amount. The form is processed in the back end class controller like this: 1. I update all needed tables. 2. I instantiate cake HttpSocket class into $MyHS. 3. I build all required fields for authorize.net and put them into a $post array 4. I call $response = $MyHS-post('authorize.net url', $post) According to authorize.net docs my customer should be presented their secure payment form, but that does not happens. I even can't be sure the post was made. Can anybody help? Thanks in advance, Sergio Torres --~--~-~--~~~---~--~~ 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: Date validation from Model
I found my problem... I changed the way I assigned the local $data to the model's $data: // in my model Old: $this-data = $data; New: $this-set($data); And now it works great! Thanks a lot Cake for an excellent framework! S On Mar 12, 11:26 am, starkey starkey...@gmail.com wrote: I forgot to mention that I also tried other validation rule formats, e.g. 'rule' = array('date','mdy'), without any luck. The Validation::date method gets passed an array when calling validateData from my model while Model::save() sends it a string. Thanks again! On Mar 12, 11:16 am, starkey starkey...@gmail.com wrote: Hello all! I'm using 1.2.1 I used to just have Cake validate my data in the save() method. Now I need to validate the data before the save, so I call $this-validateData() inside my model before the save(). My dates used to validate fine when calling save(), now they all fail when I call validateData. It seems that save() changed the date array into a string before passing it to the date validation function. It seems I'll have to change the date array into a string before calling validateData then change it back to an array for save. I figure I'm missing something b/c Cake is usually much more programmer friendly! I have a date field that is created like this in my view: echo $form-input('Punch.workdate', array('maxYear'=$yr, 'minYear'=--$yr, 'div'=false, 'label'=false, 'dateFormat'='mDY')); In my model I have this validation: 'workdate' = array( 'rule' = array('date','ymd'), 'message' = 'Date is not valid.', 'allowEmpty' = false ), Then in my model I've customized the save() method: function save($data) { $bRet = false; // some logic against $data $this-data = $data; if ($this-invalidFields()) { return parent::save(); } return false; } Unfortunately, the data is never saved because the date fails (even though it is valid). The date array will look like this: data[Punch][workdate][month] = '03' data[Punch][workdate][day] = '12' data[Punch][workdate][year] = '2009' Any help would be greatly appreciated! S --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Help on somewhat complicated model relationships
I have an application that is using three user models, from three datasources. One is specifically built for the application (User), one is LDAP-based (NetworkAccount), and the third is a static database (Salesperson), in that I can only read from it. I'm also using the ACL component, which complicates things a little more. Anyway, in the first database, I have my ACL tables and a user table. My problem is that the models based on the LDAP and static databases use a varchar username as their primary keys, and I can't change that. However ACL seems to require that the foreign keys in the aros table be integers. In my User model, I want to associate the corresponding models, but I can't figure out how to define the $hasOne conditions so that both the primary key in the base and the foreign key on the other side are custom. Basically if I set User.username to be the primary key, ACL fails because it can't convert the varchar to intergers in the aros table. Here is the pertinent info to make it more clear: Model User pkey = User.id (int) unique = User.username (varchar) Model NetworkAccount pkey = NetworkAccount.SAMAccountName (varchar) Model Salesperson pkey = Salesperson.Code (varchar) I know in the relation variables, you can specify a foreign key, which I have to do since neither of the other two tables have a user_id column. But can I specify the column in User that I want to match with? Obviously what I want to do is User.username = NetworkAccount.SAMAccountName and User.username = Salesperson.Code. But I haven't been able to figure out how to tell cake to use username instead of id for the relations. Hopefully that makes enough sense for someone to offer up an idea. If I can't use the built-in relation variables ($hasOne, $belongsTo), how would I go about writing custom queries that would automatically fire when a User object is created, to pull the info from the other two tables? --~--~-~--~~~---~--~~ 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: Directory permissions
Thank you David. I tried to modify with a leading 0 but the result is the same. Your are right when you say permission 777 is not a good idea. I modified with 0755 and the result is d-wxrw--wt (363) What is the 't' at the end? Is the problem something related to the server configuration? Marco On Mar 12, 10:01 am, David Persson davidpers...@qeweurope.org wrote: Hi Marco, You need to specify the permissions as 0777 (octal) with a leading zero: new Folder('/tmp/a', true, 0777); But be careful with that as it makes the created dir world read and writable. Seehttp://php.net/manual/en/function.chmod.phpfor mor information on modes. -David On 12 Mrz., 12:13, Marco marco.perg...@gmail.com wrote: Hello, I have a problem with directories permissions created by CakePhp in a hosting server that I never had. The folder is created by this line of code: $folder = new Folder($path = $folderName, $create = true, $mode = '777'); The folder is created with these permissions on server drx--t The guys of server support told me that when CakePhp creates folders they have Apache permission and I have to change the configuration of CakePhp. I don't know how to solve this problem. Marco --~--~-~--~~~---~--~~ 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: Combining Zend_lucene, Vendors, Component does not my cake make
Brendon, Will do. It may be a cold day in hell before then, but once I have annoyed the guys on IRC enough to get the solution, I will post it. Of course, if you get it to work don't hesitate to fling it my way. Thanks Dough! On Mar 12, 9:17 pm, Brendon Kozlowski brendon...@hotmail.com wrote: If you end up getting this working, I'd love to hear how you managed to do it, if you have the time! On Mar 12, 12:13 am, DoughBasher gcdavi...@gmail.com wrote: I have been, for days, trying to add Zend_lucene search to my cake site. It works perfectly when I use it in my controller (i.e. without the component) but I am not having much luck turning it into a component so that it will be available to all of my controllers. This is a site-wide search and the form is to appear on every page. The error I am getting is: Fatal error: Call to a member function query () on a non-object in C:\wamp\www\test\app\controllers\components \lucene.php on line 19 (The file lucene.php is shown in section 3, below.) I realise that this is likely to be more of a PHP error than a cake one, but I am getting the error, I believe, because of CakePHP's file structure and that I have forgotten to do something in the component or vendor sections (making it very much a Cake issue, for me). Below is what I've done. I have extracted the Zend library files into the vendors folder so the structure is: 1) - app/vendors/Zend/Search/Lucene/ - app/vendors/Zend/Search/Lucene.php - app/vendors/Zend/Search/Exception.php 2) In my controller that I want to access this component, I have declared var $components = array('lucene'); 3) The component, lucene.php, contains the following code: ?php $path = APP.'/vendors'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); App::import('Vendor','lucene',array('file'='Zend/Search/ Lucene.php')); class LuceneComponent extends Object { var $controller = null; function startup($controller) { $this-data = $controller; } function build() { $index = Zend_Search_Lucene::create('/tmp/my-index'); //* The line below causes the error** $company_rs = $this-controller-query('MY VALID SELECT STATEMENT'); //... more irrelevant code not included } } ? The query itself (not shown) is valid, so it's not the SQL. What have I done, or not done, to get this to work. Any help would be much appreciated. --~--~-~--~~~---~--~~ 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: query - different results (fetching) in mysql/mssql
I have this exact problem. This seems to be bug with 1.2 and dbo_mssql. On Mar 2, 1:46 pm, Alexey grunic...@gmail.com wrote: I need to have application that can work in either MySQL or MSSQL environment. Due to db-abstractions all work fine if I'm using find() and other methods. But sometimes I need to use query() function for big and hard queries. Here I have one issue. I'm going to use simple examples, of course real queries are different. var_dump($this-MyModel-query(SELECT * FROM users as u, user_sessions as us)); Mysql returns: array 0 = array 'u' = array 'id' = string '1' (length=1) 'username' = string 'test' (length=4) 'password' = string 'password' (length=40) 'us' = array 'id' = string '1' (length=1) 'user_id' = string '1' (length=1) 'created' = string '2009-03-02 15:20:28' (length=19) 'closed' = null 'last_update' = null 'last_save' = null MSSQL returns: array 0 = array 0 = array 'id' = string '1' (length=1) 'username' = string 'test' (length=4) 'password' = string 'password' (length=40) 'user_id' = string '1' (length=1) 'created' = string 'Dec 29 2008 5:08PM' (length=19) 'closed' = null 'last_update' = null 'last_save' = null So, first thing - we don't have aliases, second thing - mssql merged both tables output in one array. If I use find() alises work fine in MSSQL (as well as in MySQL), how can this problem be solved for query() function? --~--~-~--~~~---~--~~ 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: Combining Zend_lucene, Vendors, Component does not my cake make
Hi Martin, Thanks for your comments. I was trying to cobble together info from various sources on the net by brave folks who attempted the Lucene-Cake bastardisation route before me. I agree with the 'set_include_path' It was the latest attempt after a long series of attempts to get it to work. It returned the least number of errors and, at that point in time, it was going to do for me. However, it kept cropping up when smarter people than me write about Zend and Cake (as either set_include_path or ini_set ('include_path') [1][2] Jonathan Snook actually added it to his core.php :O [3] As for assigning the controller to the $controller, I was, once again, following the wisdom of others. Golding's book he stated: [U]se the startup() function to instantiate the controller object. Then all functions in the controller can use $this-controller to access anything in the parent controller. function startup($controller) { $this-controller = $controller; } [4] Doing DB calls to the controller. You're right, I have no idea what I was thinking. It was a brain-fart that stuck and stayed, I believe (not a pretty metaphor, sorry). Finally I totally agree with you on the caching. It is on the cards. I was just trying to get the easy stuff working first. (ha ha ha). Also I realise that a lot of these sources were written when Cake was still a baby and things have changed by leaps and bounds since. Moreover, I am (obviously) new to all this and may have picked up the wrong end of every stick while reading articles on this topic. What I am trying to say is that I am in no way suggesting that these articles I sited here are wrong...just wrong to me :) Thanks again, Martin, for your time. [1] David Golding, 'Beginning CakePHP From Novice to Professional', page 213 (albeit he uses it in the vendor file). [2] http://bakery.cakephp.org/articles/view/integrating-zend-framework-lucene-with-your-cake-application [3] http://snook.ca/archives/php/zend_framework_first_impressions/ [4] David Golding, 'Beginning CakePHP From Novice to Professional', page 206 On Mar 12, 3:54 pm, Martin Westin martin.westin...@gmail.com wrote: Hi, I have a few comments: You should not have to mess with set_include_path at all. You never assign the controller to the $controller property. You assign it to $this-data for some reason. Even if you change that so that $this-controller is the controller you don't do database calls to controllers, which is what you are trying. The component need a reference to a model or at least a hint as to which model it should query. Then again, if you are just going to do a completely manual and hard-coded query you don't need any model, only the dbo. But that is definitely step 2 (or 3). A side note: I'd also choose to create the cached index in the applications tmp folder to eliminate any problems with deployment. Like this (or in some sub-folder): $index = Zend_Search_Lucene::create(TMP.'my-index'); On Mar 12, 5:13 am, DoughBasher gcdavi...@gmail.com wrote: I have been, for days, trying to add Zend_lucene search to my cake site. It works perfectly when I use it in my controller (i.e. without the component) but I am not having much luck turning it into a component so that it will be available to all of my controllers. This is a site-wide search and the form is to appear on every page. The error I am getting is: Fatal error: Call to a member function query () on a non-object in C:\wamp\www\test\app\controllers\components \lucene.php on line 19 (The file lucene.php is shown in section 3, below.) I realise that this is likely to be more of a PHP error than a cake one, but I am getting the error, I believe, because of CakePHP's file structure and that I have forgotten to do something in the component or vendor sections (making it very much a Cake issue, for me). Below is what I've done. I have extracted the Zend library files into the vendors folder so the structure is: 1) - app/vendors/Zend/Search/Lucene/ - app/vendors/Zend/Search/Lucene.php - app/vendors/Zend/Search/Exception.php 2) In my controller that I want to access this component, I have declared var $components = array('lucene'); 3) The component, lucene.php, contains the following code: ?php $path = APP.'/vendors'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); App::import('Vendor','lucene',array('file'='Zend/Search/ Lucene.php')); class LuceneComponent extends Object { var $controller = null; function startup($controller) { $this-data = $controller; } function build() { $index = Zend_Search_Lucene::create('/tmp/my-index'); //* The line below causes the error** $company_rs = $this-controller-query('MY VALID
Re: Directory permissions
Hi Marco, Please verify that you are using 0777 or 0755 and not '0777' or '0755'. Pay attention to the quotes. 0777 is not the same as '0777' The first one is an octal integer and the second one a string. intval(0777) // is 511 intval('0777') // is 777 See: http://php.net/manual/de/language.types.integer.php -David On 12 Mrz., 17:56, Marco marco.perg...@gmail.com wrote: Thank you David. I tried to modify with a leading 0 but the result is the same. Your are right when you say permission 777 is not a good idea. I modified with 0755 and the result is d-wxrw--wt (363) What is the 't' at the end? Is the problem something related to the server configuration? Marco On Mar 12, 10:01 am, David Persson davidpers...@qeweurope.org wrote: Hi Marco, You need to specify the permissions as 0777 (octal) with a leading zero: new Folder('/tmp/a', true, 0777); But be careful with that as it makes the created dir world read and writable. Seehttp://php.net/manual/en/function.chmod.phpformor information on modes. -David On 12 Mrz., 12:13, Marco marco.perg...@gmail.com wrote: Hello, I have a problem with directories permissions created by CakePhp in a hosting server that I never had. The folder is created by this line of code: $folder = new Folder($path = $folderName, $create = true, $mode = '777'); The folder is created with these permissions on server drx--t The guys of server support told me that when CakePhp creates folders they have Apache permission and I have to change the configuration of CakePhp. I don't know how to solve this problem. Marco --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Jake question: rewrite problem?
Hi everyone: I am pretty new to cakephp. I am trying to use the Jake component to integrate it into cms. I am having some problems and just wondering if you guys can help. My cakephp is version 1.2.0.5427alpha and joomla 1.5.9. Due to limited php knowledge, I am trying to avoid upgrading cake. Since I am using xampp on my own computer right now, so mod_rewrite is on. But I always get problem like the following when I connect from jake (with the url of http://localhost/joomla/index.php?option=com_jake), while direct connect to cake (http://localhost/cake) is completely fine. Here is the error message I got when connecting with jake: -- Missing controller You are seeing this error because controller Controller could not be found. Notice: If you want to customize this error message, create app\views/ errors/missing_controller.ctp Fatal: Create the class below in file: app\controllers\controller.php ?php class Controller extends AppController { var $name = ''; } ? I found something weird as well and think it might mean something: I have a static page in my cakphp application: \cake\app\views \pages\about_us.ctp. When I connect directly to cake install route, I can see those pages perfectly fine with an url in address bar as http://localhost/cake/pages/about_us. However, when redirected from jake, the url become http://localhost/pages/about_us (meantime the error above appears) and clicking on it gives me 500 error. So my impression is that it's a rewrite problem. I must messed up with some configurations. But I am terribly new on this and could not figure it out. I played around with .htaccess, etc, but no avail. Maybe you can take a quick look and give me a solution. Really appreciate it! Thanks a lot! Robin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Email Component
I am sending out a general welcome email, nothing fancy. If I remove the SMTP stuff it work fine. Am I missing something from the SMTP required setup? I verified the email account info and its correct what I have XXX'd out in the code here. When the SMTP is removed and I get the email as I signup as a new user using my regular email it says from: widep...@host291.hostmonster.com How can I change that? I tried: //$this-set('server_name', $_SERVER['SERVER_NAME']); $this-set('server_name', 'myNewSite'); /* SMTP Options */ $this-Email-smtpOptions = array( 'port' = '25', 'timeout' = '30', 'host' = 'xx', 'username' = 'xx', 'password' = 'x'); /* Set delivery method */ $this-Email-delivery = 'smtp'; $this-Email-to = $this-data['User']['email']; $this-Email-subject = 'Welcome Message Test'; $this-Email-replyTo = 'm...@here.com'; $this-Email-from = 'dave' nore...@hiredflow.com mailto:nore...@hiredflow.com' '; $this-Email-sendAs = 'html'; $this-Email-template = 'confirmation'; $this-set('name', $this-data['User']['username']); $this-set('server_name', $_SERVER['SERVER_NAME']); $this-set('id', $this-User-getLastInsertID()); $this-set('code', $this-data['User']['confirm_code']); /* Check for SMTP errors. */ $this-set('smtp-errors', $this-Email-smtpError); if ($this-Email-send()) { data for email here. } Dave --~--~-~--~~~---~--~~ 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: Directory permissions
Hi David, thank you very much!! The problem was the quotes. The behaviour I downloaded from cakephp website uses '777' to create the directory, I use now 0775. Thank you again for your professional help. Marco On Mar 12, 3:25 pm, David Persson davidpers...@qeweurope.org wrote: Hi Marco, Please verify that you are using 0777 or 0755 and not '0777' or '0755'. Pay attention to the quotes. 0777 is not the same as '0777' The first one is an octal integer and the second one a string. intval(0777) // is 511 intval('0777') // is 777 See:http://php.net/manual/de/language.types.integer.php -David On 12 Mrz., 17:56, Marco marco.perg...@gmail.com wrote: Thank you David. I tried to modify with a leading 0 but the result is the same. Your are right when you say permission 777 is not a good idea. I modified with 0755 and the result is d-wxrw--wt (363) What is the 't' at the end? Is the problem something related to the server configuration? Marco On Mar 12, 10:01 am, David Persson davidpers...@qeweurope.org wrote: Hi Marco, You need to specify the permissions as 0777 (octal) with a leading zero: new Folder('/tmp/a', true, 0777); But be careful with that as it makes the created dir world read and writable. Seehttp://php.net/manual/en/function.chmod.phpformorinformation on modes. -David On 12 Mrz., 12:13, Marco marco.perg...@gmail.com wrote: Hello, I have a problem with directories permissions created by CakePhp in a hosting server that I never had. The folder is created by this line of code: $folder = new Folder($path = $folderName, $create = true, $mode = '777'); The folder is created with these permissions on server drx--t The guys of server support told me that when CakePhp creates folders they have Apache permission and I have to change the configuration of CakePhp. I don't know how to solve this problem. Marco --~--~-~--~~~---~--~~ 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: Directory permissions
The t is the sticky bit. On 12 Mrz., 17:56, Marco marco.perg...@gmail.com wrote: Thank you David. I tried to modify with a leading 0 but the result is the same. Your are right when you say permission 777 is not a good idea. I modified with 0755 and the result is d-wxrw--wt (363) What is the 't' at the end? Is the problem something related to the server configuration? Marco On Mar 12, 10:01 am, David Persson davidpers...@qeweurope.org wrote: Hi Marco, You need to specify the permissions as 0777 (octal) with a leading zero: new Folder('/tmp/a', true, 0777); But be careful with that as it makes the created dir world read and writable. Seehttp://php.net/manual/en/function.chmod.phpformor information on modes. -David On 12 Mrz., 12:13, Marco marco.perg...@gmail.com wrote: Hello, I have a problem with directories permissions created by CakePhp in a hosting server that I never had. The folder is created by this line of code: $folder = new Folder($path = $folderName, $create = true, $mode = '777'); The folder is created with these permissions on server drx--t The guys of server support told me that when CakePhp creates folders they have Apache permission and I have to change the configuration of CakePhp. I don't know how to solve this problem. Marco --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
HABTM and findAll
Hi! I have an app with a few models; Claimant, Professional and ApprovalRequisition among them. Some of most important associations are: - Claimant hasMany ApprovalRequisitions; - Professional hasAndBelongsToMany ApprovalRequisition; and, - ApprovalRequisition hasAndBelongsToMany Professional. Starting from the ApprovalRequisition model, I need to retrieve all Claimant's ApprovalRequisitions. Until now, no problem. I'm using the code: $claimant_approval_requisitions = $this-ApprovalRequisition-find( 'all', array( 'conditions' = array( 'ApprovalRequisition.claimant_id' = $claimant_id ) ) ); debug($claimant_approval_requisitions) shows: Array( [0] = Array( [ApprovalRequisition] = Array( [id] = 1 [created] = 2009-03-11 11:27:35 [modified] = 2009-03-11 11:27:35 [claimant_id] = 1 ) [Claimant] = Array( [id] = 1 [created] = 2009-02-17 16:55:30 [modified] = 2009-02-17 16:55:30 ) [Professional] = Array( [0] = Array( [id] = 2 [created] = 2009-03-12 09:37:38 [modified] = 2009-03-12 09:37:38 [ApprovalRequisitionsProfessional] = Array( [id] = 3 [created] = 2009-03-12 09:40:46 [modified] = 2009-03-12 09:40:46 [requisition_id] = 1 [professional_id] = 2 ) ) [1] = Array( [id] = 1 [created] = 2009-02-17 16:55:30 [modified] = 2009-03-04 10:08:37 [ApprovalRequisitionsProfessional] = Array( [id] = 1 [created] = 2009-03-11 11:27:35 [modified] = 2009-03-11 11:27:35 [requisition_id] = 1 [professional_id] = 1 ) ) ) ) [1] = Array( [ApprovalRequisition] = Array( [id] = 2 [created] = 2009-03-12 11:26:01 [modified] = 2009-03-12 11:26:01 [claimant_id] = 1 ) [Claimant] = Array( [id] = 1 [created] = 2009-02-17 16:55:30 [modified] = 2009-02-17 16:55:30 ) [Professional] = Array( [0] = Array( [id] = 1 [created] = 2009-02-17 16:55:30 [modified] = 2009-03-04 10:08:37 [ApprovalRequisitionsProfessional] = Array( [id] = 4 [created] = 2009-03-12 11:26:01 [modified] = 2009-03-12 11:26:01 [requisition_id] = 2 [professional_id] = 1 ) ) ) ) ) My problem is retrieving all Professional's ApprovalRequisitions... Basically, I wish to retrieve *ONLY* ApprovalRequisitions that belongs to a given Professional. Simple like that. Yes, I know that would be much more simple starting from the Professional model to obtain all yours ApprovalRequisitions. Can someone help me? Thanks a lot. --~--~-~--~~~---~--~~ 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: Combining Zend_lucene, Vendors, Component does not my cake make
If you look at the application that runs the book.cakephp.org, our wonderful cakephp devs have already made using Zend_Lucene pretty simple, takes a little bit of work to decipher how ot use it, but I am using it on www.tribaloutpost.com and it works phenominally. If I have time I might write it up. -Erik On Mar 12, 1:26 pm, DoughBasher gcdavi...@gmail.com wrote: Brendon, Will do. It may be a cold day in hell before then, but once I have annoyed the guys on IRC enough to get the solution, I will post it. Of course, if you get it to work don't hesitate to fling it my way. Thanks Dough! On Mar 12, 9:17 pm, Brendon Kozlowski brendon...@hotmail.com wrote: If you end up getting this working, I'd love to hear how you managed to do it, if you have the time! On Mar 12, 12:13 am, DoughBasher gcdavi...@gmail.com wrote: I have been, for days, trying to add Zend_lucene search to my cake site. It works perfectly when I use it in my controller (i.e. without the component) but I am not having much luck turning it into a component so that it will be available to all of my controllers. This is a site-wide search and the form is to appear on every page. The error I am getting is: Fatal error: Call to a member function query () on a non-object in C:\wamp\www\test\app\controllers\components \lucene.php on line 19 (The file lucene.php is shown in section 3, below.) I realise that this is likely to be more of a PHP error than a cake one, but I am getting the error, I believe, because of CakePHP's file structure and that I have forgotten to do something in the component or vendor sections (making it very much a Cake issue, for me). Below is what I've done. I have extracted the Zend library files into the vendors folder so the structure is: 1) - app/vendors/Zend/Search/Lucene/ - app/vendors/Zend/Search/Lucene.php - app/vendors/Zend/Search/Exception.php 2) In my controller that I want to access this component, I have declared var $components = array('lucene'); 3) The component, lucene.php, contains the following code: ?php $path = APP.'/vendors'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); App::import('Vendor','lucene',array('file'='Zend/Search/ Lucene.php')); class LuceneComponent extends Object { var $controller = null; function startup($controller) { $this-data = $controller; } function build() { $index = Zend_Search_Lucene::create('/tmp/my-index'); //* The line below causes the error** $company_rs = $this-controller-query('MY VALID SELECT STATEMENT'); //... more irrelevant code not included } } ? The query itself (not shown) is valid, so it's not the SQL. What have I done, or not done, to get this to work. Any help would be much appreciated.- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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: HABTM and findAll
you have to do some inner joins... like $this-ApprovalRequisitions-find('all',array( 'joins' = array( array( 'table' = 'approval_requisitions_professionals', 'alias' = 'ApprovalRequisitionsProfessional', 'type' = 'inner', 'conditions' = array ('ApprovalRequisitionsProfessional.approval_requisition_id = ApprovalRequisition.id') ), array( 'table' = 'professionals', 'alias' = 'Professional', 'type'='inner', 'conditions'=array('Professional.id = ApprovalRequisitionsProfessional.professional_id') ) ), 'conditions' = array('Professional.id' = $your_special_id) ) but be a bit careful with that: you will never find any ApprovalRequisitions which are not related to a certain Professional even if you leave the conditions-array blank. (see how inner joins are working, if you want to know why) On Mar 12, 7:57 pm, Antônio Marco idelfonso.alme...@gmail.com wrote: Hi! I have an app with a few models; Claimant, Professional and ApprovalRequisition among them. Some of most important associations are: - Claimant hasMany ApprovalRequisitions; - Professional hasAndBelongsToMany ApprovalRequisition; and, - ApprovalRequisition hasAndBelongsToMany Professional. Starting from the ApprovalRequisition model, I need to retrieve all Claimant's ApprovalRequisitions. Until now, no problem. I'm using the code: $claimant_approval_requisitions = $this-ApprovalRequisition-find( 'all', array( 'conditions' = array( 'ApprovalRequisition.claimant_id' = $claimant_id ) ) ); debug($claimant_approval_requisitions) shows: Array( [0] = Array( [ApprovalRequisition] = Array( [id] = 1 [created] = 2009-03-11 11:27:35 [modified] = 2009-03-11 11:27:35 [claimant_id] = 1 ) [Claimant] = Array( [id] = 1 [created] = 2009-02-17 16:55:30 [modified] = 2009-02-17 16:55:30 ) [Professional] = Array( [0] = Array( [id] = 2 [created] = 2009-03-12 09:37:38 [modified] = 2009-03-12 09:37:38 [ApprovalRequisitionsProfessional] = Array( [id] = 3 [created] = 2009-03-12 09:40:46 [modified] = 2009-03-12 09:40:46 [requisition_id] = 1 [professional_id] = 2 ) ) [1] = Array( [id] = 1 [created] = 2009-02-17 16:55:30 [modified] = 2009-03-04 10:08:37 [ApprovalRequisitionsProfessional] = Array( [id] = 1 [created] = 2009-03-11 11:27:35 [modified] = 2009-03-11 11:27:35 [requisition_id] = 1 [professional_id] = 1 ) ) ) ) [1] = Array( [ApprovalRequisition] = Array( [id] = 2 [created] = 2009-03-12 11:26:01 [modified] = 2009-03-12 11:26:01 [claimant_id] = 1 ) [Claimant] = Array( [id] = 1 [created] = 2009-02-17 16:55:30 [modified] = 2009-02-17 16:55:30 ) [Professional] = Array( [0] = Array( [id] = 1 [created] = 2009-02-17 16:55:30 [modified] = 2009-03-04 10:08:37 [ApprovalRequisitionsProfessional] = Array( [id] = 4 [created] = 2009-03-12 11:26:01 [modified] = 2009-03-12 11:26:01 [requisition_id] = 2 [professional_id] = 1 ) ) ) ) ) My problem is retrieving all Professional's ApprovalRequisitions... Basically, I wish to retrieve *ONLY* ApprovalRequisitions that belongs to a given Professional. Simple like that. Yes, I know that would be much more simple starting from the Professional model to obtain all yours ApprovalRequisitions. Can someone help me? Thanks a lot. --~--~-~--~~~---~--~~ 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: Combining Zend_lucene, Vendors, Component does not my cake make
Thanks Erik. I'll definitely have a look there. This reinventing the wheel thing is getting old (and so am I). Regards, Dough! On Mar 13, 2:05 am, Esoteric erik.kristen...@gmail.com wrote: If you look at the application that runs the book.cakephp.org, our wonderful cakephp devs have already made using Zend_Lucene pretty simple, takes a little bit of work to decipher how ot use it, but I am using it onwww.tribaloutpost.comand it works phenominally. If I have time I might write it up. -Erik On Mar 12, 1:26 pm, DoughBasher gcdavi...@gmail.com wrote: Brendon, Will do. It may be a cold day in hell before then, but once I have annoyed the guys on IRC enough to get the solution, I will post it. Of course, if you get it to work don't hesitate to fling it my way. Thanks Dough! On Mar 12, 9:17 pm, Brendon Kozlowski brendon...@hotmail.com wrote: If you end up getting this working, I'd love to hear how you managed to do it, if you have the time! On Mar 12, 12:13 am, DoughBasher gcdavi...@gmail.com wrote: I have been, for days, trying to add Zend_lucene search to my cake site. It works perfectly when I use it in my controller (i.e. without the component) but I am not having much luck turning it into a component so that it will be available to all of my controllers. This is a site-wide search and the form is to appear on every page. The error I am getting is: Fatal error: Call to a member function query () on a non-object in C:\wamp\www\test\app\controllers\components \lucene.php on line 19 (The file lucene.php is shown in section 3, below.) I realise that this is likely to be more of a PHP error than a cake one, but I am getting the error, I believe, because of CakePHP's file structure and that I have forgotten to do something in the component or vendor sections (making it very much a Cake issue, for me). Below is what I've done. I have extracted the Zend library files into the vendors folder so the structure is: 1) - app/vendors/Zend/Search/Lucene/ - app/vendors/Zend/Search/Lucene.php - app/vendors/Zend/Search/Exception.php 2) In my controller that I want to access this component, I have declared var $components = array('lucene'); 3) The component, lucene.php, contains the following code: ?php $path = APP.'/vendors'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); App::import('Vendor','lucene',array('file'='Zend/Search/ Lucene.php')); class LuceneComponent extends Object { var $controller = null; function startup($controller) { $this-data = $controller; } function build() { $index = Zend_Search_Lucene::create('/tmp/my-index'); //* The line below causes the error** $company_rs = $this-controller-query('MY VALID SELECT STATEMENT'); //... more irrelevant code not included } } ? The query itself (not shown) is valid, so it's not the SQL. What have I done, or not done, to get this to work. Any help would be much appreciated.- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
send POST with redirect()
Hi, I need to send post variables to a website but I'd like to to this without a form the user sees. The user should just click on a link and I'll do the redirect and like to pass through the POST information. Is this somehow possible? Cheers Marcel --~--~-~--~~~---~--~~ 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: send POST with redirect()
Ajax or use javascript submit(). --~--~-~--~~~---~--~~ 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: Using invalidate() in a behavior
No Ive seen behaviors use validation, but not invalidate() which is my question. Thats why I'm asking if invalidate() does work, else ill have to fall back to the other validation. --~--~-~--~~~---~--~~ 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: Class dispatcher not found - Solved, bug maybe?
We managed to track down why the class Dispatcher was failing to load. What we found was that the Inflector::underscore() function called from the bootstrap.php App::import('Core', array('Dispatcher')); was converting 'Dispatcher' to _dispatcher. The Inflector underscore function looks like the following :- function underscore($camelCasedWord) { return strtolower(preg_replace('/(?=\\w)([A-Z])/', '_\\1', $camelCasedWord)); } We have implemented a work around for this installation, I'm not an expert on preg_replace() but maybe a dev or someone else can see how this function can produce _dispatcher ? In terms of server setup its running debian4, apache2 and a custom compiled version of php 5.2.0. On Mon, Mar 2, 2009 at 7:40 PM, Brett Wilton bdwil...@gmail.com wrote: Any warning/notices before fatal error? No nothing at all, this is a fresh install. All I can think of at this point is that App::import() is failing in the bootstrap to import the Dispatcher for some reason and then the app/webroot/index.php file is trying to create the Dispatcher and failing. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Delete related data
Can someone point me in the direction of how to delete records of related models. For example my USER hasOne - PROFILE USER hasMany -COMMENTS What I want to do is if I delete the USER it also deletes the PROFILE and all the COMMENTS Dave --~--~-~--~~~---~--~~ 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: Delete related data
$this-User-delete($id, true); http://book.cakephp.org/view/516/Deleting-Data Manual is your friend, simply set cascade to true. --~--~-~--~~~---~--~~ 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: Delete related data
Thanks man... I did find it right after I posted the message. Cascade ! Thanks again. -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: March-12-09 7:11 PM To: CakePHP Subject: Re: Delete related data $this-User-delete($id, true); http://book.cakephp.org/view/516/Deleting-Data Manual is your friend, simply set cascade to true. --~--~-~--~~~---~--~~ 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: Jake question: rewrite problem?
Robin, I won't be able to respond again (most likely) until Monday at the earliest, but maybe someone else can help you if you provide some more information. It looks like your installation paths may be a problem. Can I ask what documentation you were following to get this setup (source)? Also, please give a textual example of your directory structure, if possible. CakePHP typically expects to be *below* the web root, which is why you may be having issues if both Joomla and CakePHP are at the same level (I haven't used Jake, but I'd think that Joomla should be inside Cake's webroot folder?). On Mar 12, 2:35 pm, Robin madsa...@gmail.com wrote: Hi everyone: I am pretty new to cakephp. I am trying to use the Jake component to integrate it into cms. I am having some problems and just wondering if you guys can help. My cakephp is version 1.2.0.5427alpha and joomla 1.5.9. Due to limited php knowledge, I am trying to avoid upgrading cake. Since I am using xampp on my own computer right now, so mod_rewrite is on. But I always get problem like the following when I connect from jake (with the url ofhttp://localhost/joomla/index.php?option=com_jake), while direct connect to cake (http://localhost/cake) is completely fine. Here is the error message I got when connecting with jake: -- Missing controller You are seeing this error because controller Controller could not be found. Notice: If you want to customize this error message, create app\views/ errors/missing_controller.ctp Fatal: Create the class below in file: app\controllers\controller.php ?php class Controller extends AppController { var $name = '';} ? ---- I found something weird as well and think it might mean something: I have a static page in my cakphp application: \cake\app\views \pages\about_us.ctp. When I connect directly to cake install route, I can see those pages perfectly fine with an url in address bar ashttp://localhost/cake/pages/about_us. However, when redirected from jake, the url becomehttp://localhost/pages/about_us(meantime the error above appears) and clicking on it gives me 500 error. So my impression is that it's a rewrite problem. I must messed up with some configurations. But I am terribly new on this and could not figure it out. I played around with .htaccess, etc, but no avail. Maybe you can take a quick look and give me a solution. Really appreciate it! Thanks a lot! Robin --~--~-~--~~~---~--~~ 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: File Uploading
¿Did you put the attribute enctype=multipart/form-data in the form? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Auth Component custom error message for different situations
I was wondering if it's possible to print out a custom error message in cakephp when using the auth component. I am using the scope attribute to check if the user is active or not. Instead of flashing the loginError which is the usual either login or password is wrong, I want to say the account has been deactivated . Any way around this? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Cakephp Developers Required
I need cakephp developer for a new project. If any one interested let me know. --~--~-~--~~~---~--~~ 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: CakePHP in Google Summer of Code
I have an idea. ;) Due to a request by customer, I've started an open source project. http://code.google.com/p/oa-tools/ Although I use Chinese all around the project. Let me introduce here. The man, my customer, had a small script to generate a simple management interface(CRUD) with one SQL SELECT script. He wanted to improve it but didn't have enough time. So he decided to donate me to do it. After some talking, we decided to re-factor it with CakePHP. This tool is intended to satisfy users with limited IT knowledge. The users, generally the staff in the office, could do something before the responses from IT department when they have some simple requests, like collecting information to group-order fruits(although it looked like not the business of IT department. ;) ). Current Structures: Project - Form - FormField and Relationship It looked like a web form generator. You could setup a project and with some forms. Then the tool could generate base application structure, MVC around the form and form fields and the SQL script to create the schema in MySQL. And with the migration script from Georgi Momchilov, it could even create the database schema automatically. The relationship part is still under development. This project is using smarty as template engine to do code generation. So you could easily customize it with your needs. Let me know if somebody would like to bring this idea into GSoC, maybe I could have a chance to practice my English. ;) I'm still working on it till the end of the contract. --- kiang On 3月12日, 上午12時14分, Diego Caro A. diegoc...@gmail.com wrote: Hello everyone, today I went to a talk by Google Summer of Code[1], a google program for open source projects. This program offers student developers stipends to write code. Well, I want CakePHP in Google SoC. For this, we need a send a proposal with ideas to Google with a mentor (dedicated to the new developer guide), more info at [2]. My first idea for develop in this program are: - Mechanism to search into different models (like searchable-behaviour-for-cakephp [3]) for mysql and postgresql. Now, we need ideas, get a mentor and submit CakePHP into Google SoC Bye, and discuss this!. [1]:http://code.google.com/soc/ [2]:http://socghop.appspot.com/ [3]:http://code.google.com/p/searchable-behaviour-for-cakephp/ -- Diego Caro A. Estudiante Ing. Civil Informática diegocaro |http://diego.bloog.cl No tengo talentos especiales, pero sí soy profundamente curioso, Albert Einstein. --~--~-~--~~~---~--~~ 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: send POST with redirect()
Miles J wrote: Ajax or use javascript submit(). Thanks, but that's not exactly what I wanted to do. I want to set the POST Variables in the action method of the controller and then use $this-redirect(). e.g. something like $post['foo'] = bar; $this-redirect(http://someurl;); at http://someurl there then should be set $_POST['foo'] Marcel --~--~-~--~~~---~--~~ 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: Cakephp Developers Required
Hi Rajesh, I'm interested to know what your project is and what time you need allocated to the development. Cheers Graham Weldon On 13/03/2009, at 11:48 AM, Rajesh rajesh.mukk...@gmail.com wrote: I need cakephp developer for a new project. If any one interested let me know. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
how cakephp to manage its database connections?.
hi, I want to know how cakephp to manage its database connections. for example. can it been set the most connection count?, and has it a connection pool to manage all of the connections Thanks rimoe --~--~-~--~~~---~--~~ 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: send POST with redirect()
You are unable to do that, even outside of cake. You need a defined form, with hidden fields and you need to submit it to the form action. You could do get on the other hand, or do ajax like I stated. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Expiration Date
I am trying to use the beforeSave function to create an expiration date 30 days from creation time. function beforeSave() { if(!empty($this-data['Ticket']['user_id'])) { $this-data['Ticket']['expires'] = $this-expiresDate($this-data['Ticket']['created']); } return true; } function expiresDate($dateString) { $future = strtotime('+30 days', $dateString); return date('Y-m-d', strtotime($future)); } But its not doing anything. Is there something missing or wrong here? Dave --~--~-~--~~~---~--~~ 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: Info from Auth
Hello, I hava a similar problem, From mi actual code I extract this sample adjust the Session content whenever I need more nformation, for example: 1 ) Set class AppController extends Controller { function beforeFilter() { ... $this-Auth-redirect = false; ... } } 2) In UserController::login() include class UserController extends AppController { function login() { if (!$this-data) { $id = $this-Auth-user('id'); if ($id) { // Success login $this-__adjustSessionInfo($id); ... } } } function __adjustSessionInfo($id) { $this-User-contain(array('Group', 'Profile')); $user = $this-User-read(null, $id); $session = $this-Auth-user(); $session['User']['id'] = $id; if (array_key_exists('Profile', $user)) { if (isset($user['Profile']['first_name'])) { $session['User']['first_name'] = $user['Profile']['first_name']; } if (isset($user['profile']['father_last_name'])) { $session['User']['father_last_name'] = $user['Profile']['father_last_name']; } if (isset($user['Profile']['mother_last_name'])) { $session['User']['mother_last_name'] = $user['Profile]['mother_last_name']; } } else { $session['User']['first_name'] = $session['User']['username']; $session['User']['father_last_name'] = 'User'; } $session['User']['name'] = ''; $sep = ''; if (isset($session['User']['first_name'])) { $session['User']['name'] .= $sep.$session['User']['first_name']; $sep = ' '; } if (isset($session['User']['father_last_name'])) { $session['User']['name'] .= $sep.$session['User']['father_last_name']; $sep = ' '; }; if (isset($session['User']['mother_last_name'])) { $session['User']['name'] .= $sep.$session['User']['mother_last_name']; $sep = ' '; } $session['User']['is_super'] = $user['Group']['is_super']; $session['User']['group'] = $user['Group']['title']; $this-Session-del($this-Auth-sessionKey); $session = $session['User']; $this-Session-write($this-Auth-sessionKey, $session); } } In above code I added Profile and Group info to Session. Later on $this-Auth-user($key)will return any $key stored by __adjustSesison() function besides the ones stored by Auth itself. You may also delete any non wanted key. Regards. 2009/3/10 Sergei yatse...@gmail.com You have to do it by hands, using find() and beforeAction() on some actions where you need profile info. Auth doesn't get related data. On 11 мар, 05:47, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Does anyone know how to get user variables from the Auth from a different Table? [Auth] = Array ( [User] = Array ( [id] = 6 [username] = mary [email] = [group_id] = 4 [created] = 2009-03-10 14:29:45 [modified] = 2009-03-10 14:29:45 [last_login] = 2009-03-10 ) ) For example here Mary is User ID 6 she belongs to Group 4 which in this case is a TEACHER so she has a TEACHER profile which has an ID of 3. How can I take the Auth id 6 to find her Teacher ID in the TEACHER TABLE? Thanks Dave --~--~-~--~~~---~--~~ 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: Expiration Date
On Fri, Mar 13, 2009 at 12:03 AM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I am trying to use the beforeSave function to create an expiration date 30 days from creation time. function beforeSave() { if(!empty($this-data['Ticket']['user_id'])) { $this-data['Ticket']['expires'] = $this-expiresDate($this-data['Ticket']['created']); } return true; } function expiresDate($dateString) { $future = strtotime('+30 days', $dateString); return date('Y-m-d', strtotime($future)); } I was just working on something similar. You have to pass a timestamp as the 2nd param: $future = strtotime('+30 days', strtotime($dateString)); So, you could just change the method to: function expiresDate($dateString) { return date( 'Y-m-d', strtotime( '+30 days', strtotime($dateString) ) ); } --~--~-~--~~~---~--~~ 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: Jake question: rewrite problem?
Hi Brendon, Thanks for the response. I am following the documentation on Jake's website: http://dev.sypad.com/projects/jake/documentation/configuration/. It didn't specify whether joomla has to be installed under app\webroot or not. Since it does have a jake.ini configuration file, which allows me to put in the cakephp folder relative to the joomla folder I am guessing at least the component is trying to take care of the relative paths by itself. But I did try putting joomla in different locations. Here are a few examples I tried: 1. htdoc cakephp app webroot cake joomla components jake 2. htdoc cakephp app webroot index.php (of joomla) components (of joomla) jake administrator (of joomla) other joomla folders and files cake Neither of them worked for me. Same error and same symptoms (like the missing \cake in the URL, etc) Any clue? Thanks again! Robin On Mar 12, 6:08 pm, Brendon Kozlowski brendon...@hotmail.com wrote: Robin, I won't be able to respond again (most likely) until Monday at the earliest, but maybe someone else can help you if you provide some more information. It looks like your installation paths may be a problem. Can I ask what documentation you were following to get this setup (source)? Also, please give a textual example of your directory structure, if possible. CakePHP typically expects to be *below* the web root, which is why you may be having issues if both Joomla and CakePHP are at the same level (I haven't used Jake, but I'd think that Joomla should be inside Cake's webroot folder?). On Mar 12, 2:35 pm, Robin madsa...@gmail.com wrote: Hi everyone: I am pretty new to cakephp. I am trying to use the Jake component to integrate it into cms. I am having some problems and just wondering if you guys can help. My cakephp is version 1.2.0.5427alpha and joomla 1.5.9. Due to limited php knowledge, I am trying to avoid upgrading cake. Since I am using xampp on my own computer right now, so mod_rewrite is on. But I always get problem like the following when I connect from jake (with the url ofhttp://localhost/joomla/index.php?option=com_jake), while direct connect to cake (http://localhost/cake) is completely fine. Here is the error message I got when connecting with jake: -- Missing controller You are seeing this error because controller Controller could not be found. Notice: If you want to customize this error message, create app\views/ errors/missing_controller.ctp Fatal: Create the class below in file: app\controllers\controller.php ?php class Controller extends AppController { var $name = '';} ? ---- I found something weird as well and think it might mean something: I have a static page in my cakphp application: \cake\app\views \pages\about_us.ctp. When I connect directly to cake install route, I can see those pages perfectly fine with an url in address bar ashttp://localhost/cake/pages/about_us. However, when redirected from jake, the url becomehttp://localhost/pages/about_us(meantimethe error above appears) and clicking on it gives me 500 error. So my impression is that it's a rewrite problem. I must messed up with some configurations. But I am terribly new on this and could not figure it out. I played around with .htaccess, etc, but no avail. Maybe you can take a quick look and give me a solution. Really appreciate it! Thanks a lot! Robin- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
paginate problem
How to set conditions and order by in paginate() method of AppController? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Edit method adds a new model instead of just updating the data
Hi all. I can't figure out why my application keeps on adding new records when I edit a certain record. here's my edit method in controller: function edit($id = null) { if (empty($this-data)){ $this-Event-id = $id; $this-data = $this-Event-read(); $this-set('categories', $this-Category-find('list')); if (empty($this-data['Event']['name'])) { $this-Session-setFlash('Invalid Event ID.'); $this-redirect(array('action'='calendar'), null, true); } } else{ $clean = new Sanitize(); $this-data['Event']['name'] = $clean-html($this-data['Event'] ['name']); $this-data['Event']['desc'] = $clean-html($this-data['Event'] ['desc']); $this-data['Event']['user_id'] = 41; if ($this-Event-save($this-data)) { $this-Session-setFlash(__('Event updated.', true)); $this-redirect(array('action'='calendar'), null, true); exit(); } else { $this-Session-setFlash('The Event could not be saved. Please, try again.'); } } } edit.ctp: ?php echo $form-create('Event', array('type'='file', 'url' = array ('controller' = 'events', 'action' = 'edit'))); echo $form-input('Event.name', array('label'='Event')); echo 'Detailsbr/'.$form-textarea('Event.desc'); echo $form-input('keywords'); echo $form-input('Event.category_id', array('type'='select', 'options'=$categories, 'empty'= '--select category--','label'='Categories')); echo $form-input('Event.venue', array('type'='text', 'label'='Venue')); echo $form-input('Event.start_date', array('type'='text', 'label'='Start Date')); echo $form-input('Event.end_date', array('type'='text', 'label'='End Date')); echo 'labelImage/label'.$form-file('Image', array ('label'='Image')); // echo 'br/br/labelVideo/label'.$form-file('videoFile', array('label'='Video')); echo $form-end('Update Event'); ? /div It really gives me head ache so please help. --~--~-~--~~~---~--~~ 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: Edit method adds a new model instead of just updating the data
Place this outside of the if statement: $this-Event-id = $id; if (empty($this-data)) Your save is adding a new row because there is no id to do an update on. --~--~-~--~~~---~--~~ 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: paginate problem
Your question is kind of vague. http://book.cakephp.org/view/165/Controller-Setup Im not sure you can set $paginate values in the AppController. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---