건물중인 Laravel 프로젝트에서 일부 Sylius 패키지를 사용하려고합니다. 내 프로젝트에 작곡가와 함께 패키지를 추가했는데 클래스가 자동으로 잘로드되는 것 같습니다.Laravel 프로젝트에 Sylius 패키지 통합
이제 저는 그걸로 뭔가를하고 싶습니다. 실례 문서에서 간단한 예를 들어 봅시다 :
public function myAction()
{
$repository = $this->container->get('sylius.repository.address');
$manager = $this->container->get('sylius.manager.address'); // Alias to the appropriate doctrine manager service.
$address = $repository->createNew();
$address
->setFirstname('John')
->setLastname('Doe')
;
$manager->persist($address);
$manager->flush(); // Save changes in database.
}
저는 Laravel에서 이와 같은 것을 다시 만들고 싶습니다. 이를 시도하기위한 간단한 테스트 경로를 만들었지 만 문제는 다음과 같습니다.
- 리포지토리는 어떻게 구합니까?
- Doctrine 관리자 서비스는 어떻게 받습니까?
그래서 나는 또한 관리자 서비스를 얻기 위해 시도에서 laravel - 교리 패키지를 포함하고, 지금 내가 그래서 그때 난 그냥 수동으로 제품 객체를 생성 :
Route::get('test', function() {
$entityManager = new Doctrine;
$product = new \Sylius\Component\Core\Model\Product;
$product->setName('Bla');
Doctrine::persist($product);
Doctrine::flush();
dd($product);
});
이가를 생성 오류 : Class "Sylius\Component\Core\Model\Product" sub class of "Sylius\Component\Product\Model\Product" is not a valid entity or mapped super class.
어디로 갈 지 잘 모르겠습니다. 교리에 대한 나의 이해는 제한적이지만 실리스 (Sylius) 구성 요소가 심포니 (Symfony)와 분리되어 있으며, 단지 그것을 사용할 수 있다는 것이 나의 이해입니다. 그러나 Doctrine이 제대로 작동하려면 주석 (또는 XML 정의)이 존재하지 않는 것 같습니다.
어떤 방향으로 생각하겠습니다!
일반적으로 동의합니다. Bute는 ** Sylius ** Components를 사용하려고합니다 ** 번들은 아닙니다. Sylius 구성 요소는 Sylius doc http://docs.sylius.org/en/latest/components_and_bundles/components/general/index.html에 따라 모든 PHP 응용 프로그램에 설치 및 사용할 수 있습니다. –