This topic contains 4 replies, has 3 voices, and was last updated by Sergey 8 years, 11 months ago.
- Topic
Hi,
I’m new developper with or_platform and i have an error just with doing an import process
I want to test the import functionality
I have created an entity named RcUser using doctrine12345678910111213141516171819202122232425262728293031323334353637383940414243444546/*** RcUser** @ORM\Table(name="rc_user")* @ORM\Entity*/class RcUser{/*** @var integer** @ORM\Column(name="id", type="integer")* @ORM\Id* @ORM\GeneratedValue(strategy="AUTO")*/private $id;/*** @var string** @ORM\Column(name="username", type="string", length=255)*/private $username;/*** @var string** @ORM\Column(name="firstname", type="string", length=255)*/private $firstname;/*** @var string** @ORM\Column(name="lastname", type="string", length=255)*/private $lastname;/*** @var string** @ORM\Column(name="email", type="string", length=255)*/private $email;in my import-export.yml i have this configuration that i didn’t understand so much
12345678910111213141516171819202122232425262728parameters:rc_user.importexport.normalizer.rc_user.class: RC\PlatformBundle\ImportExport\Serializer\Normalizer\RcuserNormalizerrc_user.importexport.strategy.rc_user.add_or_replace.class: RC\PlatformBundle\ImportExport\Strategy\RcUserAddOrReplaceStrategyservices:# Normalizersorocrm_rc_user.importexport.normalizer.rc_user:class: %rc_user.importexport.normalizer.rc_user.class%parent: oro_importexport.serializer.configurable_entity_normalizertags:- { name: oro_importexport.normalizer }# Converterorocrm_rc_user.importexport.data_converter.rc_user:parent: oro_importexport.data_converter.configurable#Strategyorocrm_rc_user.importexport.strategy.rc_user.add_or_replace:class: %rc_user.importexport.strategy.rc_user.add_or_replace.class%parent: oro_importexport.strategy.configurable_add_or_replace# Import processororocrm_rc_user.importexport.processor.import.add_or_replace:parent: oro_importexport.processor.import_abstractcalls:- [setDataConverter, [@orocrm_rc_user.importexport.data_converter.rc_user]]- [setStrategy, [@orocrm_rc_user.importexport.strategy.rc_user.add_or_replace]]tags:- { name: oro_importexport.processor, type: import, entity: %rc_user_crud.entity.class%, alias: orocrm_rc_user.add_or_replace }- { name: oro_importexport.processor, type: import_validation, entity: %rc_user_crud.entity.class%, alias: orocrm_rc_user.add_or_replace }the normalizer, i didn’t change anything just doing with the default configuration
12345678910111213141516171819202122232425262728293031323334353637383940414243444546<?phpnamespace RC\PlatformBundle\ImportExport\Serializer\Normalizer;use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;use Symfony\Component\Serializer\Normalizer\NormalizerInterface;use Symfony\Component\Serializer\SerializerInterface;use Oro\Bundle\ImportExportBundle\Serializer\Normalizer\ConfigurableEntityNormalizer;use RC\PlatformBundle\Entity\RcUser;class RcuserNormalizer extends ConfigurableEntityNormalizer{const RCUSER_TYPE = 'RC\PlatformBundle\Entity\RcUser';/*** {@inheritdoc}*/public function normalize($object, $format = null, array $context = array()){$result = parent::normalize($object, $format, $context);}/*** {@inheritdoc}*/public function denormalize($data, $class, $format = null, array $context = array()){return parent::denormalize($data, $class, $format, $context);}/*** {@inheritdoc}*/public function supportsNormalization($data, $format = null, array $context = array()){return $data instanceof RcUser;}/*** {@inheritdoc}*/public function supportsDenormalization($data, $type, $format = null, array $context = array()){return is_array($data) && $type == static::RCUSER_TYPE;}}also for the strategy
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758<?phpnamespace RC\PlatformBundle\ImportExport\Strategy;use Doctrine\Common\Util\ClassUtils;use Oro\Bundle\ImportExportBundle\Strategy\Import\ConfigurableAddOrReplaceStrategy;use RC\PlatformBundle\Entity\RcUser;class RcUserAddOrReplaceStrategy extends ConfigurableAddOrReplaceStrategy{/*** {@inheritdoc}*/protected function importExistingEntity($entity,$existingEntity,$itemData = null,array $excludedFields = array()) {parent::importExistingEntity($entity, $existingEntity, $itemData, $excludedFields);}/*** {@inheritdoc}*/protected function beforeProcessEntity($entity){/** @var Contact $entity */$entity = parent::beforeProcessEntity($entity);return $entity;}/*** {@inheritdoc}*/protected function afterProcessEntity($entity){/** @var Contact $entity */$entity = parent::afterProcessEntity($entity);return $entity;}/*** {@inheritdoc}*/protected function findEntityByIdentityValues($entityName, array $identityValues){return parent::findEntityByIdentityValues($entityName, $identityValues);}}when i want to import the cvs file, i have this error
Choose Processor:
[0] oro_tracking.processor.data
[1] orocrm_rc_user.add_or_replace
> 1
Choose Validation Processor:
[0] orocrm_rc_user.add_or_replace
> 0
+—————+——-+
| Results | Count |
+—————+——-+
| errors | 0 |
| process | 4 |
| read | 3 |
| add | 4 |
| replace | 0 |
| update | 0 |
| delete | 0 |
| error_entries | 0 |
+—————+——-+
Do you want to proceed [yes]?
Errors occurred during file import.this is my cvs file
Id,”username”,”firstname”,”lastname”,”email”
1,”Life Plan Counselling”,”dennis.wright_22e27″,”Jerry”,”Coleman”
2,”Life Plansdfsdfsdf Counselling”,”dennsdgsdgsdis.wright_22e27″,”Jersdgsdry”,”Colsdgsdgeman”
3,”Life Plan Counsellingssdgsdg”,”dennis.sdgsdg”,”Jerrsdgdsgy”,”Colesdgsdgman”please i need help,
Thanks,
The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.