コード例 #1
0
 /**
  * Gets data which describes specific connector by entity type.
  * @param string $entityType Entity type (ex. sonet_comment).
  * @return array|null Array with two elements: connector class and module.
  */
 public function getConnectorDataByEntityType($entityType)
 {
     $entityType = strtolower($entityType);
     switch ($entityType) {
         case 'blog_comment':
             return array(BlogPostCommentConnector::className(), 'blog');
         case 'blog_post':
             return array(BlogPostConnector::className(), 'blog');
         case 'calendar_event':
             return array(CalendarEventConnector::className(), 'calendar');
         case 'forum_message':
             return array(ForumMessageConnector::className(), 'forum');
         case 'tasks_task':
             return array(TaskConnector::className(), 'tasks');
         case 'sonet_log':
             return array(SonetLogConnector::className(), 'socialnetwork');
         case 'sonet_comment':
             return array(SonetCommentConnector::className(), 'socialnetwork');
         case 'iblock_element':
             return array(IblockElementConnector::className(), 'iblock');
         case 'iblock_workflow':
             return array(IblockWorkflowConnector::className(), 'iblock');
     }
     $data = $this->getAdditionalConnector($entityType);
     return $data === null ? array(StubConnector::className(), Driver::INTERNAL_MODULE_ID) : $data;
 }
コード例 #2
0
 /**
  * Gets fields which Externalizer or Internalizer should modify.
  * @return array
  */
 public function getFieldsForMap()
 {
     return array('CREATE_TIME' => array('IN' => function ($externalValue) {
         return \CRestUtil::unConvertDateTime($externalValue);
     }, 'OUT' => function (DateTime $internalValue = null) {
         return \CRestUtil::convertDateTime($internalValue);
     }), 'ENTITY_TYPE' => array('IN' => function ($externalValue) {
         switch ($externalValue) {
             case 'blog_comment':
                 return BlogPostCommentConnector::className();
             case 'blog_post':
                 return BlogPostConnector::className();
             case 'calendar_event':
                 return CalendarEventConnector::className();
             case 'forum_message':
                 return ForumMessageConnector::className();
             case 'tasks_task':
                 return TaskConnector::className();
             case 'sonet_log':
                 return SonetLogConnector::className();
             case 'sonet_comment':
                 return SonetCommentConnector::className();
         }
         return null;
     }, 'OUT' => function ($internalValue) {
         switch ($internalValue) {
             case BlogPostCommentConnector::className():
                 return 'blog_comment';
             case BlogPostConnector::className():
                 return 'blog_post';
             case CalendarEventConnector::className():
                 return 'calendar_event';
             case ForumMessageConnector::className():
                 return 'forum_message';
             case TaskConnector::className():
                 return 'tasks_task';
             case SonetLogConnector::className():
                 return 'sonet_log';
             case SonetCommentConnector::className():
                 return 'sonet_comment';
         }
         return null;
     }));
 }