Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partials don't support default extension when the view context is a mailer #9

Closed
cedx opened this issue Dec 5, 2019 · 2 comments
Closed
Assignees

Comments

@cedx
Copy link
Owner

@cedx cedx commented Dec 5, 2019

Using this application configuration :

<?php return [
  'components' => [
    'mailer' => [
      'class' => 'yii\swiftmailer\Mailer',
      'view' => [
        'class' => 'yii\web\View',
        'defaultExtension' => 'mustache',
        'renderers' => ['mustache' => 'yii\mustache\ViewRenderer']
      ]
    ]
  ]
];

I expect that I can omit the file extension from partials:

{{> @app/views/header }}

But this triggers a yii\base\InvalidCallException in yii\mustache\Loader class:

The view file "[...]/views/header.php" does not exist.

(note that the file extension is set to .php)

This issue does not appear in other view contexts (e.g. a controller)

@cedx cedx added the bug label Dec 5, 2019
@cedx cedx self-assigned this Dec 5, 2019
@cedx
Copy link
Owner Author

@cedx cedx commented Dec 5, 2019

Yes, the Loader class provides its own implementation of yii\base\View::findViewFile method, and this implementation does not handle the view context (i.e. controller or mailer).

cedx added a commit that referenced this issue Dec 5, 2019
@cedx
Copy link
Owner Author

@cedx cedx commented Dec 5, 2019

Fixed in version 10.0.0 (to be released in the next days).

@cedx cedx closed this Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant