Hello,
I know this question has been posted some times but my model looks
correctly linked.
I'm on the latest cakephp 2.7.1.
Ticket *belongsTo* User
Ticket *belongsTo* Event
Event *hasMany* Ticket
Event *belongsTo* Venue
Event *belongsTo* ParentEvent
Event *hasMany* ChildEvent
Venue *hasMany* Event
User *hasMany* Ticket
*From Tickets Controller:*
$this->Ticket->contain(array(
"Evenement" => array(
"Venue",
)
));
debug($this->Ticket->find('all'));
Model "Evenement" is not associated with model "Venue"
(int) 0 => array(
'Ticket' => array(
'id' => '1',
'user_id' => '1',
'event_id' => '1',
'amount' => '2',
'price' => '30',
'message' => null,
'status' => true,
'created' => null,
'updated' => '2015-07-29 12:47:51',
'pricePerTicket' => '15.00'
),
'Event' => array(
'id' => '1',
'venue_id' => '3',
'parent_id' => '0',
'title' => 'Action Bronson',
'slug' => null,
'start_datetime' => '2015-09-27 19:00:00',
'end_datetime' => '2015-07-29 09:11:00',
'body' => 'L’ancien cuisinier sort son album Mr.
Wonderful’ chez Vice/Atlantic.',
'facebook_url' =>
'https://www.facebook.com/events/1575996599351',
'website_url' => '',
'songkick_ref' => null,
'status' => '1',
'promote' => false,
'created' => '2015-07-29 09:15:32',
'updated' => '2015-07-29 10:40:05'
)
),
Which is *wrong*. Venue model is properly linked since it works when doing
a find from Events controller.
*From Events controller.*
$this->Evenement->contain(
array(
"Venue"
)
);
debug($this->Evenement->find('all'));
(int) 0 => array(
'Evenement' => array(
'id' => '1',
'venue_id' => '3',
'parent_id' => '0',
'title' => 'Action Bronson',
'slug' => null,
'start_datetime' => '2015-09-27 19:00:00',
'end_datetime' => '2015-07-29 09:11:00',
'body' => 'L’ancien cuisinier sort son album Mr.
Wonderful’ chez Vice/Atlantic.',
'facebook_url' =>
'https://www.facebook.com/events/1575996599351',
'website_url' => '',
'songkick_ref' => null,
'status' => '1',
'promote' => false,
'created' => '2015-07-29 09:15:32',
'updated' => '2015-07-29 10:40:05',
'displayname' => 'Action Bronson, 2015-09-27 19:00:00'
),
'Venue' => array(
'id' => '3',
'title' => 'Ancienne Belgique',
'slug' => 'ancienne-belgique',
'body' => '',
'city' => 'Brussels',
'country' => 'Belgium',
'facebook_url' => '',
'website_url' => '',
'lat' => null,
'lng' => null,
'status' => '1',
'promote' => false,
'created' => '2015-07-29 08:25:47',
'updated' => '2015-07-29 10:39:57'
)
),
- AppModel acts as Containable.
- I tried to change 'event' to 'evenement' in french since event is a
mysql reserved word but nothing changed. I got rid of parent/child things
with no luck as well.
- Doing a regular find without 'Contain' and recursive->2 gets a lots of
User related models but still nothing under Event.
Thanks a lot of your time.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.