@param callable $mapperLoader

@return void
@throws InvalidOperationException
330843
private function defineRelation(callable $mapperLoader)
    {
        if (!$this->tableName || !$this->primaryKeyName || !$this->foreignKeyToParentName) {
            throw new InvalidOperationException(
                    'Must supply table name, primary key name and foreign key name for embedded collection relation'
            );
        }

        call_user_func($this->callback, $mapperLoader, $this->tableName, $this->primaryKeyName, $this->foreignKeyToParentName);
    }
1126737
public function addLoader(Loader $loader)
    {
        $loader->setLocator($this->locator);

        $this->resolver->addLoader($loader);
    }
769095
protected function loadRepository($loader, ContainerBuilder $container, array $config)
    {
        if (isset($config['repository']['type'])) {
            if ($config['repository']['type'] == 'yaml') {
                if (!isset($config['repository']['repo']['filename'])) {
                    throw new InvalidConfigurationException(
                        'You must define filename parameter for repo yaml repository'
                    );
                }
                $container->setParameter(
                    'snide_travinizer.repo_repository.filename',
                    $config['repository']['repo']['filename']
                );
            }

            $loader->load('repository/' . strtr($config['repository']['type'], '_', '/') . '.xml');
        } else {
            throw new InvalidConfigurationException('You must define repository type parameter');
        }

        if (isset($config['repository']['class'])) {
            $container->setParameter('snide_travinizer.repo_repository.class', $config['repository']['class']);
        }
    }
702104
private function useMapper(IMapper $mapper)
    {
        if ($this->mapper === null) {
            $newProperties = $this->getReflection($mapper)->getEntityProperties();
            foreach ($this->getCurrentReflection()->getEntityProperties() as $oldProperty) {
                $oldColumn = $oldProperty->getColumn();
                if ($oldColumn !== null) {
                    $name = $oldProperty->getName();
                    if (!isset($newProperties[$name]) or $newProperties[$name]->getColumn() === null) {
                        throw new InvalidStateException('Inconsistent sets of properties detected in entity ' . get_called_class() . '.');
                    }
                    if ($this->row->hasColumn($oldColumn)) {
                        $newColumn = $newProperties[$name]->getColumn();
                        $value = $this->row->$oldColumn;
                        unset($this->row->$oldColumn);
                        $this->row->$newColumn = $value;
                    }
                }
            }
            $this->mapper = $mapper;
            $this->row->setMapper($mapper);
            $this->currentReflection = null;
        } elseif ($this->mapper != $mapper) { // intentionally !=, we want to ensure that types and states are same
            throw new InvalidStateException("Given mapper isn't same as mapper already present in entity " . get_called_class() . '.');
        }
    }
863608
public function registerDoctrineLazyLoader($entityClass, LazyLoaderInterface $loader)
    {
        if (!is_a($entityClass, LazyPropertiesInterface::class, true)) {
            throw new \InvalidArgumentException(sprintf(
                'Class %s has to implement %s to be able to lazy load her properties.',
                $entityClass,
                LazyPropertiesInterface::class
            ));
        }

        $this->loaders->set($entityClass, $loader);
    }
155389
private function mapOperator($operator)
    {
        if (array_key_exists($operator, $this->shortOperators)) {
            $operator = $this->shortOperators[$operator];
        }

        if (!in_array($operator, $this->allowedOperators)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid operator `%s` given. Valid operators are %s.',
                $operator,
                implode(', ', $this->allowedOperators)
            ));
        }

        return $operator;
    }
1001715
public function setMapEntries(MapEntryCollection $mapEntries)
    {
        if (count($mapEntries) > 0) {
            $this->mapEntries = $mapEntries;
        } else {
            $msg = "A Mapping object must contain at least one MapEntry object, none given.";
            throw new InvalidArgumentException($msg);
        }
    }
