debug_kit icon indicating copy to clipboard operation
debug_kit copied to clipboard

Build url in template Previewing Mailer class will result in DebugKit plugin routing

Open tenkoma opened this issue 9 years ago • 1 comments

This is a bug in Mail Preview.

  • Version CakePHP 3.3.14, DebugKit 3.8.0

What you did

The code is as follows

<?php
// src/Mailer/UserMailer.php
namespace App\Mailer;

use Cake\Mailer\Mailer;

class UserMailer extends Mailer
{
    public function welcome()
    {
        return $this->to("[email protected]")
            ->subject("welcome!")
            ->template("welcome_mail");
    }
}

<?php // src/Template/Email/text/welcome_mail.ctp ?>
<?= $this->Url->build(
    ['controller' => 'Pages', 'action' => 'index'],
    ['fullBase' => true]
) ?>
<?php
// src/Mailer/Preview/UserMailPreview.php
namespace App\Mailer\Preview;

use DebugKit\Mailer\MailPreview;

class UserMailPreview extends MailPreview
{
    public function welcome()
    {
        return $this->getMailer("User")->welcome();
    }
}

What happened

Occurred Cake\Routing\Exception\MissingRouteException. Error Message:

Error: A route matching "array ( 'controller' => 'Pages', 'action' => 'index', 'plugin' => 'DebugKit', '_ext' => NULL, )" could not be found.

What you expected to happen

Render url likes http://example.com/pages

Temporary workaround

Include 'plugin' => false in routing array.

tenkoma avatar Feb 08 '17 08:02 tenkoma

This issue is stale because it has been open for 120 days with no activity. Remove the stale label or comment or this will be closed in 15 days

github-actions[bot] avatar Aug 10 '24 00:08 github-actions[bot]

Looks like this was fixed back in #614.

markstory avatar Sep 08 '24 03:09 markstory