Hmm, that seems to work if you only want to slug one column in the
table. What if I wanted to slug title and category name? Also, I
noticed it said you can change the function used to create the slug
using the builder option...where can you find a list of the available
functions for this? Although, I am wanting to slug two columns, so
this method may not work anyway.

On Aug 2, 6:13 pm, Gustavo Adrian <comfortablynum...@gmail.com> wrote:
> The problem here is that using a custom method without further configuration
> there's no way the routing system can find the article based on the
> "title_slug" parameter, because the field actually doesn't exist on the
> database. The best way to do it is using the "Sluggable" behaviour of
> Doctrine. It automatically creates a "slug" field on your table based on a
> field (or fields) you configure. So, when you create an item, it
> automatically fills that field with a slug of the fields you configure (in
> this case, the "title" field). Then, instead of using "title_slug", you
> could use directly "slug" as the route parameter. The routing system would
> find your Article based on that field (because now it exists on your Article
> table).
>
> More information about the Sluggable behaviour:
>
> http://www.doctrine-project.org/projects/orm/1.2/docs/manual/behavior...
>
> <http://www.doctrine-project.org/projects/orm/1.2/docs/manual/behavior...>
> Cheers.
>
> On Mon, Aug 2, 2010 at 5:40 PM, David Savage <armaka...@gmail.com> wrote:
> > Hey all,
>
> > So, I just downloaded symfony and decided to try and learn it by
> > following the Jobeet tutorial. After some bumps and starts (not sure
> > if the symfony website maintainers read this, but they might think of
> > including a specialized install guide for Snow Leopard, took me
> > forever and a ton of googling to get everything set up right), I've
> > made it to Day 5. Everything works fine until i try to use the slugify
> > methods. I'm following the tutorial completely, but I am setting up a
> > news site instead of a job site, so I'll be referencing a "job" as an
> > "article." So, I went into lib/model/doctrine/Article.class.php and
> > created the function getTitleSlug() as described in the tutorial. I
> > then created the lib/Article.class.php Article class with static
> > public function slugify. Now comes the problem. If I leave my
> > article_show_user method as such:
>
> > article_show_user:
> >  url: /article/:title_slug
>
> > I get an error when viewing the index that says: The "/
> > article/:title_slug" route has some missing mandatory parameters
> > (:title_slug).
>
> > However, when I remove the _slug part (so it just says "url: /
> > article/:title") everything works fine, but obviously I'm not getting
> > what I want: slugified titles!
>
> > I created one article (where the title was: "A Test Featured
> > Article"). If I enter "article/a-test-featured-article" as the test
> > url, I get the correct page...so, I'm confused how this is working on
> > the show article itself but NOT the index. If it helps any, here's the
> > code I'm using for my indexSuccess.php:
>
> > <h1>Articles</h1>
>
> > <div class="article_list">
> >  <?php foreach ($articles as $article): ?>
> >    <div class="article">
> >      <?php echo link_to($article->getTitle(), 'article_show_user',
> > $article) ?>
> >    </div>
> >  <?php endforeach; ?>
> > </div>
>
> > <a href="<?php echo url_for('article/new') ?>">New</a>
>
> > Any help is greatly appreciated!!!
>
> > --
> > If you want to report a vulnerability issue on symfony, please send it to
> > security at symfony-project.com
>
> > You received this message because you are subscribed to the Google
> > Groups "symfony users" group.
> > To post to this group, send email to symfony-users@googlegroups.com
> > To unsubscribe from this group, send email to
> > symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/symfony-users?hl=en

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to