Re: Manual entry for habtm linking table.
Thanks WebbedIT ! it has helped me too.
cheers
On Sep 19, 8:06 am, WebbedIT <p...@webbedit.co.uk> wrote:
> I hope you stick with it and find it a viable alternative to
> CodeIgniter. I have never used another framework, but I'm yet to find
> something that CakePHP can't do and none of my clients ever complain
> about speed, in fact they comment how my CakePHP sites seem faster
> than my older raw PHP sites.
>
> If you're after a CakePHP alternative to WP then have a look at
> Croogo. It's not going to be as smooth as WordPress, out of the box,
> but it's developed using the CakePHP framework so you can modify it to
> your needs easily.
>
> Yeah, for database imports, which you should do only once or if your
> resetting your database, you can use the Model->query() function as
> your not then returning the data and doing anything else with it.
> Once using Cake tables and retrievning data you should then steer
> cleer of Model->query() as it doesn't automagically return your data
> arrays in the right format and does not have callbacks etc.
>
> HTH, Paul
> @phpMagpie
>
> On Sep 18, 8:19 am, "porangi.chris" <porangi.ch...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Thanks Paul,
>
> > First time for me in Cake, normally use WP and Codeigniter but wanted
> > to try out the baking. I was trying to over complicate it with:
>
> > $db_data = array(
> > 'teacher_id' => $teacher['Teacher']['id'],
> > 'tclass_id' => $tclass['Tclass']['id']
> > );
> > $this->Teacher->TeachersTclasses->create();
> > $this->Teacher->TeachersTclasses-
>
> > >save($db_data);
>
> > but actually this just worked..
>
> > $this->Teacher->query("INSERT INTO teachers_tclasses
> > (tclass_id, teacher_id) VALUES
> > (".$tclass_id.", ".$teacher['Teacher']
> > ['id'].");");
>
> > Cheers Chris
>
> > On Sep 16, 8:37 am, WebbedIT <p...@webbedit.co.uk> wrote:
>
> > > If using Cakes HABTM automagic the table should be named
> > > classes_teachers and have the following fields
>
> > > id (primary_key, auto_inc)
> > > class_id
> > > teacher_id
>
> > > After that it's a case of
> > > INSERT INTO classes_teachers (class_id, teacher_id) SELECT class_id,
> > > teacher_id FROM import_table
>
> > > HTH, Paul
> > > @phpMagpie
>
> > > On Sep 15, 9:24 pm, "porangi.chris" <porangi.ch...@gmail.com> wrote:
>
> > > > hi,
>
> > > > First time user of cake with CI background, I have two tables
> > > > teachers and classes that share a many to many relationship e.g.
> > > > Teacher-Classes.
>
> > > > I'm having to import the data from CSV files that have been exported
> > > > from another system that we have limited access to. I've got the
> > > > classes working - I can scan through the file and add the class if it
> > > > doesn't already exist but I need to add the links between class and
> > > > teacher.
>
> > > > I have an associative array with the two ids (tclass_id and
> > > > teacher_id) ready but what query call would I make to insert this as a
> > > > row in the teacher_class table?
>
> > > > Thanks in advance for any help.
>
> > > > Chris
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home