Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Why don't you do it as you have proposed by yourself in your other question.</p> <p>(This is again for Doctrine but for Propel it should be similar).</p> <p>Create an object action in your <code>generator.yml</code>:</p> <pre><code>list: object_actions: bloglist: {label: Bloglist} </code></pre> <p>Then in your <code>actions.class.php</code> you have to add a function:</p> <pre><code>public function executeListBloglist(sfWebRequest $request) { $blog = $this-&gt;getRoute()-&gt;getObject(); // retrieve the blogposts via a PEER method (I don't have any clue about Propel ;)) $this-&gt;blogposts = however.you.get.the.blogposts(); } </code></pre> <p>Then create a template <code>bloglistSuccess.php</code> where you show the posts.</p> <p>Or, you can redirect or forward to the admin module for the blogposts if you have such a module. There you have probably to override the list action to accept the ID parameter of the blog and extend the query to filter posts by this blog id.<br> There is nothing wrong in doing a redirect or forward, it is not a hack ;)</p> <hr> <p>Edit after comment:</p> <p>I would also suggest that you forward the request.<br> No you don't have to change the routing you can just append the parameter like you suggested. </p> <p>For overriding I reconsidered that it would be better if you override the <code>buildQuery</code> method (again). (I can't remember how this method was called with Propel, I hope you get what I mean).</p> <p>So it would look like this:</p> <pre><code>class blogpostAdminActions extends autoBlogpostAdminActions { //... protected function buildQuery() { $query = parent::buildQuery(); $request = $this-&gt;getRequest(); // &lt;- I am not sure about this method call but there is one that gives you the webRequest. if ($request-&gt;hasParamter('blog_id')) { $query-&gt;andWhere('blog_id = ?', $request-&gt;getParameter('blog_id')); } return $query; } } </code></pre> <p>Of course you have to change this to Propel criteria, but I assume you can do that ;)<br> Hope this helps you.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload