Synchronize entities from config file
@param array $entity_names
337116
public function synchronize(array $entity_names)
    {
        $entities = $this->setup->getMappedSyncEntities($entity_names);
        foreach ($entities as $name => $entity) {
            /**
             * @var OpenstoreAkilia\Sync\Entities\AbstractEntity $cls
             */
            $cls = $entity['class'];

            $syncEntity = new $cls($this->dbExecuter, $this->setup);
            $syncEntity->setLegacySynchroAt($this->legacy_synchro_at);
            $syncEntity->synchronize();
        }
    }
653150
public static function initialize() {
		$paths = array_merge(
			array_filter(glob('src/*'), 'is_dir'),
			array_filter(glob('src-*/*'), 'is_dir'),
			array_filter(glob(__DIR__ . '/../../*/src/*/'), 'is_dir')
		);

		$db_params = array(
			"url" => Configuration::get("database.uri", "sqlite:///:memory:")
		);

		$cache = null;
		if(Configuration::get("database.cache", "false") == "false")
			$cache = new \Doctrine\Common\Cache\ArrayCache;

		$config = Setup::createAnnotationMetadataConfiguration($paths, Configuration::get("debug.database", "false") == "true", "cache", $cache);

		foreach(Modules::getAll() as $module)
			$config->addEntityNamespace($module->getShortName(), $module->getNamespace() . "\\Models");

		self::$entity_manager = EntityManager::create($db_params, $config);
	}
317437
public function mapEntities(array $entityDefinitions)
	{
		foreach($entityDefinitions as $entityIdentifier => $entityDefinition)
		{
			$this->validateAndCompleteEntity($entityIdentifier, $entityDefinition);
		}
	}
363814
public void setEntityValues(java.util.Collection<String> entityValues) {
        if (entityValues == null) {
            this.entityValues = null;
            return;
        }

        this.entityValues = new java.util.ArrayList<String>(entityValues);
    }
1043548
public function setTables($entityTables, $manyToManyTables)
    {
        $this->tables = $this->manyToManyTables = $this->classToTableNames = [];

        foreach ($entityTables as $table) {
            $className = $this->getClassNameForTable($table->getName());

            $this->classToTableNames[$className] = $table->getName();
            $this->tables[$table->getName()]     = $table;
        }

        foreach ($manyToManyTables as $table) {
            $this->manyToManyTables[$table->getName()] = $table;
        }
    }
731310
public function getEntityBundles(array $module_configs) {
    $list = [];
    foreach ($this->entityBundlesConfigPrefixes as $entity_type => $data) {
      $filtered_array = preg_grep('/^' . $data['prefix'] . '.*/', $module_configs);
      if (empty($filtered_array)) {
        continue;
      }

      foreach ($filtered_array as $config_name) {
        // Example - paragraphs.paragraphs_type.blog_posts_listing.
        // Example - taxonomy.vocabulary.amenities.
        // Example - node.type.landing_page.
        // Last array item always entity bundle name.
        $entity_info = explode('.', $config_name);
        $list[] = [
          'entity_type' => $entity_type,
          'config_entity_type' => $data['config_entity_type'],
          'bundle' => end($entity_info),
          'bundle_field' => $data['bundle_field'],
        ];
      }
    }

    return $list;
  }
1323777
public function vaidateEntityConfig($entityName, $entity)
  {

    if (empty($entity->requests))
    {
      $this->printMessage(
        "Entity: {$entityName} doesn't have any requests set up for it."
        . " Controllers, exceptions, requests will be skipped."
      );
    }
    else
    {
      foreach ($entity->requests as $requestMethod => $actions)
      {
        foreach ($actions as $actionName => $action)
        {
          if (empty($action->url))
          {
            $this->printMessage(
              "Entity: {$entityName}::{$actionName} doesn't have a url set."
              . " This action will be skipped."
            );
            $entity->requests->$requestMethod->$actionName = false;
          }

          if (!empty($action->throws))
          {
            if (!empty($action->throws->extends))
            {
              if (!class_exists("Phrest\\API\\Exceptions\\" . $action->throws->extends))
              {
                $this->printMessage(
                  "Entity: {$entityName}::{$actionName} Unknown exception: "
                  . "Phrest\\API\\Exceptions\\" . $action->throws->extends
                  . ". This extension will be removed."
                );
                $action->throws->extends = false;
              }
            }
          }
        }
      }
    }

    if (empty($entity->model))
    {
      $this->printMessage(
        "Entity: {$entityName} doesn't have a model definition. Models and "
        . "responses will be skipped."
      );
    }

    return $entity;
  }
