debug_kit
debug_kit copied to clipboard
Build url in template Previewing Mailer class will result in DebugKit plugin routing
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.
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
Looks like this was fixed back in #614.