| Conditions | 4 |
| Paths | 6 |
| Total Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | public function createByEntityClass($entityClass) |
||
| 37 | { |
||
| 38 | $result = null; |
||
| 39 | $classes = class_parents($entityClass); |
||
| 40 | array_unshift($classes, $entityClass); |
||
| 41 | |||
| 42 | foreach ($classes as $entityClass) { |
||
|
|
|||
| 43 | $entityConfig = $this->config->getEntityConfig($entityClass); |
||
| 44 | if (!$entityConfig) { |
||
| 45 | continue; |
||
| 46 | } |
||
| 47 | |||
| 48 | $schema = $this->config->getSchemaByEntityClass($entityClass); |
||
| 49 | $updateQuery = $this->queryBuilder->buildUpdateQuery($schema); |
||
| 50 | $result = new Indexer($updateQuery, $schema, $entityConfig); |
||
| 51 | break; |
||
| 52 | } |
||
| 53 | |||
| 54 | if (!$result) { |
||
| 55 | throw new EntityNotIndexedException( |
||
| 56 | sprintf('"%s" or parents is not indexed. Check config.yml', $entityClass) |
||
| 57 | ); |
||
| 58 | } |
||
| 59 | |||
| 60 | return $result; |
||
| 61 | } |
||
| 62 | } |