DoctrineExtensions icon indicating copy to clipboard operation
DoctrineExtensions copied to clipboard

Fatal error: Uncaught Doctrine\Common\Annotations\AnnotationException

Open JulianaApolo opened this issue 3 years ago • 5 comments

Fatal error: Uncaught Doctrine\Common\Annotations\AnnotationException: [Semantical Error] The annotation "@Gedmo\Mapping\Annotation\SoftDeleteable" in class Models\Brand was never imported. Did you maybe forget to add a "use" statement for this annotation? in /var/www/html/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php on line 39

<?php
namespace Models;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation AS Gedmo;
use Doctrine\Common\Collections\ArrayCollection;
use Models\Model;

/**
 * @ORM\Entity
 * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
 * @ORM\HasLifecycleCallbacks
 * @ORM\Table(name="brands")
 */
class Brand extends BaseModel
{

Composer (Composer version 2.0-dev):

"require": {
		"php": "7.3.*",
		"ext-curl": "*",
		"ext-json": "*",
		"vlucas/phpdotenv": "2.6.5",
		"doctrine/orm": "^2.7",
		"fzaninotto/faker": "^1.9",
		"gedmo/doctrine-extensions": "^3.0"
	},

JulianaApolo avatar Nov 10 '20 17:11 JulianaApolo

In your error message, the @gedmo is lowercase. Is that the actual error message? PHP is case-sensitive with namespaces and class names.

AkenRoberts avatar Jan 24 '21 01:01 AkenRoberts

@JulianaApolo, could you please confirm if you still are experiencing this issue?

phansys avatar Nov 17 '21 01:11 phansys

I am experiencing it.

namespace Models;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

class Folder  {
    /**
     * @Gedmo\Translatable
     * @ORM\Column(name="name", type="string")
     */
    private $name;
}

Results in:

  [Semantical Error] The annotation "@Gedmo\Mapping\Annotation\Translatable" in property Mode  
  ls\Folder::$name was never imported. Did you maybe forget to add a "use" statement for this annotation?

This is with ^3.3. The same thing happen if you explicitly use Gedmo\Mapping\Annotation\Translatable.

pluc avatar Nov 20 '21 03:11 pluc

try composer dump-autoload

Noext avatar Jan 28 '22 10:01 Noext

same issue here

thunder413 avatar Feb 25 '22 07:02 thunder413

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Aug 24 '22 09:08 github-actions[bot]