Hello. I am looking for a simple solution for binding model to another
model.
I'm using CakePHP 2.2. I am building a JSON rest api.
I currently have a simple User model with a hasOne Profile association.
I want to nest the "Profile" model in the Users array, without using any
views.
What is th
This problem is beating me into a pulp, and if I could solve it I'd
really be making headway on my app.
Currently I have working the following type of relationship
Contact "belongsTo" Location
Location "hasMany" Contact
ie - contacts.location_id = locations.id
This works for all CRUD operations
I have been using the Media Plugin by David Persson and I think it's
great and has saved me a lot of time. I started out with an Invoice
model that hasMany Attachments and everything worked well. I then
added Materials to my invoice and tried added Attachments to a
specific material associated wi
What is your recursive parameter set to?
And have you considered using Containable behaviour?
See http://book.cakephp.org/view/474/Containable
Enjoy,
John
On May 5, 4:54 pm, Greg Skerman wrote:
> Hey guys,
>
> Struggling to figure out why this wont work (cake 1.2).
>
> $this->set('Ch
Hey guys,
Struggling to figure out why this wont work (cake 1.2).
$this->set('Characters',
$this->User->Account->Character->find('list', array(
'conditions' => array(
'User.id' => $this->Auth->User('id')
)
)
You could do http://www.application.com/message/add/contract:1 using
named parameters.
Or setup a route for www.application.com/contract/1/message/add
On Dec 28, 11:09 pm, otisjs01 wrote:
> OK, so I'm asking lots of questions today...but I really want to
> learn! :)
>
> Anyway, I'm trying to cre
When a user selects a contract to view, store the contract id
internally (session). Then when the user requests to view the related
messages, show the messages and add a form for the user to enter a new
message, and have the form url be /messages/add.
If the user adds a new message, retrieve the c
No problem :)
On Oct 1, 6:00 pm, Melanie Sommer
wrote:
> Problem solved. There was a typing error in the C model. Sorry!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send e
Problem solved. There was a typing error in the C model. Sorry!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this
Hello John,
I already tried putting all X.id and X.Y_id in the respective field
arrays - no change.
And this also does not explain, why cakephp does the right thing
automatically when I select B, C, D, F, and G, but not when selecting
A. What I do not understand is the difference between the beh
Yes, I read that too, and later in the text is this note:
"When using 'fields' and 'contain' options - be careful to include all
foreign keys that your query directly or indirectly requires."
And to me it looks like you should ensure that you specify the primary
keys (id) and the foreign keys (c
Hi John,
> I think I read somewhere (here in the group) that you need to include
> the foreign keys in the fields definition, so containable can see
> them!
I read contain automatically also includes the foreign keys in it's
sql-query.
http://book.cakephp.org/view/474/Containable :
"As you can se
I think I read somewhere (here in the group) that you need to include
the foreign keys in the fields definition, so containable can see
them!
Enjoy,
John
On Oct 1, 1:51 pm, Melanie Sommer
wrote:
> Hello Brian,
>
> thank you for the information about containable. It works fine, except
> for on
Hello Brian,
thank you for the information about containable. It works fine, except
for one problem. I use this code:
> $this->E->find(
> 'all',
> array(
> 'contain' => array(
> 'D' => array(
> 'fields' => array('D.tit
Use ContainableBehavior and try the find() like:
$this->E->find(
'all',
array(
'contain' => array(
'D' => array(
'fields' => array('D.title'),
'C' => array(
Hi,
I have models with belongsTo and hasMany relations in the following
form:
A -> C -> D -> E
B -> C
F -> E
G -> E
When displaying E I also want to display the title-fields of A, B, C,
D, F and G.
find() can only be set to rescursive=2 giving me E together with D, C,
F, G.
What is the best wa
>
> the most deeply nested ParentContentItem shows different content, it
> gets the data corresponding to the instance with id = 1 (rather than 2
> in the example above).
>
> Can anyone see where I'm going wrong?
>
> Thanks,
>
> Toby
>
> On
am, toby1kenobi wrote:
> Aha, found it! I needed the ContainableBehaviour. In case it helps
> someone else I found this (in addition to the manual) very helpful:
>
> http://teknoid.wordpress.com/2008/09/05/example-of-cakephps-containab...
>
> toby1kenobi wrote:
> > Hi all,
w if it's possible to specify which fields are
> returned in a call to paginate, including fields from nested models.
> Something like:
>
> $this->paginate['MyModel']['fields'] = array(
> 'DISTINCT MyModel.id, MyModel.title
Hi all,
Does anyone know if it's possible to specify which fields are
returned in a call to paginate, including fields from nested models.
Something like:
$this->paginate['MyModel']['fields'] = array(
'DISTINCT MyModel.id, MyModel.title,
Hello,
SaveAll works great with the examples provided in the docs and through
the majority of blogs.
My Problem is that I want to Save three nested Models at once.
Currently I do this with the help of transactions and some awkward
validation.
For example I have these Models:
Test has many
http://tempdocs.cakephp.org/#TOC78863
On Jan 17, 7:09 am, Carl <[EMAIL PROTECTED]> wrote:
> I have a table of headings and a table of categories. Each heading
> "hasMany" categories, and each category "belongsTo" a heading. I need
> a view that lists each heading with its associated categories.
>
As I recall from a recording of a cakeshow that 1.2 automagically handles
this is you create a camelized var from the model name and pass that findall
eg in post controller (in this example I have changed categories to
post_categories)
$postCategories = $this-postCategories->findAll(...)
$this->
I have a table of headings and a table of categories. Each heading
"hasMany" categories, and each category "belongsTo" a heading. I need
a view that lists each heading with its associated categories.
I have the models working with the "scaffolded" views of headings and
categories (separately), bu
24 matches
Mail list logo