Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5844479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:17:52+00:00 2026-05-22T12:17:52+00:00

HI! I use symfony 1.4.11. In my project’s all users ad, are available on

  • 0

HI! I use symfony 1.4.11.
In my project’s all users ad, are available on the site only when it owner will have a premium account.The problem is that all ads are available on direct links…So I use decision of this problem from day 6 of Jobbet.
Routing:

ads_show_user:
  url:     /:sf_culture/ads/:slug
  class:   sfDoctrineRoute
  options: { model: Ads, type: object,  method_for_query: retrievePayAd }
  param:   { module: ads, action: show }
  requirements:
    sf_method: [get]
    sf_culture: (?:de|en|ru)

Model:

public function retrievePayAd(Doctrine_Query $q)
  {
    $q ->leftJoin('a.Owner o')
      ->leftJoin('o.Profile p')
      ->andWhere('p.payed_until > NOW()')
      ->andWhere('a.active = ?',1)
      ->andWhere('a.expires_at > NOW()');

    return $q->fetchOne();
  }

And all works fine, but next problem, that if owner of ad have not pay for premium, he can not see extended version of his ad too, like all users… Is it possible to redirect user not to 404 page, but to other page, where I can say user, why he can not see extended version of his ad ? Or is there other way that owner of ad can see extended version ? Thank you !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:17:53+00:00Added an answer on May 22, 2026 at 12:17 pm

    Yes, it’s possible.

    Modify your route to allow empty objects to be returned:

    ads_show_user:
      ...
      options: { allow_empty: true ... }
    

    Now, in your action, when you call $this->getRoute()->getObject(), it will not 404 if an object isn’t found. You can then handle this case (or cases), however you wish.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can i use global i18n translations for all applications in a symfony project?
symfony: http://www.symfony-project.org pjax: https://github.com/defunkt/jquery-pjax Hi all, I'm trying to use pjax in symfony in
The official website seems only provided some tutorial on how to use: http://www.symfony-project.org But
I have this wild project happening at work, and we happen to use Symfony
I have some problem while configuring symfony project on the production server. When I
So I am starting a Symfony project that I will be developing on my
(I hope 'bootstrap' is the correct term...) I have a Symfony 1.4 project in
I'm using Symfony 2.1 for a project and trying to use FOSUserBundle to manage
I am working on the project that is based on symfony (doctrine) with use
I have a strange bug on a Symfony 1.4 project on the production server,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.