1144556
public void addEntities(String[][] entityArray) {
        for (String[] anEntityArray : entityArray) {
            addEntity(anEntityArray[0], Integer.parseInt(anEntityArray[1]));
        }
    }
223308
public function removeAll(array $entities): void
    {
        if ([] === $entities) {
            return;
        }
        foreach ($entities as $entity) {
            $this->checkIsCorrectEntityType($entity);
            $this->entityManager->remove($entity);
        }

        $this->entityManager->flush();
    }
157215
public void saveEntities(Set<String> entityIds, boolean clearOnSuccess, Command callback) {

        List<CmsEntity> entities = new ArrayList<CmsEntity>();
        for (String entityId : entityIds) {
            CmsEntity entity = m_entityBackend.getEntity(entityId);
            if (entity != null) {
                entities.add(entity);
            }
        }
        saveEntities(entities, clearOnSuccess, callback);
    }
597552
protected function bindEntities()
    {
        $entities = $this->app->config['entity'];

        foreach($entities as $e => $config){

            $this->app->bind("entity.$e", function ($app, $default) use ($config){

                return new $config['class'];

            });
        }
    }
397869
protected static function _setupDbConfig($connection_name)
        {
            if (!Arrays::exists($connection_name, self::$_config)) {
                self::$_config[$connection_name] = self::$_default_config;
            }
        }
617401
protected function loadCollaction($name, $entityName, $fields)
    {
        $em = $this->getContainer()->get('doctrine')->getManager();
        $entityRepository = $em->getRepository($entityName);

        $meta = $em->getClassMetadata($entityName);
        $identifier = $meta->getSingleIdentifierFieldName();
        $identifierMethodName = 'get'.ucfirst($identifier);

        $collection = $entityRepository->findAll();

        $result = array();

        foreach ($collection as $item) {
            $element = array();

            foreach ($fields as $fieldName => $attributes) {
                $methodName = 'get'.ucfirst($fieldName);
                $fieldValue = $item->$methodName();

                $value = null;

                if (is_object($fieldValue)) {
                    if (get_class($fieldValue) === 'DateTime') {
                        $value = array('type' => 'DateTime', 'name' => $fieldValue->format('r'));
                    } elseif (array_key_exists('targetEntity', $attributes)) {
                        $targetClassName = $meta->associationMappings[$fieldName]['targetEntity'];
                        $targetEntityProvider = new EntityProvider($targetClassName);

                        $targetMethodName = 'get'.ucfirst($em->getClassMetadata($targetClassName)->identifier[0]);
                        $value = array(
                            'type' => 'reference',
                            'name' => $targetEntityProvider->getName().'_'.$fieldValue->$targetMethodName(),
                        );
                    } else {
                        throw new \Exception('aaa');
                    }
                } else {
                    $value = $fieldValue;
                }

                $element[$fieldName] = $value;
            }

            $result[$name.'_'.$item->$identifierMethodName()] = $element;
        }

        return $result;
    }
2919
public function loadConfigs(...$names)
    {
        /** @var Config $config */
        $config = $this->make(Config::class);
        foreach ($names as $name) {
            $config->load($name);
        }
    }
19733
public function synchronize($connectionName)
    {
        $configuration = $this->getConfiguration($connectionName);
        $database = $this->getDatabase($connectionName);

        foreach ($configuration->getVertexes() as $vertex) {
            try {
                $database->query(sprintf('CREATE CLASS %s EXTENDS V',
                    $vertex->getName()
                ));
                $database->query(sprintf('DISPLAY RECORD 0',
                    $vertex->getName()
                ));
                dump($res); die;
            } catch (\Exception $e) {
                if (preg_match(sprintf('/Class %s already exists in current database$/', $vertex->getName()), $e->getMessage())) {
                    continue;
                }

                throw $e;
            }
        }
    }
87447
private function syncFilesystemConfig()
    {
        foreach ($this->config()->get('arcanesoft.media.filesystem.disks', []) as $disk => $config) {
            $this->config()->set("filesystems.disks.$disk", $config);
        }
    }
926893
public static function getScheduledEntityUpdatesByClassname(EntityManager $em, $classnames)
    {
        $entities = array();
        $classnames = (array) $classnames;

        foreach ($em->getUnitOfWork()->getScheduledEntityUpdates() as $entity) {
            if (true === in_array(ClassUtils::getRealClass($entity), $classnames)) {
                $entities[] = $entity;
            }
        }

        return $entities;
    }