/** * @param string $contentTypeId * * @return array */ public function getMapping($contentTypeId) { $mapping = array(); /** * @var ContentTypeInterface */ $contentType = $this->contentTypeRepository->findOneByContentTypeIdInLastVersion($contentTypeId); if (null !== $contentType) { /** * @var $field FieldTypeInterface */ foreach ($contentType->getFields() as $field) { $fieldId = $field->getFieldId(); $key = 'attributes.' . $fieldId . '.string_value'; $mapping[$key] = array('field' => 'attributes.' . $fieldId . '.stringValue', 'key' => $key, 'type' => 'string'); } } return $mapping; }
/** * @param string $contentType * @param int $version * * @dataProvider provideContentTypeAndVersionNumber */ public function testFindOneByContentTypeIdInLastVersion($contentType, $version) { $contentTypeElement = $this->repository->findOneByContentTypeIdInLastVersion($contentType); $this->assertEquals($version, $contentTypeElement->getVersion()); }