zenstruck / redirect-bundle

Store redirects for your site and keeps statistics on redirects and 404 errors.
MIT License
24 stars 8 forks source link

Installation not working + problem for new and edit redirects #20

Closed connectjames closed 7 years ago

connectjames commented 7 years ago

Hi,

I have followed the whole installation (bundle in kernel, creation of the notFound and redirect entities + DB update, default config). My config is: zenstruck_redirect: redirect_class: AppBundle\Entity\Redirect not_found_class: AppBundle\Entity\NotFound model_manager_name: ~ remove_not_founds: true

As I understand one of my user falls on a 404 error, either the notfound DB will have a new row added to it or the user will be redirected to the right url included in my redirects. It does not do it.

For a new redirect, what is the exact code with parameters?

For an edit, symfony tells me: Could not load type "zenstruck_redirect" I am unsure of what that means.

Thanks a lot for your time and this awesome bundle!

Thanks

kbond commented 7 years ago

For the first problem:

  1. Do you get any exceptions?
  2. Do the tables exist in your database?
  3. Are the 2 event listeners registered (bin/console debug:event) - you should see: Zenstruck\RedirectBundle\EventListener\RedirectOnNotFoundListener::onKernelException() and Zenstruck\RedirectBundle\EventListener\CreateNotFoundListener::onKernelException()

For creating a redirect, it is just the same as any other doctrine entity:

$redirect = new \AppBundle\Entity\Redirect('/source', '/destination');
$em->persist($redirect);
$em->flush();
connectjames commented 7 years ago
  1. I do not get any errors
  2. Tables are present in the database
  3. None of this two event listeners appear with this cmd

I reviewed the installation and I don't think I am forgetting anything.

Thanks for the redirect.

connectjames commented 7 years ago

I am on Symfony 3 if it makes any difference

kbond commented 7 years ago

When you run app/console debug:container redirect

Do you see:

Select one of the following services to display its information:
  [0] zenstruck_redirect.redirect_manager
  [1] zenstruck_redirect.redirect_listener
  [2] zenstruck_redirect.redirect.form.type
  [3] zenstruck_redirect.not_found_manager
  [4] zenstruck_redirect.not_found_listener
  [5] zenstruck_redirect.remove_not_found_subscriber
  [6] zenstruck_redirect.entity_manager
 >

?

connectjames commented 7 years ago

Yes, but I do not get number 5

kbond commented 7 years ago

That is strange, the event listener's are registered as services but not as event listeners... I don't know how that is possible...

Can you recreate the problem on a forked symfony standard?

connectjames commented 7 years ago

I added you as a collaborator to my project, you can like this reproduce the error.

kbond commented 7 years ago

I got the invite but the link was a 404..

connectjames commented 7 years ago

Sorry coming up in 5 min