437712
public static function registerServiceProvider($serviceProvider)
    {
        if (is_callable($serviceProvider)) {
            $serviceProvider = new CustomServiceProvider($serviceProvider);
        } elseif (!is_a($serviceProvider, ServiceProviderInterface::class, true)) {
            throw new BootstrapException(
                "Error registering service provider: $serviceProvider is not valid service provider."
            );
        }
        if (self::$container === null) {
            self::$serviceProviders[] = $serviceProvider;
        } else {
            /** @var ServiceProviderInterface $provider */
            $provider = new $serviceProvider;
            $provider->register(self::$container);
        }
    }
472480
public function set($key, $value)
    {
        if (! $value instanceof EntityMapperInterface) {
            throw new InvalidArgumentException(
                'Trying to add a non EntityMapper to MappersMap.'
            );
        }
        return parent::set($key, $value);
    }
1156676
public function addInstaller(InstallerInterface $installer)
    {
        $installerClass = get_class($installer);

        if (!isset($this->installers[$installerClass])) {
            if ($installer instanceof OrderedInstallerInterface && $installer instanceof DependentInstallerInterface) {
                throw new \InvalidArgumentException(sprintf('Class "%s" can\'t implement "%s" and "%s" at the same time.',
                    $installerClass,
                    'OrderedInstallerInterface',
                    'DependentInstallerInterface'));
            } elseif ($installer instanceof OrderedInstallerInterface) {
                $this->orderInstallersByNumber = true;
            } elseif ($installer instanceof DependentInstallerInterface) {
                $this->orderInstallersByDependencies = true;
                foreach ($installer->getDependencies() as $class) {
                    $this->addInstaller(new $class);
                }
            }

            $this->installers[$installerClass] = $installer;
        }
    }
862600
public function initModules(IModulesLoader $modulesLoader)
    {
        foreach ($modulesLoader->getModules() as $module) {
            $this->addModule($module);
        }
    }
559502
public function map(callable $mapper): self
    {
        if ($this->isPresent()) {
            return new self($mapper($this->value));
        }

        return self::$null;
    }
64026
protected function executeLoader(LoaderInterface $loader)
    {
        $offset = 0;

        try {

            while ($result = $loader->load($this->limit, $offset)) {

                $this->persist($result);
                $offset += $this->limit;
            }

        } catch (LoaderException $e) {
            $this->getLogger()->error($e->getMessage());
        }
    }
159734
public function usingCustom(callable $mapperDefinitionCallback)
    {
        $this->defineRelation(function (IObjectMapper $parentMapper) use ($mapperDefinitionCallback) {
            return new CustomValueObjectMapper($this->orm, $parentMapper, $mapperDefinitionCallback);
        });
    }
1202215
public static function setLoader($loader) {
    if (!$loader) {
      self::$_loader = NULL;
      return;
    }
    if ($loader instanceof FluentDOM\Loadable) {
      self::$_loader = $loader;
      return;
    }
    throw new FluentDOM\Exceptions\InvalidArgument(
      'loader', [Loadable::class]
    );
  }
749376
public function setLoader(ServiceLoader $loader){

		$this->loader = $loader;
		$that = $this;

		$this->loader->addInitializer(function ($instance) use ($that) {

		    // Inject broker to services
		    if ($instance instanceof Feature\ServiceBrokerAwareInterface) {
		        $instance->setServiceBroker($that);
		    }

		    // Inject event manager to services
		    if ($instance instanceof EventManagerAwareInterface) {
		        $instance->setEventManager($that->getEventManager());
		    }
		});

		return $this;
	}
745370
public function newInstance()
    {
        // Set the file locators in each loader instance.
        foreach($this->loaders as $loader) {
            if(false === $loader instanceof LoaderInterface) {
                throw new \InvalidArgumentException("Loaders must implement Affiniti\Config\Loader\LoaderInterface.");
            }
            
            $loader->setLocator($this->fileLocator);
        }
        
        return new DelegatingLoader(new LoaderResolver($this->loaders));
    }