I'm a newbie to Cakephp and I am trying to learn the HABTM for the
post and tag example.
I have set up the $hasAndBelongToMany to both post and tag
models, also I have created the posts_tags join table. I added the
$scaffold in the posts and tags controller, when I try to add a new
post, the tags
***Equipamento*** hasBelongToMany ***Recibo***
***EntradaEquipamento*** belongsTo ***Recibo***, ***Equipamento***
In the Equipamento/add view, i have various Equipamento.n.fields, and
for each Equipamento, i need save a EntradaEquipamento too
I tried this array in saveAll, but without success:
Hello,
I have the following situation in which i need help:
There are people, roles and lectures, summer_schools and
presentations.
People HABTM roles. Depending on their role people are associated to
lectures or summer_schools or presentations. So I am planning on
creating more HABTM-tables
I believe people_roles_summer_schools wouldn't be a nice table name
for a cakephp app. I once tried to bake something like that and it
didnt work, instead I used a single name for a table which has many
foreign keys.
On 8 dez, 07:42, Jens Dittrich jdittr...@googlemail.com wrote:
Hello,
I
On Wed, Dec 8, 2010 at 5:42 AM, Jens Dittrich jdittr...@googlemail.com wrote:
Hello,
I have the following situation in which i need help:
There are people, roles and lectures, summer_schools and
presentations.
People HABTM roles. Depending on their role people are associated to
lectures or
I've searched and looked through this group and the online
documentation for hours, but I'm having some difficulty with a simple
problem.
Its a simple setup:
User HABTM Permissions
Everything is setup properly (3 tables: users, users_permissions,
permissions). And everything works fine, I'm
The join table has to be in alphabetical order, so try permissions_users.
Jeremy Burns
Class Outfit
jeremybu...@classoutfit.com
http://www.classoutfit.com
On 15 Oct 2010, at 07:39, brybot wrote:
I've searched and looked through this group and the online
documentation for hours, but I'm
On Fri, Oct 15, 2010 at 2:39 AM, brybot br...@bryanrite.com wrote:
I've searched and looked through this group and the online
documentation for hours, but I'm having some difficulty with a simple
problem.
Its a simple setup:
User HABTM Permissions
Everything is setup properly (3 tables:
Hi!
I've been struggling for a long time with something and I don't seem
to get it.
I did the Posts/Tags HABTM Select example from this page:
http://mrphp.com.au/code/working-habtm-form-data-cakephp
So far so good, everything works ok.
I wanted to try the same example but asumming that the
I am *guessing* that your variable that contains your funny_tags is not being
set correctly. It is set here:
$tags = $this-Post-Tag-find('list',array('fields'=array('id','name')));
...so change that to:
$funny_tags =
$this-Post-FunnyTag-find('list',array('fields'=array('id','name')));
...and
Thanks Jeremy.
In fact I did that and didn't solve the problem.
I'm still trying but with no success yet.
Regards.
On 28 mayo, 21:24, Jeremy Burns jeremybu...@me.com wrote:
I am *guessing* that your variable that contains your funny_tags is not being
set correctly. It is set here:
$tags =
I think I'll post the code and information here. I still don't know
what is happening.
Any help is hugely appreciated.
The tables:
funny_tags: id,name
funny_tags_posts: id,funny_tag_id,post_id
posts: id,name,body
The files:
+ Under models: post.php and funny_tag.php
+ Under controllers:
Ah. Try this:
$funnyTags =
$this-Post-FunnyTag-find('list',array('fields'=array('id','name')));
If that doesn't fix it, try this as well:
echo $form-input('FunnyTag');
Jeremy Burns
jeremybu...@me.com
On 29 May 2010, at 05:46, Roland Pish wrote:
I think I'll post the code and information
Thanks, We are getting closer!!
After using $funnyTags now the select is populated correctly but the
funny tags aren't selected according to what is on the database.
I tried this: echo $form-input('FunnyTag'); but the funny tags aren't
still selected.
On 28 mayo, 22:51, Jeremy Burns
It worked!!
Finally!!
There was something weird in the database. I submitted the form and
magically the select was populated and funny tags were selected.
I really appreciate your help Jeremy.
One last question, where is in cake manual the convention you advised
to fix this (the use of
It isn't just restricted to HABTM, it's a standard thing. But here's a page
that refers specifically to HABTM:
http://book.cakephp.org/view/1390/Automagic-Form-Elements
Jeremy Burns
jeremybu...@me.com
On 29 May 2010, at 06:10, Roland Pish wrote:
It worked!!
Finally!!
There was something
Thanks Jeremy!
In the link you supplied, after reading the portion ...(group -
groups in this case, or ExtraFunkyModel - extraFunkyModels).. now it
all makes sense.
Regards.
On 28 mayo, 23:13, Jeremy Burns jeremybu...@me.com wrote:
It isn't just restricted to HABTM, it's a standard thing. But
Hi,
I have a table structure like this
admins tablehabtm rights table belongs to rights_groups
In view I need to print like this as checkbox
Rights_group Name1
Rights1
Rights2
Rights_group Name2
Rights3
Rights4
View code (Since I have to give the group name, I need
I am back to working with additional fields in a HABTM and going to try the
method as described in the cookbook.
Child hasMany Membership
Membership belongsTo Child, Club
Club hasMany Membership.
In my setup I have User, Skill, Year, Skillset and UsersSkill but not sure
of setting up the
Had an informative discussion on this at Stack Overflow:
http://stackoverflow.com/questions/936203/storing-sort-order-for-items-held-in-an-habtm-association-cakephp
On Jun 1, 9:31 pm, Hiero v25me...@gmail.com wrote:
I have a HasAndBelongsToMany association setup on Videos and Bins: A
Bin can
I have a HasAndBelongsToMany association setup on Videos and Bins: A
Bin can store n references to Videos, and Videos can belong to n Bins.
I need to be able to manually set and store the display order of the
Videos within a particular Bin (so the client can have his Videos in a
particular order
Hi Dave,
In my opinion, you should only have one HABTM table between the USER
and SYSTEM models. If you need to split your information from the
SYSTEM model into separate presentation steps, do it with views or
with additional tables/models.
Example:
Users --- systems_users --- Systems ---
Cool...
Will just leave it the way it is.
Thanks.
Dave
-Original Message-
From: John Andersen [mailto:j.andersen...@gmail.com]
Sent: May-05-09 5:57 AM
To: CakePHP
Subject: Re: HABTM question
Hi Dave,
In my opinion, you should only have one HABTM table between the USER and
SYSTEM
I have a question about if this is possible or if it even make sense to do.
I have 4 HABTM tables that are for a USER to select options from. The
options are only for choosing and user has no control over any of the actual
options (edit delete add none of that)
Now the tables look like this:
Hi there,
first question, complex question :D
i have tables in db like this:
+ leagues
| - lid
| - name
+ users
| - uid
| - name
+ groups
| - gid
| - name
+ league_staff
| - lid
| - gid
| - uid
The models:
class League extends AppModel {
var $name = 'League';
var $primaryKey =
The problem is the attribute recursive: i cannot set it to 3 as i
need! Is there a way to bypass the problem or a trick to have more
deep association fatching? Thanks!
On 9 Apr, 16:27, luke83 luc...@gmail.com wrote:
Hi there,
first question, complex question :D
i have tables in db like this:
Use Containable over Recursion.
http://book.cakephp.org/view/474/Containable
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To
I've got a fairly good grasp on the HABTM concept/implementation, but
would like to add a twist: Suppose we have users and movies tables.
A user can select 'favorites' from the movies table, as many as he/she
wishes. So the movies_users table would have an ID, a movie and a
user field.
Now
This is how my database structure looks:
Categories HABTM Authors
I have a join table Authors_Categories
Authors HasMany Articles
I want to retrieve all Articles that are in a Category based on the
association with Authors.
Would I use the Containable behavior for this, and if so, what
Despite the naming convention, isn't the HABTM association really just
modeling the shared foreign key table relationship? For example, you
have a 'users' table and an 'items' table, and they are tied together
with the items_users table. Not considering cake, you would use this
because several
You got it right.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For
thanks guv'ner
On Feb 23, 10:48 pm, rtconner [EMAIL PROTECTED] wrote:
You got it right.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
I don't think that making a model for that join table cause you some
trouble, anyway I see no use of it.
On Oct 4, 12:26 am, Comida411 [EMAIL PROTECTED] wrote:
Rt,
Can you clarify... I mean the auto create feature is a convenience...
right...
The alternative is for me to create the model
There appear to be 3 types of join table in my data model..
1. Pure join - table comprised of two or more foreign keys only and no
other attribues (column headers)
2. Join as parent - table comprised of two or more foreign keys only
and no other attribues... wherein he table is also the parent
Sure why not.
Cake 1.2 has recenlty added a feature where you can speficy a 'With'
association which auto-creates a model for the join table.
You may want to mess around with that.
An example can be found in the OCPHP doc found here:
http://cakephp.org/downloads
On Oct 3, 8:25 am, Comida411
Rt,
Can you clarify... I mean the auto create feature is a convenience...
right...
The alternative is for me to create the model manually
Is it bad practice to create models for joins tables comprised soley
of two foreign keys.. Is that just a bad idea in general?
Thank you for your time
T
You can pass conditions to generateList. Take a look at the api
http://api.cakephp.org.
Ketan Patel wrote:
Say we have a posts and tags table and the HABTM association has been
set with posts_tags as the join_table. I am able to save the tags to
the database. My problem is I know which posts
Say we have a posts and tags table and the HABTM association has been
set with posts_tags as the join_table. I am able to save the tags to
the database. My problem is I know which posts belong to which user
through the posts table
posts:
-
id, user_id, title, details
tags:
--
id, name
Hi,
I'm a newbie at this, and have spent many hours searching and reading
this group. Some answers I found, but some still elude me.
I have the following associations:
Show hasAndBelongsToMany Artist
Artist hasAndBelongsToMany Show
When I 'view' a Show, I can see all the info and also the
Thanks! I don't know what I was thinking!!! I did set to recursive = 2,
but only in a different method and somehow didn't see that it was
missing from the one used here...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Hi Dee,
The - Just reverences a Variable or method on an object (if it has ()
it't a method).
In the example above, contractor has a variable Servic, which is set to
a Service object.
It the chain of object could be avoided by using:
var $uses (Contractor,Service);
AD7six,
Thanks for this post! I ran into the same problem as brandags.
I have a question though. Yes this does work, but why does it work?
I thought the arrow (-) referenced a member of the class like a method
or member. Is that right? If so how did Service become a member of
Contractor?
Hi Brendon,
Try something like this:
// What do I need to put here to return all the
contractors linked to $service_id?
$result = $this-Contractors-Services-FindByID($service_id);
if ($result)
{
foreach ($result['Contractor'] as $Contractor)
{
$data[] = Array('Contractor'=$Contractor);
}
I get a very strange result when I do that. I did have to singularize
the Model names as well:
$result = $this-Contractor-Service-findByID($service_id);
SQL Error in model Service: 1054: Unknown column 'Service.i_d' in
'where clause'
The query that's run is this:
SELECT `Service`.`id`,
There´s a reason I wrote something like :). I use code very similar
to this, but I wrote it here off the top of my head.
Try:
$result = $this-Contractor-Service-findById($service_id);
Note the lowercase D, I don`t know if that's the reason for the
underscore, but it could be.
Cheers,
AD7six
Ha! What do you know - that was it! Thank you!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send
46 matches
Mail list logo