LogicException: Entity addonid:Attachment (class: addonid\Entity\Attachment) could not be found in src\XF\Mvc\Entity\Manager.php at li

RisteDimitrievski

Active member
Idk why this happened but in my code is :

PHP:
$variable = $this->em()->create("addonid\XF:Attachment");

And i got this error:
LogicException: Entity addonid:Attachment (class: addonid\Entity\Attachment) could not be found in src\XF\Mvc\Entity\Manager.php at line 53

Attachment entity is a new entity i'm creating for handling my own attachment data in my addon.
 
Do you have an Attachment class in the addonid\XF\Entity namespace?
Yes. Let me explain i get special character in error log

LogicException: Entity addonid:Attachment (class: addonid\Entity\Attachment) could not be found in src\XF\Mvc\Entity\Manager.php at line 53
Where it should print a least addonid\XF\Entity\Attachment.

But he is looking for entity in addonid\Entity folder.
 
Oh I see, that's because \XF is interpreted as a hex character. You would need to escape it:

PHP:
$variable = $this->em()->create("addonid\\XF:Attachment");
 
Oh I see, that's because \XF is interpreted as a hex character. You would need to escape it:

PHP:
$variable = $this->em()->create("addonid\\XF:Attachment");
But on other entities there are no exceptions and all are like
[code="php]
$variable = $this->em()->create("addonid\XF:Entity");
[/code]
 
Are they maybe using single quotes instead? Those will be interpreted as-is and won't need escaping.
 
Top Bottom