Sets up the model repository for the relevant model.

@return ModelRepositoryInterface
348649
protected function makeModelRepository()
    {
        $repository = new ModelRepository($this->modelInformation->modelClass());

        $this->applyRepositoryContext($repository, $this->modelInformation);

        return $repository;
    }
1003028
protected function configureRepositories()
    {
        $repositoryManager = new RepositoryManager();
        $this['repository-manager'] = $repositoryManager;

        $path = sprintf('%s/src/Repository', $this->getRootPath());

        $ns = (new \ReflectionObject($this))->getNamespaceName() . '\\Repository';
        $repositoryManager->autoloadPdoRepositories($path, $ns, $this->pdo);

        foreach ($repositoryManager->getRepositories() as $repository) {
            if (is_a($repository, 'Radvance\\Repository\\PermissionRepositoryInterface')) {
                $this->configurePermissionRepository($repository);
            }

            if (is_a($repository, 'Radvance\\Repository\\SpaceRepositoryInterface')) {
                $this->configureSpaceRepository($repository);
            }

            // Register the class for autowiring
            $this[get_class($repository)] = $repository;
        }
    }
619568
public function build()
    {
        $this->createEntityClassParameter();

        $this->createConfigurationDefinition();

        $this->createMetadataDefinition();
        $this->createManagerDefinition();
        $this->createRepositoryDefinition();
        $this->createOperatorDefinition();

        // TODO search repository service

        $this->createControllerDefinition();

        $this->createFormDefinition();
        $this->createTableDefinition();

        $this->configureTranslations();

        return $this;
    }
763120
public function getRepository()
    {
        if ($this->repository === null) {
            $this->repository = $this->entityManager->getRepository($this->entityName);
        }

        return $this->repository;
    }
338299
public function setRepository()
    {
        $this->repository = app()->make(PageRepositoryInterface::class);
        $this->repository
            ->pushCriteria(\Litepie\Repository\Criteria\RequestCriteria::class)
            ->pushCriteria(\Litecms\Page\Repositories\Criteria\PageResourceCriteria::class);
    }
1039290
public function persist(ModelInterface $model): RepositoryInterface
    {
        $id = $model->getId();
        $row = $model->toPersistence();

        $this->connection->beginTransaction();

        $alreadyExists = (bool) $this->find($id);

        $stack = new RelatedModelManipulationStack();

        foreach ($row as $field => $value) {
            if ($value instanceof ModelCollectionInterface) {
                $stack->addToRemoveModels($value->getInitialModels());
                $stack->addToPersistModels($value->getModels());
                unset($row[$field]);
            } elseif ($value instanceof ModelReferenceInterface) {
                $row[$field.'Id'] = $this->persistModelReference($value, $stack);

                unset($row[$field]);
            }
        }

        if (!$alreadyExists) {
            $this->insert($id, $row);
        } else {
            $this->update($id, $row);
        }

        $this->removeRelatedModels($stack->getToRemoveModels());
        $this->persistRelatedModels($stack->getToPersistModels());

        $this->storageCache->set($id, $row);

        $this->connection->commit();

        return $this;
    }
1171759
protected function injectorSetup()
    {
        if ($this->_injectorObjects === null) {
            foreach ($this->injectors() as $varName => $injector) {
                $injector->setContext($this);
                $injector->varName = $varName;
                $injector->setup();
                $this->_injectorObjects[$injector->varName] = $injector;
            }
        }
    }
826999
private function bindRepositories()
    {
        $this->app->bind(\Scool\Attendance\Repositories\LessonRepository::class, \Scool\Attendance\Repositories\LessonRepositoryEloquent::class);
        $this->app->bind(\Scool\Attendance\Repositories\DayRepository::class, \Scool\Attendance\Repositories\DayRepositoryEloquent::class);
        $this->app->bind(\Scool\Attendance\Repositories\ShiftRepository::class, \Scool\Attendance\Repositories\ShiftRepositoryEloquent::class);
        $this->app->bind(\Scool\Attendance\Repositories\TimeslotRepository::class, \Scool\Attendance\Repositories\TimeslotRepositoryEloquent::class);
        $this->app->bind(\Scool\Attendance\Repositories\AttendanceRepository::class,
            \Scool\Attendance\Repositories\AttendanceRepositoryEloquent::class);
        //:end-bindings:
    }
