Re: validation criteria at least 3 fileds are not empty
As I understand validation handles only one filed. Am I wrong? rrd 2014. október 26., vasárnap 19:33:14 UTC+1 időpontban John Andersen a következőt írta: Good to see that you are trying to solve this :) I would still have gone with rolling my own validation, just by extending the validator, so it can validate a record also, not only fields. Anyway, I am not moving to CakePHP 3.x, so will not be able to give further ideas on that, but I do hope you find a solution in the end. Enjoy, John On Thursday, 23 October 2014 12:12:11 UTC+3, Radharadhya Dasa wrote: I checked to cookbook and find out that validation handles singe fields. So I used beforeSave for this. public function beforeSave(Event $event, Entity $entity, ArrayObject $options){ if((!empty($entity-name) + !empty($entity-contactname) + !empty( $entity-zip_id) + !empty($entity-address) + !empty($entity-phone) + !empty( $entity-email) + !empty($entity-birth-time)) = 3){ return true; } else{ //Error: __('At least 3 info should be filled'); return false; } } But I have a problem and a question. The above gives me this error message: *Warning* (4096): Argument 1 passed to App\Model\Table\ContactsTable::beforeSave() must be an instance of App\Model\Table\Event, instance of Cake\Event\Event given, called in /home/rrd/public_html/sanga/vendor/cakephp/cakephp/src/Event/EventManager.php on line 266 and defined [*APP/Model/Table/ContactsTable.php*, line *85*] What is the proper way to do it? The question is how to define an error message what will be flashed to the user? 2014. október 18., szombat 15:41:28 UTC+2 időpontban John Andersen a következőt írta: Assuming you are still using CakePHP 3.0 I have not seen any built-in rules for this kind of validation, so my best guess is to roll your own. See section Custom Validation Rules under Validation in the CakePHP 3.0 book. That should help you on the way. Enjoy, John On Saturday, 18 October 2014 16:21:57 UTC+3, Radharadhya Dasa wrote: Hi, Is there a way to check if at least 3 fileds are not empty? I have 8 fileds and any of those could be empty, but at least 3 of them should be not empty. Is there any build in validation rule, or how to do it? Should I do it on beforeSave? rrd -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
[Question] Acl query error
Hello guys, I'm totally newbie in CakePHP. Now I'm working on acl. I've set my access to administrator which can do anything. But when i call method/action add or anything that i don't allow in beforeFilter() method there is an error like this *Error: *SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Aro0.foreignKey' in 'where clause' *SQL Query: *SELECT `Aro`.`id`, `Aro`.`parent_id`, `Aro`.`model`, `Aro`.`foreign_key`, `Aro`.`alias` FROM `dotcore`.`aros` AS `Aro` INNER JOIN `dotcore`.`aros` AS `Aro0` ON (`Aro`.`lft` = `Aro0`.`lft` AND `Aro`.`rght` = `Aro0`.`rght`) WHERE `Aro0`.`model` = 'Group' AND `Aro0`.`foreignKey` = '1' ORDER BY `Aro`.`lft` DESC Please help me -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: validation criteria at least 3 fileds are not empty
You are correct. With custom validation methods or with the validation callbacks you can extend the validation process to to more than what it is designed to do. On Tuesday, October 28, 2014 8:06:19 AM UTC+1, Radharadhya Dasa wrote: As I understand validation handles only one filed. Am I wrong? rrd 2014. október 26., vasárnap 19:33:14 UTC+1 időpontban John Andersen a következőt írta: Good to see that you are trying to solve this :) I would still have gone with rolling my own validation, just by extending the validator, so it can validate a record also, not only fields. Anyway, I am not moving to CakePHP 3.x, so will not be able to give further ideas on that, but I do hope you find a solution in the end. Enjoy, John On Thursday, 23 October 2014 12:12:11 UTC+3, Radharadhya Dasa wrote: I checked to cookbook and find out that validation handles singe fields. So I used beforeSave for this. public function beforeSave(Event $event, Entity $entity, ArrayObject $options){ if((!empty($entity-name) + !empty($entity-contactname) + !empty( $entity-zip_id) + !empty($entity-address) + !empty($entity-phone) + !empty( $entity-email) + !empty($entity-birth-time)) = 3){ return true; } else{ //Error: __('At least 3 info should be filled'); return false; } } But I have a problem and a question. The above gives me this error message: *Warning* (4096): Argument 1 passed to App\Model\Table\ContactsTable::beforeSave() must be an instance of App\Model\Table\Event, instance of Cake\Event\Event given, called in /home/rrd/public_html/sanga/vendor/cakephp/cakephp/src/Event/EventManager.php on line 266 and defined [*APP/Model/Table/ContactsTable.php*, line *85*] What is the proper way to do it? The question is how to define an error message what will be flashed to the user? 2014. október 18., szombat 15:41:28 UTC+2 időpontban John Andersen a következőt írta: Assuming you are still using CakePHP 3.0 I have not seen any built-in rules for this kind of validation, so my best guess is to roll your own. See section Custom Validation Rules under Validation in the CakePHP 3.0 book. That should help you on the way. Enjoy, John On Saturday, 18 October 2014 16:21:57 UTC+3, Radharadhya Dasa wrote: Hi, Is there a way to check if at least 3 fileds are not empty? I have 8 fileds and any of those could be empty, but at least 3 of them should be not empty. Is there any build in validation rule, or how to do it? Should I do it on beforeSave? rrd -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
cant open uploaded file
Hi, I am trying to open a file that has been uploaded to attachments folder on a cakephp project. I have a list of files I select after uploading . This works fine on my PC but on the remote server it is throwing a 503 error which I have no idea in what to do . The error logs show nothing. public function download2($attachment_id = null){ $file = $this-Tutor-Attachment-find('first', array('conditions' = array('Attachment.id' = $attachment_id), 'recursive' = -1)); //pr($file); die; if(!empty($file)){ $this-response-file($file['Attachment']['url'], array('name' = $file['Attachment']['org_filename'])); //Return reponse object to prevent controller from trying to render a view return $this-response; } else{ $this-Session-setFlash(__('Error encountered while downloading the file. Please, try again.'),'flash_alert'); } } -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
base.css in cake3
Hi ,anyone knows if full package of zurb-foundation is included on base.css and if yes what version is? best regards -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: base.css in cake3
It is a full version of foundation version 5 On Tuesday, October 28, 2014 2:52:30 PM UTC+1, cesar calvo wrote: Hi ,anyone knows if full package of zurb-foundation is included on base.css and if yes what version is? best regards -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
After I change my User.name, can not log in..
Ok friends The situation is as follows: Admin has the ability to change the name, email address and other profile information of users, but this form does not contain the password field. When admin, save the changes, a user can not log in. I looked in the database there is a password unchanged. But when I set the password field (which is mandatory) in the form, and save all together, the user can log in without a problem. For login information using email and password. fields in the user table: id, name, email, password, group_id, ... What could be, sessions? How to solve this problem? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: After I change my User.name, can not log in..
Ok, I solved my problem. After the admin save user settings without password fields in the User model we have beforesave method, which returns a hash password, in this case the function create a new password from scratch and save it into the database. solution: UsersController :: admin_edit (): put a dummy data $this - request - data ['User']['dummy'] == true; User model public function beforeSave($options = array()) { if(!isset($this-data['User']['dummy'])) { $this-data['User']['password'] = AuthComponent::password( $this-data['User']['password'] ); } return true; } -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Converting an existing site using different framework to CakePHP
Hi all - I've recently begun working on a project for a friend. He was previously working with another coder who was using his own home-grown web application framework. The coder abruptly disappeared off the face of the earth, and I've been recruited to make sense of the site. I've been able to do this with some success just using hard PHP coding, but figuring out the framework just from the code is a daunting task. The previous coder had sites up for downloading editors for his framework, etc. He has taken all those sites down. So I can't just jump right into what he was working with. My question is this: How difficult would it be to transfer the existing site over to CakePHP? Or is that even possible at all? If so, what would some of you suggest? Thanks! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Pagination in element
I have news with comments. I'd like to paginate comments but I have the errors like this: Notice (8): Undefined index: count [CORE\Cake\View\Helper\PaginatorHelper.php, line 646] and of course I don't see numbers, links etc. Do you have any idea how to solve this problem? Thanks! Component: public function viewFromNewsId($news_id = null) { $this-NewsComment-recursive = 0; $this-Paginator-settings = array('conditions' = array('NewsComment.news_id' = $news_id, 'NewsComment.is_active' = '1'), 'limit' = 5, 'order' = array('NewsComment.id' = 'desc')); $newsComments = $this-Paginator-paginate('NewsComment');if (isset($this-params['requested'])){return $newsComments;}} Element: $newsIdFromUrl = $this-params['pass'][0]; $newsComments = $this-requestAction(newsComments/viewFromNewsId/$newsIdFromUrl);foreach($newsComments as $newsComment): $this-App-showNewsComment($newsComment); endforeach; echo $this-Paginator-counter('Liczba newsów: {:count} | '); echo $this-Paginator-prev(' wstecz', null, null, array('class' = 'disabledText')); echo $this-Paginator-numbers(array('separator' = ' ', 'before' = ' | ', 'after' = ' | ', 'modulus' = '10')); echo $this-Paginator-next('dalej ', null, null, array('class' = 'disabledText')); echo br /; View: echo $this-element('newsViewComments'); -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Security Component is Ruining my Life
On Mon, Oct 27, 2014 at 10:38 PM, Florian Krämer bur...@doomzone.de wrote: I've turned the idea into an implementation. Proof of concept goes here: https://github.com/burzum/cakephp/commit/9d8f6b4cb7653dd14130af68dbc632e9055d8d76 Cool! I will try this out... Tarique -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.