Wednesday 15 September 2010

email - Getting data in a HABTM relationship, formatting and sending with Cake's mail-component -


Maybe this is a simple question, but I do not know how to contact it. I have an HABT-relative between podcast and user and its original baked app is in CakePHP 2.3.6 . A user can "subscribe" to the podcast.

I would like get all podcasts of the logged-in user

  • Podcast table in a specific format Send a file (.APML, an XML-format) to the currently logged-in user email using the KPPHP-email component of the fields of.

    Obtaining 1 all podcasts: I have this debug ($ this-> viewVars) I will show that the array is wrong why?

    model / podcast.php

      public function getPodcastsByUserId ($ userId = null) {if (empty ($ userId)) returned incorrectly; $ Podcasts = $ this- & gt; Search ('all', array ('joins' = & gt; array (array (' table '= & gt;' podcasts' euseer ',' nickname '= & gt;' podcast user ',' type '= & gt; INNER ',' conditions' = & gt; array ('podcasts user.user_id' = & gt; $ userId, 'podcastususerpodcast_id = podcast.id'))), 'group' = & gt; 'podcast.ed'); Return podcast;}   

    UsersController.php

      public function showMyPodcasts () {$ userId = $ this- & gt; Session-> Read ('Auth.User.Id'); $ this-> LoadModel ('podcast'); $ podcast = $ this- & gt; podcast- & gt; GetPodcastsByUserId ($ userId); $ this- & gt; set ('podcast', $ podcast);}   

    2 < P>

    The cake email is very well documented here with examples, explanations ... etc Here:

  • No comments:

    Post a Comment