我刚刚写了一个新闻任务,将地址集从 Json 文件导入到 tt_address。这很好用。现在我被困在创建新类别的问题上。但我无法将它们分配给地址集。
有人知道如何做到这一点?
$jsondivision ='JsonCategorieName'
$address = 'AddressSet'
$categoryParent = 'PartentUID'
public function checkCategory($jsondivision, $address) {
$extbaseObjectManager = GeneralUtility::makeInstance('TYPO3\CMS\Extbase\Object\ObjectManager');
$this->addressRepository = $extbaseObjectManager->get('Graphodata\Gdjson2ttaddress\Domain\Repository\GdAddressRepository');
$this->objectStorage = $extbaseObjectManager->get('TYPO3\CMS\Extbase\Persistence\ObjectStorage');
$this->categoryRepository = $extbaseObjectManager->get('Graphodata\Gdjson2ttaddress\Domain\Repository\GdCategoryRepository');
$newCategory = $extbaseObjectManager->get('Graphodata\Gdjson2ttaddress\Domain\Model\GdCategory');
$newCategory->setTitle($jsondivision);
$newCategory->setParent($categoryParent);
$this->categoryRepository->add($newCategory);
$address->addressRepository($newCategory);
}