コード例 #1
0
 /**
  * Creates sequence instance
  *
  * @param string $entityType
  * @param array $config
  * @return SequenceInterface
  */
 public function create($entityType, $config)
 {
     if ($this->sequenceRegistry->retrieve($entityType) === false) {
         if (isset($config[$entityType]['sequence'])) {
             $this->sequenceRegistry->register($entityType, $config[$entityType]['sequence']);
         } elseif (isset($config[$entityType]['sequenceTable'])) {
             if (isset($config[$entityType]['connectionName'])) {
                 $connectionName = $config[$entityType]['connectionName'];
             } else {
                 $connectionName = 'default';
             }
             $this->sequenceRegistry->register($entityType, $this->objectManager->create($this->instanceName, ['connectionName' => $connectionName, 'sequenceTable' => $config[$entityType]['sequenceTable']]), $config[$entityType]['sequenceTable']);
         } else {
             $this->sequenceRegistry->register($entityType);
         }
     }
     return $this->sequenceRegistry->retrieve($entityType)['sequence'];
 }