oroinc / platform

Main OroPlatform package with core functionality.
Other
628 stars 351 forks source link

Widget template not found #434

Open sagikazarmark opened 8 years ago

sagikazarmark commented 8 years ago

I regularly have a strange bug, which I don't really know what could cause.

The latest log:

[2016-04-01 16:22:31] request.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "Unable to find template "OroDataAuditBundle:Audit:history.html.twig"." at /var/www/vendor/symfony/symfony/src/Symfony/Bridge/Twig/TwigEngine.php line 128 {"exception":"[object] (InvalidArgumentException: Unable to find template \"OroDataAuditBundle:Audit:history.html.twig\". at /var/www/vendor/symfony/symfony/src/Symfony/Bridge/Twig/TwigEngine.php:128, Twig_Error_Loader: Unable to find template \"OroDataAuditBundle:Audit:history.html.twig\". at /var/www/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php:91, InvalidArgumentException: Unable to find template \"OroDataAuditBundle:Audit:history.html.twig\" : \"Unable to find file \"@OroDataAuditBundle/Resources/views/Audit/history.html.twig\".\". at /var/www/var/cache/dev/classes.php:809, InvalidArgumentException: Unable to find file \"@OroDataAuditBundle/Resources/views/Audit/history.html.twig\". at /var/www/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:295)"} []

It says a template cannot be found (which is actually in that bundle, under the widget directory). It already happened sometimes in the past for example on the user profile view page (with a different template name of course, but the pattern was the same).

I suspect that there is some misconfiguration/error that happens in the background, but without a proper error, I cannot really solve it.

This is my entity where I am trying to do data audit:

use Doctrine\ORM\Mapping as ORM;
use Oro\Bundle\EntityBundle\EntityProperty\DatesAwareInterface;
use Oro\Bundle\EntityBundle\EntityProperty\DatesAwareTrait;
use Oro\Bundle\EntityConfigBundle\Metadata\Annotation as ORO;
use Oro\Bundle\EntityConfigBundle\Metadata\Annotation\ConfigField; // Required for underlying trait
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @ORM\Entity()
 * @ORM\Table(
 *     name="promoters",
 *     uniqueConstraints={
 *          @ORM\UniqueConstraint(name="promoter_idx", columns={"promoterId"})
 *     }
 * )
 * @ORO\Config(
 *      defaultValues={
 *          "entity"={
 *              "icon"="icon-user"
 *          },
 *          "dataaudit"={
 *              "auditable"=true
 *          },
 *          "security"={
 *              "type"="ACL",
 *              "permissions"="VIEW;CREATE;EDIT",
 *              "group_name"=""
 *          },
 *          "grid"={
 *              "default"="promoters-grid"
 *          }
 *      }
 * )
 * @UniqueEntity("promoterId")
 * @UniqueEntity("email")
 */
class Promoter implements DatesAwareInterface
{
    use DatesAwareTrait;

    /**
     * @var int
     *
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     * @ORM\Id()
     */
    private $id;

    /**
     * This ID must be passed in a Promotion.
     *
     * @var int
     *
     * @Assert\NotBlank()
     * @Assert\Type("integer")
     * @ORM\Column(type="integer")
     */
    private $promoterId;

    /**
     * @var string
     *
     * @Assert\NotBlank()
     * @ORM\Column(type="string")
     */
    private $campaign;

    /**
     * @var string
     *
     * @Assert\NotBlank()
     * @ORM\Column(type="string")
     */
    private $role;

    /**
     * @var string
     *
     * @Assert\NotBlank()
     * @ORM\Column(type="string")
     */
    private $team;

    /**
     * @var string
     *
     * @Assert\NotBlank()
     * @ORM\Column(type="string")
     */
    private $firstName;

    /**
     * @var string
     *
     * @Assert\NotBlank()
     * @ORM\Column(type="string")
     */
    private $lastName;

    //...
}

As you can see, I haven't configured data audit for any fields, don't know if it is necessary, haven't checked it yet. However, even if it is a misconfiguration, I think I should get a better error message.

sagikazarmark commented 8 years ago

Anyone?

alex-n-2k7 commented 8 years ago

Hi, @sagikazarmark

will take a look in your case shortly, but it needs some investigation and will take a time can you please try to configure any of your fields as auditable to check that Exception will go away (or not)? this will help to accelerate the issue investigation

sagikazarmark commented 8 years ago

@alex-n-2k7 Thanks for your answer.

Actually, I think the data audit is only one part of the problem.

For example this is happening to me as well: https://www.orocrm.com/forums/topic/error-when-viewing-a-user-in-oro-bap

Using 1.9.2

(Update: the solution was the same: set a higher priority for oro_ui.view.listener)

sagikazarmark commented 8 years ago

Here is my fix that seems to solve at least one part of the problem:

https://github.com/webplates/platform-standard/commit/ae7fd4b9658c727f68df199b2ac78e3f878aac02

sagikazarmark commented 8 years ago

Unfortunately after upgrading to 1.10 the issue still persists. Please see my latest comment in #287, I described an isolated environment there where I was able to reproduce this issue as well.