내가 엔티티 클래스 내부에 넣어 다음과 같은 코드가 있습니다엔티티에서 서비스에 액세스
$filesystem = $this->container->get('knp_gaufrette.filesystem_map')->get('amazon');
$filesystem->write($this->file , $this->name, true);
그러나이 항상의 오류 발생 :이 어떤 생각을
Notice: Undefined property: MySite\UserBundle\Entity\ProfilePicture::$container in /Users/Mike/Sites/MySite/src/MySite/MainBundle/Entity/Document.php line 98
을 이유 경우? 엔티티에서 서비스 컨테이너에 액세스하려면 어떻게합니까?
나는 추상 클래스 내에서 이것을 넣어했습니다
abstract class Document
{
......
}
Entity listener를 사용 해본 적이 있습니까? – adit
나는 당신이 의미하는 것을 이해하지 못했다. 그것은 엔티티 청취자이다 :) –