629203
public function setModelType($modelType)
    {
        if ($modelType !== self::MODELTYPE_ENTITY && $modelType !== self::MODELTYPE_VALUEOBJECT) {
            throw new \InvalidArgumentException('"' . $modelType . '" is an invalid model type.', 1212519195);
        }
        $this->modelType = $modelType;
        if ($modelType === self::MODELTYPE_VALUEOBJECT) {
            $this->identityProperties = [];
            $this->repositoryClassName = null;
        }
    }
260223
public function remove(ModelInterface $model): RepositoryInterface
    {
        $id = $model->getId();
        $table = $this->getTable();

        if (null === $this->find($id)) {
            return $this;
        }

        $this->connection->beginTransaction();

        $row = $model->toPersistence();

        foreach ($row as $field => $value) {
            if ($value instanceof ModelCollectionInterface) {
                $this->removeRelatedModels($value->getInitialModels());
            } elseif ($value instanceof ModelReferenceInterface) {
                if (null !== $initialModel = $value->getInitialModel()) {
                    $this->removeRelatedModel($initialModel);
                }
            }
        }

        $this->logger->info(
            'model: remove row from table {table} with id {id}',
            ['table' => $table, 'id' => $id]
        );

        $this->connection->delete($table, ['id' => $id]);

        $this->storageCache->remove($id);

        $this->connection->commit();

        return $this;
    }
1209160
protected function registerRepository()
	{
		$this->app->singleton('migration.orient.repository', function($app)
		{
			$table = $app['config']['database.migrations'];
                        $db = $app->make("ConnectionResolverInterface");

			return new DatabaseMigrationRepository($db, $table);
		});
	}
1073577
public function initialize()
    {
        if ($this->initialized) {
            return;
        }

        $this->initialized = true;
        $this->repository = app(RepositoryInterface::class);
        $this->repository->setClass($this->class);

        $model = $this->makeModel();
        parent::setModel($model);
        $this->getButtons()->setModel($model);

        parent::initialize();

        if (! $this->hasHtmlAttribute('enctype')) {

            // Recursive iterate subset of form elements
            // and if subset contains an upload element then add to for
            $this->recursiveIterateElements(function ($element) {
                if ($element instanceof Upload) {
                    $this->withFiles();

                    return true;
                }
            });
        }

        $this->getButtons()->setModelConfiguration(
            $this->getModelConfiguration()
        );
    }
1019193
protected function getRepository()
    {
        if (null === $this->repository) {
            $this->repository = $this->getEntityManager()
                    ->getRepository($this->getModuleNamespace() . '\Entity\\' . $this->getEntityName());
        }
        return $this->repository;
    }
400046
protected function getModelRepositoryForInformation(ModelInformationInterface $information)
    {
        /** @var ModelRepositoryFactoryInterface $factory */
        $factory = app(ModelRepositoryFactoryInterface::class);

        $modelRepository = $factory->make($information->modelClass());

        $this->applyRepositoryContext($modelRepository, $information);

        return $modelRepository;
    }
1362067
protected function registerModelFactory()
    {
        $this->app->singleton(ModelFactory::class, function ($app) {
            return new ModelFactory(
                $app->make('db'),
                $app->make(Filesystem::class),
                new Classify(),
                new Config($app->make('config')->get('models'))
            );
        });
    }
35412
protected function bindRepositories()
    {
        $this->app->singleton(RoutesService::class, function () {
            return new RoutesService();
        });

        $this->app->singleton(LanguageService::class, function () {
            return new LanguageService(
                cache()->rememberForever('languages', function () {
                    return Language::all();
                })
            );
        });

        $this->app->singleton('croppa.src_dir', function () {
            return resolve('filesystem')->disk(config('gzero.upload.disk'))->getDriver();
        });
    }
658029
protected function setUp()
	{
		$this->bbcodeMonkey = new BBCodeMonkey($this->configurator);
		$this->collection   = new BBCodeCollection;
		$this->repositories = new RepositoryCollection($this->bbcodeMonkey);
		$this->repositories->add('default', __DIR__ . '/Configurator/repository.xml');
	}