saveall on habtm creates duplicate new rows
Hi, I have a simple HABTM with a lessons/Students table. i simply create a new lesson with an existing student via a while loop , so I should get 2 new rows. I am testing this function. What I get is 4 new rows in the lesson table instead of 2. I have no idea why the extra 2 rows are created as they are a duplicates of the 2 new rows which are outputted in debug. Everything is correctly saved like the entries in join lesson/student table and all the FK exist. Just to add confusion, sometimes the same code produces the desired 2 rows . This is unstable so I am doing something wrong. I followed the array setup for habtm as in the manual for saves. http://book.cakephp.org/2.0/en/models/saving-your-data.html private function book_lessons($lesson=null) { // debug( $lesson); $i=0; while ($i2) { $date=date('Y-m-d'); $data[$i]=array(); $data[$i]['Lesson']['lesson_date']= $date; $data[$i]['Lesson']['start_time']= $lesson['Lesson']['start_time']; $data[$i]['Lesson']['end_time']=$lesson['Lesson']['end_time']; $data[$i]['Lesson']['schedule_rec']= 1; $data[$i]['Lesson']['subject_id']= $lesson['Lesson']['subject_id']; $data[$i]['Lesson']['tutoring_type_id']= 1; $data[$i]['Lesson']['tutor_id']= $lesson['Lesson']['tutor_id']; $data[$i]['Lesson']['subject_id']= $lesson['Lesson']['subject_id']; $data[$i]['Lesson']['term_id']= $lesson['Lesson']['term_id']; $data[$i]['Student']['id']=$lesson['Student']['id']; $i=$i+1; } $this-Lesson-saveAll($data); public $hasAndBelongsToMany = array( 'Student' = array( 'className' = 'Student', 'joinTable' = 'lessons_students', 'foreignKey' = 'lesson_id', 'associationForeignKey' = 'student_id', 'unique' = 'keepExisting', ) ); array( (int) 0 = array( 'Lesson' = array( 'lesson_date' = '2015-06-11', 'start_time' = '16:00:00', 'end_time' = '17:00:00', 'schedule_rec' = (int) 1, 'subject_id' = '16', 'tutoring_type_id' = (int) 1, 'tutor_id' = '12', 'term_id' = '10' ), 'Student' = array( 'id' = '206' ) ), (int) 1 = array( 'Lesson' = array( 'lesson_date' = '2015-06-11', 'start_time' = '16:00:00', 'end_time' = '17:00:00', 'schedule_rec' = (int) 1, 'subject_id' = '16', 'tutoring_type_id' = (int) 1, 'tutor_id' = '12', 'term_id' = '10' ), 'Student' = array( 'id' = '206' ) ) ) -- 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: how is this saving without a table
I did this and i cant see anything unusual ?php App::uses('AppModel', 'Model'); /** * Subject Model * * @property Lesson $Lesson * @property Student $Student * @property Tutor $Tutor */ class Term extends AppModel { var $displayField = Title; public function get_current_term ( ) { $today = date(Y-m-d); return $this-find('first', array('conditions'= array('AND' = array(array('Term.start_date =' = $today), array('Term.end_date =' = $today);; } public function get_neighbors_by_id ( $term_id ) { return $this-find('neighbors', array('field' = 'id', 'value' = $term_id)); } public function get_term_by_id( $term_id ) { return $this-read(null, $term_id); } } -- 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.
OnChange event wont work in cakephp
Hi, I cant get any onchange event to fire. I just want to disable a textbox when some options are selected. I used id and name in textbox but I cant get thus to work as when i click the radio button nothing changes. I used radio buttons echo $this-Form-input('startDate',array('id'='startdatebox','label' = 'Start Date','class'='datepicker', 'type'='text','style'='width:100px;height:30px','value' = $datestart)); echo '/td'; echo 'td'; echo $this-Form-input('endDate',array('id'='enddatebox','label' = 'End Date','class'='datepicker', 'type'='text','style'='width:100px;height:30px','value' = $dateend)); echo '/td'; echo $this - Form - input('dateRange', array('id'='dateRange','label' = 'h6Date Range/h6','type' = 'radio', 'value' =$dateSelect,'options' = $selectoption)); script type=text/javascript $(document).ready(function() { $('#dateRange').change(function() { if ( $(this:'checked').val() != 3 ) { $('#startdatebox]').prop('disabled', true); $('#enddatebox]').prop('disabled', true); alert('asdsad'); } else { $('#startdatebox]').prop('disabled', false); $('#enddatebox]').prop('disabled', false); alert('asdsad'); } }); }); /script -- 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: OnChange event wont work in cakephp
Is there an answer for this ? I am sure I can get it with an example please -- 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.
how is this saving without a table
In cakephp I have some code which saves data without a table and I have no idea how. The model,controller show nothing like below it works fine but there is no tablecalled terms ?php App::uses('AppController', 'Controller'); /** * Subjects Controller * * @property Subject $Subject */ class TermsController extends AppController { public function add() { if ($this-request-is('post')) { $this-Term-create(); if ($this-Term-save($this-request-data)) { $this-Session-setFlash(__('The Term has been saved'), 'flash_success'); $this-redirect(array('controller' = 'configs', 'action' = 'index')); } else { $this-Session-setFlash(__('The Term could not be saved. Please, try again.')); } } } -- 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: how is this saving without a table
$terms=$this-Term-find('all' ); //displays everything and you can edit these fields in another page. There is no table called terms in any database I have. How is this happening? -- 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: pagination with join and array in cakephp
I still cant get this to work with paginate but i can with find all , so there has to be a way $options['recursive'] =-1; I still cant get this to work with paginate but i can with find all , so there has to be a way $options['recursive'] =-1; -- 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 with join and array in cakephp
Hi, in cakephp I used a 'find all' to do a complex and this works fine as below. My issue is I am trying to convert this to a set paginated results and I keep getting offset warning Illegal offset type [CORE\Cake\Model\Model.php, line 2936. I am sure the issue is simple but is there a way to to do this with the $option arrays I have for the search . I didnt see an example in the docs for the paginate results with an array set for the options http://book.cakephp.org/2.0/en/core-libraries/components/pagination.html $this-Lesson-recursive = -1; $options['joins'] = array( array('table' = 'lessons_students', 'alias' = 'LessonsStudent', 'type' = 'LEFT', 'conditions' = array( 'Lesson.id = LessonsStudent.lesson_id', ) ), array('table' = 'students', 'alias' = 'Student', 'type' = 'LEFT', 'conditions' = array( 'LessonsStudent.student_id=Student.id', ) ), array('table' = 'subjects', 'alias' = 'Subject', 'type' = 'LEFT', 'conditions' = array( 'Lesson.subject_id=Subject.id', ) ), array( 'table' = 'tutors', 'alias' = 'Tutor', 'type' = 'LEFT', 'conditions' = array( 'Lesson.tutor_id = Tutor.id' ) ) , array('table' = 'tutoring_types', 'alias' = 'TutoringType', 'type' = 'LEFT', 'conditions' = array( 'Lesson.tutoring_type_id=TutoringType.id', ) ) ); $options['fields'] = array('Student.last_name','Student.first_name','Student.id', 'Lesson.lesson_date', 'Lesson.start_time', 'Lesson.end_time', 'Lesson.id','Lesson.schedule_rec','Lesson.schedule_monthly','Lesson.schedule_yearly', 'Lesson.cancelled_by', 'Lesson.makeup_lesson', 'Lesson.tutoring_type_id', 'Lesson.forefit', 'LessonsStudent.*', 'Tutor.last_name', 'Tutor.first_name','Tutor.id', 'Subject.name','Subject.id', 'TutoringType.*'); $options['conditions'] = array('Lesson.lesson_inactive' = 0,'Lesson.makeup_lesson' = 0,'Lesson.forefit' = 0, 'Lesson.lesson_date = ' = $startdate, 'Lesson.lesson_date = ' = $enddate, 'AND' =array( array('OR' = array( array('Student.first_name LIKE' = '%' . $searchFirstName . '%'), array('Tutor.first_name LIKE' = '%' . $searchFirstName . '%'), array('Student.guardian_first_name LIKE' = '%' . $searchFirstName . '%'), ), array('OR' = array( array('Student.last_name LIKE' = '%' . $searchLastName . '%'), array('Tutor.last_name LIKE' = '%' . $searchLastName . '%'), array('Student.guardian_last_name LIKE' = '%' . $searchLastName . '%'), ) , array('OR' = array( array('Student.student_mobile LIKE' = '%' . $searchmobile . '%'), array('Tutor.mobile LIKE' = '%' . $searchmobile . '%'), array('Student.guardian_mobile LIKE' = '%' . $searchmobile . '%'), ) ); $options['order'] =array('Lesson.lesson_date','Lesson.start_time'); $options['limit'] =150; $options['page'] =1; //$lessons= $this-Lesson-find('all', $options ); $options['recursive'] =50; $this-Paginator-settings = array($options); $lessons= $this-Paginator-paginate('Lesson'); -- 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
how can i return to page with same search filters
Hi, In cakephp I can add search filters and change the post vars into Get as below. This works fine. My problem is how do go to another page found from the list of searches and return to the same page? All search filters are gone when i return as I am not storing them. eg I search for invoice 2 and get a list of searches. i click on link from the search and view a page. I then want to return to the same page with same page number for invoice 2? if (($this-request-is('post') ||$this-request-is('put')) isset($this-request-data['filter'])) { $filter_url['controller'] = $this-request-params['controller']; $filter_url['action'] = $this-request-params['action']; $filter_url['page'] = 1; // for each filter we will add a GET parameter for the generated urlforeach($this-data['Filter'] as $name = $value){ if($value){ $filter_url[$name] = urlencode($value); }} //Post params are now GET paramatersreturn $this-redirect($filter_url); }//isset -- 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: how can i return to page with same search filters
I had a look it and it looks difficult to use. NOt sure if this is the best way to go and where is a complete example and ability to go back to the page? This doesnt really help -- 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: cant remove page from url pagination to prevent error
You mean use get instead of post? -- 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 remove page from url pagination to prevent error
Hi, In cakephp I keep getting a page out of range error. The problem only happens when I am page:2 or above and I perform a search. The search works fine unless this is only 1 page found and then I get the error if the URL has page 2 or above. I tried resetting the page no, to 1 and I tried a try/catch block without any success, from previous posts. How can I perform a search and reset the page:x back to page1 so I dont get this error? I couldnt find this answer in the docs or google. http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html#PaginatorHelper Error: The requested address '../admin_list2/page:2' was not found on this server. in controller $this-Paginator-settings = array( 'conditions'= array ($tutor=$tutorId,$conditionStartDate=$valStartdate, $conditionEndDate=$valEnddate, $conditionInvoice=$invoice), 'order' = array('TimeSheet.period_start_date'='desc'), 'limit' = $noRecords, 'page' = 1, 'recursive'=-1); $timesheet= $this-Paginator-paginate('TimeSheet'); try { $this-Paginator-paginate(); } catch (NotFoundException $e) { //Do something here like redirecting to first or last page. debug('error'); // never works } http://list2/page:2 -- 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.
CakePHP autocomplete tutorial ajax error
Hi, In CakePHP, I am trying to create a autocomplete function from a textbox, using this tutorial: http://bakery.cakephp.org/articles/matt_1/2011/08/07/yet_another_jquery_autocomplete_helper_2 I keep getting a Error: AutoCompleteHelper could not be found. Undefined index: autoCompleteText I am unsure how to fix this as I have tried relocating the files and still the same error. I create the below files and copy the code from the tutorial, create the auto_complete.php in the view/helpers directory, and create webroot/js/views/helpers/auto_complete.js. controller - Tests function auto_complete class TestsController extends AppController { public $helpers = array('Html', 'Form', 'Session','Js','AutoComplete'); public function auto_complete() { $this-loadModel('Tutor'); debug( $this-params); $terms = $this-Tutor-find('all', array( 'conditions' = array( 'Tutor.first_name LIKE' = $this-params['url']['autoCompleteText'].'%' ), 'fields' = array('Tutor.first_name'), 'limit' = 3, 'recursive'=-1, )); $terms = Set::Extract($terms,'{n}.Tutor.first_name'); $this-set('terms', $terms); $this-layout = ''; } view auto_complete.ctp ?php echo $this-AutoComplete-input( 'Tutor.first_name', array( 'autoCompleteUrl'=$this-Html-url( array( 'controller'='tests', 'action'='auto_complete', ) ), 'autoCompleteRequestItem'='autoCompleteText', ) ); if(isset($terms)) { echo $this-Js-object($terms); } echo $this-Form-create(''); echo $this-Form-input('type', array('label' = 'Choose' )); echo $this-Form-end('send'); ? -- 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.
Cakephp Autocomplete Tutorial ajax error
In CakePHP, I am trying to create a autocomplete function from a textbox, using this tutorial: http: //bakery.cakephp.org/articles/matt_1/2011/08/07/yet_another_jquery_autocomplete_helper_2 I keep getting a Undefined index: autoCompleteText I solved the helper issue as it finds the helper as this is cakephp 1.X code and I have 2.X controller - Tests function auto_complete class TestsController extends AppController { public $helpers = array('Html', 'Form', 'Session','Js','AutoComplete'); public function auto_complete() { $this-loadModel('Tutor'); debug( $this-params); $terms = $this-Tutor-find('all', array( 'conditions' = array( 'Tutor.first_name LIKE' = $this-params['url']['autoCompleteText'].'%' ), 'fields' = array('Tutor.first_name'), 'limit' = 3, 'recursive'=-1, )); $terms = Set::Extract($terms,'{n}.Tutor.first_name'); $this-set('terms', $terms); $this-layout = ''; } view auto_complete.ctp ?php echo $this-AutoComplete-input( 'Tutor.first_name', array( 'autoCompleteUrl'=$this-Html-url( array( 'controller'='tests', 'action'='auto_complete', ) ), 'autoCompleteRequestItem'='autoCompleteText', ) ); if(isset($terms)) { echo $this-Js-object($terms); } echo $this-Form-create(''); echo $this-Form-input('type', array('label' = 'Choose' )); echo $this-Form-end('send'); ? -- 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: cant get autocomplete function to find helper class
I checked the docs and the autocomplete tutorial is for cakephp 1.X To use it for cakephp 2.X I couldnt get it to work so I am stuck -- 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 get autocomplete function to find helper class
In CakePHP, I am trying to create a autocomplete function from a textbox, using this tutorial: http://bakery.cakephp.org/articles/matt_1/2011/08/07/yet_another_jquery_autocomplete_helper_2 I keep getting a Error: AutoCompleteHelper could not be found. Undefined index: autoCompleteText I am unsure how to fix this as I have tried relocating the files and still the same error. I create the below files and copy the code from the tutorial, create the auto_complete.php in the view/helpers directory, and create webroot/js/views/helpers/auto_complete.js. controller - Tests function auto_complete class TestsController extends AppController { public $helpers = array('Html', 'Form', 'Session','Js','AutoComplete'); public function auto_complete() { $this-loadModel('Tutor'); debug( $this-params); $terms = $this-Tutor-find('all', array( 'conditions' = array( 'Tutor.first_name LIKE' = $this-params['url']['autoCompleteText'].'%' ), 'fields' = array('Tutor.first_name'), 'limit' = 3, 'recursive'=-1, )); $terms = Set::Extract($terms,'{n}.Tutor.first_name'); $this-set('terms', $terms); $this-layout = ''; } view auto_complete.ctp ?php echo $this-AutoComplete-input( 'Ttuor.first_name', array( 'autoCompleteUrl'=$this-Html-url( array( 'controller'='tests', 'action'='auto_complete', ) ), 'autoCompleteRequestItem'='autoCompleteText', ) ); if(isset($terms)) { echo $this-Js-object($terms); } echo $this-Form-create(''); echo $this-Form-input('type', array('label' = 'Choose' )); echo $this-Form-end('send'); ? -- 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 send email with this provider
Hi, My email code for cakephp worked fine when I used gmail but not for this provider below. I am not sure what to do as I have all the correct information. The error get is timed-out [code] config/email.php public $gmail2 = array( 'from' = array('x...@xx.com.au' = 'Aptutoring'), 'host' = 'mail.ecentriconline.net', // 'port' = 2525, 'port' = 465, 'username' = 'x...@ecentriconline.net', 'password' = 'XXX', 'transport' = 'Smtp' ); $Email = new CakeEmail(); $Email-config('gmail2'); $to=$item['Tutor']['email']; $Email-from( array('x...@xx.com.au' = 'Aptutoring')); $Email-to($to); $Email-subject('Hello'); $Email-send($message); [/code] -- 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 send email with this provider
Hi, My email code for cakephp worked fine when I used gmail but not for this provider below. I am not sure what to do as I have all the correct information. The error get is timed-out [code] config/email.php public $gmail2 = array( 'from' = array('i...@aptutoring.com.au' = 'Aptutoring'), 'host' = 'mail.ecentriconline.net', // 'port' = 2525, 'port' = 465, 'username' = 'x...@ecentriconline.net', 'password' = 'XXX', 'transport' = 'Smtp' ); $Email = new CakeEmail(); $Email-config('gmail2'); $to=$item['Tutor']['email']; $Email-from( array('i...@aptutoring.com.au' = 'Aptutoring')); $Email-to($to); $Email-subject('Hello'); $Email-send($message); [/code] -- 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 send email on remote server but can on local
Hi, I am having problems with cakephp email. I have this weird problem where my below email code works fine on my local server but not on the remote server. The error I get is SMTP Error: 534 5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 u5sm29708221pdh.54 - gsmtp which doesnt make any sense to me because my email does work from my local server, the google account has low security enabled already. my email.php public $gmail2 = array( 'host' = 'ssl://smtp.gmail.com', 'port' = 465, 'username' = 'xx...@gmail.com', 'password' = 'xx', 'transport' = 'Smtp', ); in controller $Email = new CakeEmail(); $Email-config('gmail2'); // $to=$item['Tutor']['email']; $to='xxx'; $Email-from( array('xx' = 'Aptutoring')); $Email-to($to); $Email-subject('Hello'); $Email-send($message); //$message set elsewhere -- 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: mailchimp cakephp api
I can already create and save emails with cakeemail so forget about this issue . I dont have a cakephp issue I have a problem getting the API mailchimp to connect and then being able to access emails. Composer is never simple . If I am going to to get this to work then it will be easier of someone can actually do i themselves . I am using windows not linux.Here is the composer.json that comes with the API and what exactly do I do next. Please dont say look at the docs as I have seen this. { name : dereuromark/cakephp-mailchimp, description : A CakePHP plugin for MailChimp, type : cakephp-plugin, authors : [{ name : Mark Scherer, homepage : http://www.dereuromark.de; } ], keywords : [ cakephp, plugin, mailchimp ], homepage : https://github.com/dereuromark/cakephp-mailchimp;, license : [ MIT ], require : { composer/installers : *, php : =5.3 }, support : { source : https://github.com/dereuromark/cakephp-mailchimp; }, extra : { installer-name : Mailchimp } } -- 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.
mailchimp cakephp api
Hi, I want to be able to view emails in a cakephp page sent via mailchimp. The API is here but Here are the instructions https://github.com/dereuromark/cakephp-mailchimp 1)Install the plugin into the APP/Plugin folder, ideally via composer. //how? I just copied the extracted zip folder instead, is this OK? 2)Make sure it is loaded - using CakePlugin::loadAll(), for example. Use the Configure class to set the API data (via APP/Config/configs.php etc): //there is NO SUCH FILE configs.php //This goes where? $config['Mailchimp'] = array( 'apiKey' = 'YOUR_API_KEY', 'defaultListId' = 'YOUR_LIST_ID', 'defaultCampaignId = 'YOUR_CAMPAIGN_ID' ); -- 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: cant send email
Ok I used ssl and this worked as is public $gmail2 = array( 'host' = 'ssl://smtp.gmail.com', 'port' = 465, 'username' = 'jxxxm', 'password' = 'j', 'transport' = 'Smtp', ); -- 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: cant send email
Hi, This has no effect and I get the same dumb error which tells me nothing. $Email = new CakeEmail(); $Email-from('jagg...@gmail.com'); $Email-to('jag...@gmail.com'); $Email-subject('About'); $Email-message('My message'); $Email-send(); -- 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: cant send email
removing email from components has no effect i should have said -- 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: cant send email
A lot of people have problems with this issue on stackoverflow buthe solutions are not clear 2014-12-29 22:44:07 Error: [SocketException] SMTP timeout. Request URL: /crm5/aptemails/test Stack Trace: #0 D:\AA-website design\crm5\lib\Cake\Network\Email\SmtpTransport.php(157): SmtpTransport-_smtpSend(NULL, '220') #1 D:\AA-website design\crm5\lib\Cake\Network\Email\SmtpTransport.php(95): SmtpTransport-_connect() #2 D:\AA-website design\crm5\lib\Cake\Network\Email\CakeEmail.php(1130): SmtpTransport-send(Object(CakeEmail)) #3 D:\AA-website design\crm5\app\Controller\AptemailsController.php(66): CakeEmail-send('sadfasdf asdf a...') #4 [internal function]: AptemailsController-test() #5 D:\AA-website design\crm5\lib\Cake\Controller\Controller.php(490): ReflectionMethod-invokeArgs(Object(AptemailsController), Array) #6 D:\AA-website design\crm5\lib\Cake\Routing\Dispatcher.php(191): Controller-invokeAction(Object(CakeRequest)) #7 D:\AA-website design\crm5\lib\Cake\Routing\Dispatcher.php(165): Dispatcher-_invoke(Object(AptemailsController), Object(CakeRequest)) #8 D:\AA-website design\crm5\app\webroot\index.php(92): Dispatcher-dispatch(Object(CakeRequest), Object(CakeResponse)) #9 {main} -- 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: cant send email
Hi, I already have this line below and it doesnt work at all. I just get timed out and if I increase the time to -1 in php.ini it does nothing Whats wrong with this cakephp email as this is annoying now. $Email = new CakeEmail('gmail'); -- 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 send email
I cant send an email as I get a generic error *Error: * An Internal Error Has Occurred. In config\email.php I have this for a real gmail account(pswd hidden) public $gmail = array( 'host' = 'smtp.gmail.com', 'port' = 465, 'username' = 'jagguy...@gmail.com', 'password' = 'X', 'transport' = 'Smtp', 'tls' = true ); in controller I have App::uses('CakeEmail', 'Network/Email'); public $components = array('Email','Session','Paginator'); public function test() { $Email = new CakeEmail(); $Email-from(array('jagguy...@gmail.com' = 'My Site')); $Email-to('jagguy...@gmail.com'); $Email-subject('About'); $Email-send('My message'); } -- 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 send email from localhost
Hi, I cant send a email from my localhost xampp/win7 I dont get an error , I just get nothing I set up the email and also config. I read the docs and couldnt see anything on this. http://book.cakephp.org/2.0/en/core-utility-libraries/email.html $Email = new CakeEmail(); $Email-config('smtp') -from('em...@gmail.com') -to('jagguy...@gmail.com') -subject('Test') -send($message); public $smtp = array( 'transport' = 'Smtp', 'from' = array('site@localhost' = 'My Site'), 'host' = 'localhost', 'port' = 25, 'timeout' = 30, 'username' = 'user', 'password' = 'secret', 'client' = null, 'log' = false, //'charset' = 'utf-8', //'headerCharset' = 'utf-8', ); -- 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: cant send email from localhost
This isnt working and I need help as I cant fund help from the docs.I set up the settings and in the config file I have public $gmail = array( 'from' = array('jagguy...@gmail.com' = 'Aptutoring'), 'host' = 'localhost', 'port' = 25, 'username' = 'm...@gmail.com', //I changed the name but he email/password is real gmail account 'password' = 'test', // 'transport' = 'Smtp' ); public $smtp = array( 'transport' = 'Smtp', // 'from' = array('site@localhost' = 'My Site'), 'from' = array('jagguy...@gmail.com' = 'My Site'), 'host' = 'localhost', 'port' = 25, 'timeout' = 30, 'username' = 'user', 'password' = 'secret', 'client' = null, 'log' = false, //'charset' = 'utf-8', //'headerCharset' = 'utf-8', ); No connection could be made because the target machine actively refused it. -- 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.
compare time arrays
Hi, How do you compare time arrays in cakephp? I tried to convert the time to a string without success as I get the same string over again or false. There has to be an easy way which is hidden somewhere in cakephp docs which I couldnt find? $rr2=($this-request-data['TutorRequest']['thu_end']); //time array $date_string = date('H:i:s', strtotime($rr)); eg both time arrays but this doesnt work if ( $this-request-data['TutorRequest']['wed_start'] $this-request-data['TutorRequest']['wed_end'] -- 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.
download trigger error
Hi, In cakephp 2.5.x I am trying to download an uploaded file from the server. The code below works fine on my computer but when I upload the same code to a copy of the same working cakephp project on a remote server I get this 503 error. If I remove the line to download $this-response-file($fil ename, array('download' = true, 'name' = $filesave)); then the error goes but no functionality of course. I dont know how to fix this because the same code works fine on my computer. 503 Service Unavailable The server is temporarily busy, try again later! -- 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.
cant set the select option on post
Hi, In cakephp I cant set the selected option on a dropdown list when i post. Wjat happens is that I select an option and Post. Then the controller will find the data and go back to the same page but the selected value in the selected list is the the default. So I should select a date from the list, press button and be redirected to the same page with the selected date. That date should be selected in the select list. The code works but the selected option doesnt stay the same when the page is redirected back to the same page from the controller. //controller if (isset($this-request-data['button1'])) { $startdate=$this-request-data['Lesson']['ChooseAPaycycleStartDate']; $enddate=date('Y-m-d',strtotime ( +13 . ' day' , strtotime ( $startdate))); $this-redirect(array('action' = 'lesson_plan',$startdate,$enddate)); } /view echo $this-Form-create(); echo $this-Form-input('ChooseAPaycycleStartDate', array('options' = array('2014-10-06'='06-10-2014' , '2014-10-20'='20-10-2014', '2014-11-3'='3-11-2014', '2014-01-01'='01-01-2014'))); // , 'type' = 'select', 'selected' = 2))); echo $this-Form-submit('Get Lesson Plans',array('name'='button1')); echo $this-Form-end(); -- 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: add in a field to a array with multiple records
To makes things clearer I can save multiple records at once. I can add fields to these records manually as I need to add additional fields that the user cant add in themselves. The problem is also i dont want to save associated models and just 1 model, so saveAssociated is not what i want. I dont want to save availabilityfortutors -- 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.
get the id's from checkbox list
Hi, I have a simple question. I display some data from a table and all I want is the user to check the checkbox and click a button. The button will then pass all the data to the controller Post? and I just go through an find out what checkboxes have been checked with the ID . Like a list of rows marked for delete. I have gone through the docs and I am still not getting anything in debug as I get an empty array. The $id field has a value. public function index() { .. if ($this-request-is('post')) { $chk = array('Availtmp' = $this-request-data); // $chk = $this-request-data; debug($this-request-data); } echo $this-Form-create(array('type' = 'post')); foreach ($tutor as $item): ... echo 'td'.$this-Form-checkbox('available', array( 'value' = $id, 'checked'=0)).'td'; // debug() echo '/tr'; endforeach; echo $this-Form-end('check edits'); -- 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.
add in a field to a array with multiple records
There has to be a simple answer but I cant add in a field to a array with multiple records . I can do it with a single records but multiple records are different. The below code doesnt allow me to save a record. I can use another save command and add the records but no extra fields. http://book.cakephp.org/2.0/en/models/saving-your-data.html http://stackoverflow.com/questions/26161251/cant-save-data-from-1-table-to-another-table/26161699#26161699 if ($this-request-is('post')) { $this-Availtmp-create(); $Availtmp = array('Availtmp' = $this-request-data['AvailabilityForTutor']); $Availtmp[0]['Availtmp']['tutor_id'] = 2; //these fields I want to add in $Availtmp[1]['Availtmp']['tutor_id'] = 2; $Availtmp[2]['Availtmp']['tutor_id'] = 2; debug($Availtmp) ; if ($this-Availtmp-saveAll($Availtmp)) {.. //if ($this-Availtmp-saveAll($this-request-data['AvailabilityForTutor']) ){//this works data array( 'Availtmp' = array( (int) 0 = array( 'weekday' = 'Monday', 'start_time' = array( 'hour' = '09', 'min' = '00', 'meridian' = 'am' ), 'end_time' = array( 'hour' = '11', 'min' = '00', 'meridian' = 'pm' ), 'id' = '99' ), (int) 1 = array( 'weekday' = 'Tuesday', 'start_time' = array( 'hour' = '09', 'min' = '00', 'meridian' = 'am' ), 'end_time' = array( 'hour' = '10', 'min' = '00', 'meridian' = 'pm' ), 'id' = '100' ), (int) 2 = array( 'weekday' = 'Wednesday', 'start_time' = array( 'hour' = '12', 'min' = '00', 'meridian' = 'am' ), 'end_time' = array( 'hour' = '12', 'min' = '00', 'meridian' = 'am' ), 'id' = '101' ), (int) 3 = array( 'weekday' = 'Thursday', 'start_time' = array( 'hour' = '12', 'min' = '00', 'meridian' = 'am' ), 'end_time' = array( 'hour' = '12', 'min' = '00', 'meridian' = 'am' ), 'id' = '102' ), (int) 4 = array( 'weekday' = 'Friday', 'start_time' = array( 'hour' = '12', 'min' = '00', 'meridian' = 'am' ), 'end_time' = array( 'hour' = '12', 'min' = '00', 'meridian' = 'am' ), 'id' = '103' ), (int) 5 = array( 'weekday' = 'Saturday', 'start_time' = array( 'hour' = '09', 'min' = '00', 'meridian' = 'am' ), 'end_time' = array( 'hour' = '11', 'min' = '00', 'meridian' = 'pm' ), 'id' = '104' ), (int) 6 = array( 'weekday' = 'Sunday', 'start_time' = array( 'hour' = '12', 'min' = '00', 'meridian' = 'am' ), 'end_time' = array( 'hour' = '12', 'min' = '00', 'meridian' = 'am' ), 'id' = '105' ) ), (int) 0 = array( 'Availtmp' = array( 'tutor_id' = (int) 2 ) ), (int) 1 = array( 'Availtmp' = array( 'tutor_id' = (int) 2 ) ), (int) 2 = array( 'Availtmp' = array( 'tutor_id' = (int) 2 ) ) ) -- 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
cant add a new row in a table from an existing table
Hi , I just want to add a new row of a table from a form of an exisitng table row. The issue is I can get the data from the existing table called Tutor but I cant save this data and other fileds I need to ass to the new table called TutorEdie public function tutor_edit($id = null) { $this-loadModel('Tutor'); $this-Tutor-id = $id; debug($this-request-data ); if (!$this-Tutor-exists()) { throw new NotFoundException(__('Invalid tutor')); } if ($this-request-is('post') ) { ///New fields need to be added before saving if ($this-TutorEdit-save($this-request-data)) { $this-Session-setFlash(__('The tutor details to be edited have ben forwarded to management'), 'flash_success'); // $this-redirect(array('controller'= 'tutors' , 'action' = 'tutordetails')); } else { $this-Session-setFlash(__('The tutor edit details could not be saved. Please, try again.'), 'flash_alert'); } } else { $this-request-data = $this-Tutor-read(null, $id); } / ?php echo $this-Form-create('Tutor',array('class' = 'form-horizontal')); echo $this-Form-input('id', $formHorizontalHtmlOptions); echo $this-Form-input('first_name', $formHorizontalHtmlOptions); echo $this-Form-input('last_name', $formHorizontalHtmlOptions); echo $this-Form-input('email', $formHorizontalHtmlOptions); echo $this-Form-input('mobile', $formHorizontalHtmlOptions); -- 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 get post to work from exisitng table
I cant get post to work and create a new row. I copy a table from an existing table with new fields and this works if i use put (overwrites)but I dont want put as i need a new row. //controller if ($this-request-is('post')) { //doesnt work $tutoredit = array('TutorEdit' = $this-request-data['Tutor']); $tutoredit['TutorEdit']['tutor_id']=2; if ($this-TutorEdit-save($tutoredit)) { ///view echo $this-Form-create('Tutor', array('type' = 'post')); echo $this-Form-input('id', $formHorizontalHtmlOptions); echo $this-Form-input('first_name', $formHorizontalHtmlOptions); echo $this-Form-input('last_name', $formHorizontalHtmlOptions); echo $this-Form-input('email', $formHorizontalHtmlOptions); echo $this-Form-input('mobile', $formHorizontalHtmlOptions); echo $this-Form-input('home_phone', $formHorizontalHtmlOptions); echo $this-Form-input('work_phone', $formHorizontalHtmlOptions); echo $this-Form-input('gender', array_merge($formHorizontalHtmlOptions, array('type' = 'select', 'options' = $gender))); echo $this-Form-end('Save Edit Request'); -- 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: Warning (512): cake_model cache was unable to write
2.5 but I checked many posts on the issue and I dont think that makes any difference. The only solution was to chmod the app/tmp folders and subfolders but i did that. I am using cpanel and have no command prompt to run scripts -- 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.
pass date as paramater in view
Hi, How do I pass the date field below entered as a parameter so I can search the date? echo $this-Form-input( 'custom date', array( 'type' = 'date', 'selected' = array( 'year'=date('Y') ), 'minYear' = date('Y') , 'maxYear' = date('Y') +1 ) ); echo $this-Html-link($this-Html-tag('i', '', array('class' = 'icon-book','title'='Report')).'Custom Range', array( 'controller' = 'lessons', 'action' = 'dashboard4' ),array('escape'=false,'class' = 'btn btn-small')); -- 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 add new record in HABTM table
I want to add a new record in a table called TutorsSubject. This table is created from HABTM relationship of Tutor and Subject. Anyway I load the subject names in a text box and I can select a subject name but I cant add a new record. I need to set the id of the tutor_id. There are 3 fields in the tutorsSubject table called id,tutor_id and subject_id. I only need to select in 1 field which is the subject_id from a list of names found in the subject table, and then set the tutor_id manually. Currently I am able to select from a list of subject names but I cant add a new record with the subject name and set tutor_id. Error: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails class TutorsSubjectsController extends AppController { public function tutoradd() { $this-loadModel('Subject'); $options['recursive']=-1; $options['fields']=array('Subject.name'); $te2= $this-Subject-find('list',$options); debug($te2); $this-set( 'te',$te2); //put is for edit and post for new record if ($this-request-is('post')) { $this-request-data['TutorsSubject']['tutor_id']=2; debug($this-request-data); if ($this-TutorsSubject-save($this-request-data)) { $this-Session-setFlash(__('Your post has been updated.')); return $this-redirect(array('controller' = 'tutors','action' = 'tutordetails')); } $this-Session-setFlash(__('Unable to update your post.')); } //View which works fine as it displays the list echo $this-Form-create('TutorsSubject', array('type' = 'post')); echo $this-Form-input('tutorsSubject.subject_id', array('options' = $te)); echo $this-Form-end('Save Post'); -- 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: cant add new record in HABTM table
But I dont need a saveall as I save to 1 table only ? Saveall is not appropriate for this. I am not sure what to do here. -- 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.
HELP cant display records from a join
Hi, I cant get this simple join to produce records. I am trying to link a HABTM model with joins but I dont get any records from the joined tables. I want all the subjects for tutor id =2 but as you see I get NULL and I have tried different recursive levels. i should not get NULL in the other tables as you see below. I dont get an error Here is the controller and model with the relationship array( (int) 0 = array( 'Subject' = array( 'id' = null, 'name' = null ), 'TutorsSubject' = array( 'id' = null, 'tutor_id' = null, 'subject_id' = null ), 'Tutor' = array( 'id' = '2', 'tutor_inactive' = false, 'first_name' = 'fred2', 'last_name' = 'blah',.. class TutorsController extends AppController { public function tutordetails() { $options2['joins'] = array( array('table' = 'tutors_subjects', 'alias' = 'TutorsSubject', 'type' = 'LEFT', 'conditions' = array( 'Tutor.id = TutorsSubject.id', ) ), array('table' = 'subjects', 'alias' = 'Subject', 'type' = 'LEFT', 'conditions' = array( 'TutorsSubject.subject_id=Subject.id', ) ) )); $options2['fields'] = array('Subject.*','TutorsSubject.*','Tutor.*'); $this-Tutor-recursive = -1; $options2['conditions'] = array('Tutor.id' = 2); $subject=$this-Tutor-find('all',$options2); $this-set('subject', $subject); debug($subject); class Subject extends AppModel { public $hasAndBelongsToMany = array( 'Tutor' = array( 'className' = 'Tutor', 'joinTable' = 'tutors_subjects', 'foreignKey' = 'subject_id', 'associationForeignKey' = 'tutor_id', 'unique' = 'keepExisting', 'conditions' = '', ) ); } class Tutor extends AppModel { .. public $hasAndBelongsToMany = array( 'Subject' = array( 'className' = 'Subject', 'joinTable' = 'tutors_subjects', 'foreignKey' = 'tutor_id', 'associationForeignKey' = 'subject_id', 'unique' = 'keepExisting', 'conditions' = '', ), ); -- 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: find all on complex model
I tried this and as expected it doesnt work and it cant work because HABTM is a different case. THis has to be the hardest framework to just get data to display from tables. There just is no docs for a complete example. $student= $this-Lesson-find('all', array('contain' = array( 'Student' , 'Tutor'))); -- 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: find all on complex model
Hi Stephen, Yes your example was a great effort and I solved the problem. The issue is that I didnt add the fields argument in so this kept giving me undefined errors. I dont think your code will work as you dont specify fields. Your models are setup like mine s that was really well done. Also I need a find all as find first returns only 1 row. $this-Lesson-recursive = -1; $options['joins'] = array( array('table' = 'lessons_students', 'alias' = 'LessonsStudent', 'type' = 'LEFT', 'conditions' = array( 'Lesson.id = LessonsStudent.lesson_id', ) ), array('table' = 'students', 'alias' = 'Student', 'type' = 'LEFT', 'conditions' = array( 'LessonsStudent.student_id=Student.id', ) ), ); $options['fields'] = array('Student.*','Lesson.*','LessonsStudent.*'); $options['conditions'] = array('Lesson.tutor_id' = 2); $student=$this-set( 'student',$this-Lesson-find('all', $options)); -- 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.
find all on complex model
I just need to get the details from a find all across 4 associated tables. I looked at the docs and I can get the data from 2 tables but not the other tables. I have a lessons table where I get the relevant tutor id rows to display only. This works fine. I have a lessons-students table related to the lessons table over the FK lessons id. From this lessons-students table I then a field linked to another table. lessons table (fk tutor_id but no student_id) tutors table(linked to lessons table with tutor_id) lessons_students table (linked with lessonID and has a studentID) students table(linked with studentID from lesson-students table) so if I get a row from lessons table I want the tutor name (from tutor table and I can do this now), the student name via the studentID . This is 4 tables and this is proving a headache as the docs just do simple examples. http://book.cakephp.org/2.0/en/models/retrieving-your-data.html class LessonsController extends AppController { $this-set( 'tutor',$this-Lesson-find('all', array( 'conditions'=array('Lesson.Tutor_id'= 1,'Lesson.id'='Lesson_Students.lesson_id') ) )); view ?php foreach ($tutor as $item): echo 'trtd'. $item['Lesson']['id'].'/td'; // echo 'td'. $item['Tutor']['id']['username'].'/td'; echo 'td'. $item['Lesson']['tutor_id'].'/td'; echo 'td'. $item['Tutor']['last_name'].'/td'; echo 'td'. $item['Lesson_Student']['student_id'].'/td'; echo '/tr'; endforeach; unset($item); -- 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: find all on complex model
I cant get the student name to appear or student id -- 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.
Dispay data from HABTM in a view
Hi , I have the odd situation where I can retrieve data from a HABTM model (from debug array)but cant actually display any of it in the view. I keep getting index undefined error for everything. I want data from both tables but it doesnt work //view doesnt work foreach ($student as $item2): echo 'td'. $item2['Lesson']['id'].'/td'; echo 'td'. $item2['Student']['first_name'].'/td'; //error undefined index //controler class LessonsController extends AppController { ... $this-Lesson-recursive = -1; $options['joins'] = array( array('table' = 'lessons_students', 'alias' = 'LessonsStudent', 'type' = 'LEFT', 'conditions' = array( 'Lesson.id = LessonsStudent.lesson_id', ) ), array('table' = 'students', 'alias' = 'Student', 'type' = 'LEFT', 'conditions' = array( 'LessonsStudent.student_id=Student.id', ) ), ); $options['conditions'] = array('Student.id' = 2); // $Item-find('all', $options); $student=$this-set( 'student',$this-Lesson-find('all', $options)); -- 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: find all on complex model
I am having all sorts of problems and the docs for this is just awful. I have looked into simply getting data from the linked tables and after HOURS no one can give me a working example. I can only assume that this is hard to do or maybe it cant be done? 'The relationships are Lesson (main table where fk is linked to Tutor BelongsTo) LessonsStudents (the created table with student_id,lesson_id) Students (HASTBM student) Tutors (linked to Lessons) How can I get data from Lesson, Student and Tutor table in a find? I just need an example and not a link to the docs as the docs dont have a complete controller/view example of this. -- 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: find all on complex model
No this is not what you do as the Student has a HABTM relationship and I am told to do joins. Also when saying adding something I NEED the code as please dont assume by adding containable I know what your talking about or the docs explain things. I dont understand why simply getting information from 4 tables is just so complicated and where is the complete examples of this? -- 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.
Paginate from linked model
Hi , How do I display paginate data from a linked tables. This is data from a Tutor table but I need data from the linked lesson table which has a student_id and that lesson table is linked to the student table. So I have a tutor to lesson link in the model and a student to lesson link in the student model. I wasnt clear about this from the docs http://book.cakephp.org/2.0/en/core-libraries/components/pagination.html $this-paginate = array( 'limit' = 1 ); $this-Paginator-settings = $this-paginate; $mytutor = $this-Paginator-paginate('Tutor'); //lesson and student linked table data? $this-set('mytutor', $mytutor); -- 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: authenticate wont reroute
OK I have the answer. It isnt anything to do with htaccess or routing. This is a authenticate issue as I thought it would be. *property *AuthComponent::$unauthorizedRedirect Controls handling of unauthorized access. By default unauthorized user is redirected to the referrer URL or AuthComponent::$loginAction or ‘/’. If set to false a ForbiddenException exception is thrown instead of redirecting. -- 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: authenticate wont reroute
The issue is that the router adding to the subfolder where the project resides in and not the root dir which I cant access with routing. I cant get to the desired page for unauthorized users. Router::connect('/', array('controller' = 'users', 'action' = 'login')); this routes to crm/crm/... again with the project name repeated and how do i stop this as this is the 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: cant use email as login cakephp
Hi, I started it again and the problem was I had email as the username field. Cakephp is looking for username -- 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.
authenticate wont reroute
Hi, I can authenticate a user but I get problems when a user tries to access from the address bar a webpage it hasnt got access to. What happens is that I get routed to the base index file with missingControler error. SO my path is /crm/students on a webpage the user should not access and then i get directed to /crm/crm/ public function isAuthorized($user) { if (isset($user['role']) $user['role'] === 'manager') { return true; } if (isset($user['role']) $user['role'] === 'student') { return true; } if (isset($user['role']) $user['role'] === 'teacher') { return false; } return parent::isAuthorized($user); } -- 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: authenticate wont reroute
This didnt work. If the user tries to type the url manually in the adress bar then isauthorized doesnt route the unauthorized user anywhere but root dir and how do i code for this? -- 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: authenticate wont reroute
//ajt public $components = array( Email, 'Session', 'Auth' = array( 'loginRedirect' = array('controller' = 'users', 'action' = 'dashboard'), 'logoutRedirect' = array('controller' = 'users','action' = 'login' ), 'authorize' = array('Controller'), // Added this line // array('DebugKit.Toolbar' = array( 'panels' = array('MyCustom', 'timer'=false))), )); public function isAuthorized($user) { // Admin can access every action // debug($user['role']); // debug(asdd); if (isset($user['role']) $user['role'] === 'admin') { return true; } // return $this-Auth-redirectUrl(); // Default deny return false; } -- 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: authenticate wont reroute
the user is not authenticated and if they try to access a webpage they shouldnt then surely I can code for this . The problem doesnt happen if authentiation isnt used so it must be able to be controlled with authentication otherwise how does ./htaccess have any idea of what user is accessing a webpage -- 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: authenticate wont reroute
I still cant get this to work, htaccess is not the answers for unauthroized users. If it is then could someone please show me the code. How does cakephp handle unauthroized access from the address bat? -- 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: cant use email as login cakephp
the problem is that I can log in with any user when I shouldnt. if the user isnt admin it will still access admin only webpages. -- 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: cant use email as login cakephp
This function wont work as I get no output public function isAuthorized($user) { // Admin can access every action debug($user['role']); debug(asdd); -- 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 use email as login cakephp
Hi, I cant authenticate users when I login in using appcontroller code . I login with a non admin role and I still get through. . In fact I dont get any error and no debug value appears so the isAuthorized($user) doesnt work.l use the same code without email and used username in another website and it works fine. I looked at the code from the docs and really couldnt see the issue. The fields in the users table have role, email,password. Since the same code worked elsewhere without email for username then I am stuck on what to do as i checked how you add email as username in $components. I have a user with a role called teacher that always logs in when it shouldnt and I have simple password enabled. I checked email and role values in database and all is as expected. http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html public $components = array( Email, 'Session', 'Auth' = array( 'loginRedirect' = array('controller' = 'users', 'action' = 'dashboard'), 'logoutRedirect' = array('controller' = 'users','action' = 'login' ), 'authenticate' = array( 'Form' = array('fields' = array('username' = 'email') , 'authorize' = array('Controller') // Added this line ; public function isAuthorized($user) { // Admin can access every action debug($user['role']); NO output debug(asdd); NO output if (isset($user['role']) $user['role'] === 'admin') { return true; } // Default deny return false; } -- 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.
paginate conditions
Hi, I cant get the paginate to display with a condition, I have checked the docs and other posts and cant see what I have done wrong. I dont get an error but just no output if (isset($this-request-query['address_suburb'])) { $suburb=$this-request-query['address_suburb']; debug($suburb); //'conditions'=array('Student.address_suburb LIKE' = $suburb), $this-paginate = array( 'conditions'=array('Student.address_suburb LIKE' = '%'.$suburb), 'limit' = 3, 'order' = array('Student.id' = 'ASC','Student.first_name' = 'ASC'), 'contain' = array('TutoringType','Referral') ); $myval= $this-set('students', $this-paginate()); debug($myval); } else $suburb=null; $this-set('suburb', $suburb); -- 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 access dropdown list values
Hi, I am using paginate with a search box. It works fine until I use a drop down box to select values rather than use a textbox. I cant get the selected value from a dropdown box to appear in the querystring. So I just select a value in a textbox and then click search , i then get the values from a query string and do a paginate find. However a dropdown list instead of a textbox isnt working. controller public function myindex5() { $this-set( 'filterSuburb',$this-Student-find('list', array('fields' = array('Student.address_suburb') ))); $havefilter=false; if (!empty($this-request-query['address_suburb'])) { $suburb=$this-request-query['address_suburb']; $havefilter=true; } else $suburb='%'; if ($havefilter) { $this-paginate = array( 'conditions'=array('Student.address_suburb LIKE' = $suburb,'Student.last_name LIKE' = $lastname ), 'limit' = 3, 'order' = array('Student.id' = 'ASC','Student.first_name' = 'ASC'), 'contain' = array('TutoringType','Referral') ); $this-set('student', $this-paginate()); } $this-set('havefilter', $havefilter); } view ?php // app/View/Locations/index.ctp echo $this-Form-create('Student', array('type' = 'get','url' = array('controller' = 'students', 'action' = 'myindex5' ))); // echo $this-Form-input('address_suburb', array('label' = 'suburb')); echo $this-Form-input('address_suburb', array('type' = 'select','options' = $filterSuburb)); echo $this-Form-input('last_name', array('label' = 'last name')); echo $this-Form-end('Search'); ? -- 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: cant access dropdown list values
I actually get the index value if the drop down box and no the value. How do I get the value as this doesnt get the value ? $tsub= $this-request-query['address_suburb']; -- 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.
what is the currect method to disolay jgraph with cakephp
Hi, How is Jpgraph supposed to integrate with cakephp? In the controller or the view do i place the code to construct the jpgraph ? The old way is to display a jgraph with an image which is a call to another view but that way doesnt appear to work with currect cakephp. The problem is that jpgraph examples for cakephp is for older versions and there is no update for jpgraph with newer cakephp versions that I can find. The only solution I have found is from the stackoverflow post. The jpgraph does work if I place the graph code in the controller like the hack solution but that isnt how it is supposed to work according to the docs. I didnt get the requestHandler as explained in the stackoverflow post to have any effect but anyway I cant find anything in the cakephp docs. http://bakery.cakephp.org/articles/cguyer/2007/12/26/using-jpgraph http://stackoverflow.com/questions/9936890/cakephp-2-0-jpgraph ?php App::import('Vendor', 'Jpgraphs/jpgraph'); App::import('Vendor', 'Jpgraphs/jpgraph_line'); $ydata = array(11,11,11); // Create the graph. $graph = new Graph(350,250); $graph-SetScale(textlin); $graph-img-SetMargin(30,90,40,50); $graph-xaxis-SetFont(FF_FONT1,FS_BOLD); $graph-title-Set(Example 1.1 same y-values); // Create the linear plot $lineplot=new LinePlot($ydata); $lineplot-SetLegend(Test 1); $lineplot-SetColor(blue); $lineplot-SetWeight(5); // Add the plot to the graph $graph-Add($lineplot); // Display the graph $graph-Stroke(); ? // ]] -- 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.
what is the current method to use Jgraph with cakephp 2.x
Hi, How is Jpgraph supposed to integrate with cakephp? In the controller or the view do i place the code to construct the jpgraph ? The old way is to display a jgraph with an image which is a call to another view but that way doesnt appear to work with currect cakephp. The problem is that jpgraph examples for cakephp is for older versions and there is no update for jpgraph with newer cakephp versions that I can find. The only solution I have found is from the stackoverflow post. The jpgraph does work if I place the graph code in the controller like the hack solution but that isnt how it is supposed to work according to the docs. I didnt get the requestHandler as explained in the stackoverflow post to have any effect but anyway I cant find anything in the cakephp docs. http://bakery.cakephp.org/articles/cguyer/2007/12/26/using-jpgraph http://stackoverflow.com/questions/9936890/cakephp-2-0-jpgraph ?php App::import('Vendor', 'Jpgraphs/jpgraph'); App::import('Vendor', 'Jpgraphs/jpgraph_line'); $ydata = array(11,11,11); // Create the graph. $graph = new Graph(350,250); $graph-SetScale(textlin); $graph-img-SetMargin(30,90,40,50); $graph-xaxis-SetFont(FF_FONT1,FS_BOLD); $graph-title-Set(Example 1.1 same y-values); // Create the linear plot $lineplot=new LinePlot($ydata); $lineplot-SetLegend(Test 1); $lineplot-SetColor(blue); $lineplot-SetWeight(5); // Add the plot to the graph $graph-Add($lineplot); // Display the graph $graph-Stroke(); ? // ]] -- 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: cakephp graphs
I found out I need to install highcharts with json and I am usure on what to do. I have run composer.exe I am having an awful time creating a composer.json file to install highchartsPHP for windows cakephp. I dont know how exactly to create a file. The examples I have for cakephp composer is for linux and I have windows. https://github.com/ghunti/HighchartsPHP I have this file and I run it from app dir, , but do I place the highcharts dir where ? where I should place files to install? How do I install this EXACTLY. { name: cakephp/cakephp, description: The CakePHP framework, type: library, keywords: [framework], homepage: http://cakephp.org;, license: MIT, authors: [ { name: CakePHP Community, homepage: https://github.com/cakephp/cakephp/graphs/contributors; } ], require: { ghunti/highcharts-php: ~3.0 } } -- 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: cakephp graphs
it has been 2 days since I started and I have got no where fast. Just tell me please how do I install higharts in cakephp so i can use it. I need to load data from mysql to do the graph JPgraph is another package and unless there is instructions on how to install and use it with php code (not jS)then I cant use it. -- 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: cakephp graphs
Hi, I tried to get this working but I just get an error as there is no name anywhere on my computer 'ghunti/highcharts-php:~3.0' composer require 'ghunti/highcharts-php:~3.0' gives an error of 'could not parse version constraint ~3.0, UnexpectedValueException 1)I have the download called highcharts3 (dir) 2)I have the cakephp project.called cakephp5 I place the download 1) where?and how do I install it with composer -- 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: cakephp graphs
If I run a cakephp script 'in a controller' with highcharts I just get a highcharts not found error. In vendors I have the highchartsphp dir with src files and I place these files as well in highcharts. I have the files and they seem in the right dir but I cant get this to work. eg I have the correct names I am referencing App::import('Vendor', 'HighchartsPHP/Highchart'); class ChartsController extends AppController { public function index() { $chart = new Highchart(); /error not found -- 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: cakephp graphs
I am trying to use highchart in cakephp I still get a highchart not found. I downloaded highchartPHP and placed all the 4 files in `Vendor/HighchartsPHP` In the layout I add the lines with the actual js files in `webroot/js` echo $this-Html-script('jquery-1.9.1.min'); // Include jQuery library echo $this-Html-script('highcharts'); // Include jQuery library This is my code ?php App::import('Vendor', 'HighchartsPHP/Highchart'); class ChartsController extends AppController { public function index() { $chart = new Highchart(); /Error: Class 'Highchart' not found $chart-chart = array( 'renderTo' = 'container', // div ID where to render chart 'type' = 'line' ); $chart-series[0]-name = 'Tokyo'; $chart-series[0]-data = array(7.0, 6.9, 9.5); $this-set( compact( 'chart' ) ); } In view file ?php $chart-printScripts(); ? script type=text/javascript ?php echo $chart-render(chart);? /script * **https://coderwall.com/p/c6yasq** * **http://stackoverflow.com/questions/18868242/using-highchartsphp-library-in-cakephp** I cant find any more instructions about cakePHP setup with highcharts so I am stuck and I get a highchart not found error. I still have something missing. What has confused me is that highchartPHP doesnt explain how you install it for a MVC version with cakephp How to setup highchart so it works in cakephp ? I got from the download zip button link so it must be v3 https://github.com/ghunti/HighchartsPHP also Error: Class 'Highchart' not found from the controller as i outlined above -- 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: cakephp graphs
Hi, I need to use cakephp with data from the mysql and your example is just a jquery separate from cakephp. . I cant setup highchartswitjh cakephp as there is no instructions for use with cakephp. -- 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: cakephp graphs
To use highchart I follow the below and I get a highchart not found error. This is really poorly explained and i have highchart.js, highchart.php in vendor. There is 4 files on highchartPHP and they all go where? what am I missing? https://coderwall.com/p/c6yasq -- 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.
cakephp graphs
Hi, I need to do some graphs in cakePHP and I am getting bigged down and wht to use and how to install it. 1)Jgraph is used with cakephp but the examples are for cakephp v 1 and dated 7 years ago. This looks outdated http://bakery.cakephp.org/articles/cguyer/2007/12/26/using-jpgraph 2)Highcharts is the other option but the setup isnt clear as you also need jquery which again requires another setup. http://www.highcharts.com/docs/getting-started/installation http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html so in the layout file I (echo $this-Js-writeBuffer(); // goes on what file? echo $this-Html-script('jquery-1.9.1.min'); // Include jQuery library What graphing tools are used these days with cakephp and is there instructions on a complete setup (not partial setup and assume the rest ) -- 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: cakephp graphs
Here is another which is explained better than highcharts http://www.startutorial.com/articles/view/how-to-use-jqplot-in-cakephp -- 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.
acl examples dont work
Hi, I am having problems finding a working acl example. This example points me to the below links which doesnt work. maybe I can fix these up if someone knows how. So add some groups and users using the baked forms by browsing to http://example.com/groups/add and http://example.com/users/add. I made the following groups: http://book.cakephp.org/2.0/en/tutorials-and-examples/simple-acl-controlled-application/simple-acl-controlled-application.html This tutorial is more basic but again doesnt work when I create a user because when you create a user on register the code gets an error on User.error as this isnt defined as well as talking about a post controller with no poss model. It is incomplete as well. This tut seems old as well . http://code.tutsplus.com/tutorials/how-to-use-cakephps-access-control-lists--net-13457 -- 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 set php env variable wth easyphp for cakephp console
Hi, I am trying to setup cake console in win7 and run cake bake as in the link below.I set up the env variable in win7 as below with a php and cakeapp entry in this Path.I have easyPHP 12.1 and php works fine. I get an error with php in failing to load. dynamic library but the php dir is in the path below so I have no idea . I cant set my php env var is my problem . The php.ini is in this dir specified below. http://www.nurelm.com/themanual/2012/01/30/running-cakephp-command-line-tools-in-windows/ E:\Program Files\EasyPHP-12.1\php\php546x121019214357\;E:\AA-website design\acl\app\Console\; There is a link here to the same issue but I didt understand the answer as there is no Path set in php.ini? -- 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.
display on same page
Hi, In cakephp can you post data then display this data back on the same view / I want the user to enter in data to search by and the results appear in the same page. I tried the below but I cant get anything to display on the same page. public function displayform() { if ($this-request-is('post')) { $t=$this-request-data; if (!empty($this-request-data)){ $teacher= $this-Teacher-find('all'); $this-set('teacher',$teacher); book.cakephp.org/2.0/en/core-libraries/helpers/form.html -- 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: display on same page
ok this works. It displays the same function 2 times and just appends the data to the same form public function displayform() { $test='hello'; $this-set('test',$test); if ($this-request-is('post')) { $t=$this-request-data; $tt= $this-request-data('Teacher.firstname'); if (!empty($this-request-data)){ $teacher= $this-Teacher-find('all',array('conditions' = array('Teacher.firstname' = $tt))); $this-set('teacher',$teacher); $this-set('teacher',$teacher); -- 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: display data 3 tables
There just is no user being displayed with the below, there is with Teacher in the find if I add it but every field is undefined in the view. $this-Tutorsession-recursive = 2; $contain = array('Teacher' = array('User')); $this-set('tutor', $this-Tutorsession-find('first',array( 'conditions' = array('Teacher.user_id' = $id), 'contain' = $contain ))); array( 'Tutorsession' = array( 'id' = '1', 'teacher_id' = '1', 'student_id' = '1', 'subject' = 'maths', 'sessiondate' = '2014-05-06', 'sessiontime' = '2014-05-29 00:27:00', 'available' = '1' ), 'Teacher' = array( 'id' = '1', 'user_id' = '3', 'firstname' = 'fred', 'surname' = 'smith3', 'address' = '1 hard str', 'suburb' = 'chelsea2', 'phone' = '0', 'fullname' = 'fred smith3', 'User' = array( 'password' = '*', 'id' = '3', 'username' = 'teach', 'role' = 'teacher', 'created' = '2014-05-31 11:08:39', 'modified' = '2014-05-31 11:08:39' ), 'Tutorsession' = array( (int) 0 = array( 'id' = '1', 'teacher_id' = '1', 'student_id' = '1', 'subject' = 'maths', 'sessiondate' = '2014-05-06', 'sessiontime' = '2014-05-29 00:27:00', 'available' = '1' ) ) ), 'Student' = array( 'id' = '1', 'user_id' = '1', 'firstname' = 'tom', 'surname' = 'blog', 'address' = '3 glen str ', 'suburb' = 'chelsea', 'phone' = '044', 'fullname' = 'tom blog', 'User' = array( 'password' = '*', 'id' = '1', 'username' = 'admin', 'role' = 'admin', 'created' = '2014-05-30 03:19:36', 'modified' = '2014-05-30 03:19:36' ), 'Tutorsession' = array( (int) 0 = array( 'id' = '1', 'teacher_id' = '1', 'student_id' = '1', 'subject' = 'maths', 'sessiondate' = '2014-05-06', 'sessiontime' = '2014-05-29 00:27:00', 'available' = '1' ) ) ) ) -- 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: display data 3 tables
yes thats it, I just didnt know how I referenced it and with this code. This took hours to solve so well done $this-Tutorsession-recursive = 2; $this-Tutorsession-Teacher-contain('User'); $this-set('tutor', $this-Tutorsession-find('first', array( 'conditions' = array('Teacher.user_id' = $id)) ) ); -- 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: display data 3 tables
I set recursive to -1 and it doesnt work as I get user error again. Recursive set to 2 is what works -- 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: display data 3 tables
Yes this works without recursive $contain = array('Teacher' = array('User'),'Student' = array('User')); $this-set('tutor', $this-Tutorsession-find('first',array( 'conditions' = array('Teacher.user_id' = $id), 'contain' = $contain ))); -- 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.
display data 3 tables
Hi, I just want to display fields from 3 tables which I have checked on how to do this and I am not clear on this. Examples I have found concentrate on 2 fields or keyed in conditions on multiple tables. I have models all related in some way. I want the username from a tutorsession table and the middle table is the teacher table. Tutorsession - related to teacher Teacher -related to tutorsession and teacher User= related to teacher The tutorsession automatically gets rows from teacher table but not user table. I have checked the docs below and I am not sure what to use here as the below doesnt work but I dont get errors. $this-set( 'tutor',$this-Tutorsession-find('all',array('conditions' = array('Teacher.user_id' = $id,'Teacher.user_id' = 'User.id'; $this-set( 'tutor',$this-Tutorsession-find('all',array('conditions' = array('Teacher.user_id' = $id; http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html http://book.cakephp.org/2.0/en/models/retrieving-your-data.html -- 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: display data 3 tables
This doesnt work as I get an error when displaying the username from the associated table. I guess i am doing something wrong still. $this-set('tutor', $this-Tutorsession-find('all', array('conditions' = array('Teacher.user_id' = $id) ,array('contain' = 'User.username') ))); -- 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: display data 3 tables
This still doesnt work as I get an error when I reference the user table which should be linked unless I need to do this another way? view echo 'td'. $item['User']['username'].'/td'; ///error user undefined $this-set( 'tutor', $this-Tutorsession-find( 'first', array( 'conditions' = array('Teacher.user_id' = $id), 'contain' = 'User.username' ) ) ); -- 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 find a field
Hi, Is this is the correct way to find a 1 field in 1 row of data? I just want the teacherID of a row of a given userID but I never get a match $currentuserid=AuthComponent::user('id'); $teacherid=$this-Teacher-find('first',array( 'conditions' = array('Teacher.user_id' = $currentuserid), 'fields' = array('Teacher.id'), )); if ( $teacherid==$id ){.//never matches when it should -- 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.
User table foreign key confusion
Hi, I am confused about how the User table is linked to other tables. To keep things simple I have a working version of a linked cakephp/mysql that can display ,add,edit records. I add in security with a admin role who can see every page. Everything is OK but I will need to add users with access to only somethings. I have these tables teachers student teacher-student (tutor sessions) User The question how do I link the User to the students,techers table as the user table seems to be a special case? Would I need a user_id in these 2 tables and the user has foreign keys of teacher_id and student_id? What about admin roles who can see all pages as they dont need a teacher or student id? Or dont I bother linking tables as User table is a special case? Do I need to set up a teachers table with id and also a user_id which is the same thing? In cakephp I link like this for example. class User extends AppModel { public $hasOne = array('Teacher','Student'); class Teacher extends AppModel { public $hasOne = 'User'; -- 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.