Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Repository Alias Bundle Laravel Package

codemonkeys-ru/repository-alias-bundle

View on GitHub
Deep Wiki
Context7

CodeMonkeys RepositoryAliasBundle

Bundle provides alternative syntax for working with entity repositories. See Example section for more.

Installation

Install thru composer

php composer.phar require codemonkeys-ru/repository-alias-bundle

And add bundle to your AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        ...
        new CodeMonkeysRu\RepositoryAliasBundle\RepositoryAliasBundle(),
        ...
    }
}

Example

config.yml

repository_alias:
    repository_key: "project.repo"
	repository:
		blogpost: AcmeBundle:Blog\Post
		blogcomment: AcmeBundle:Blog\Comment

Instead of:

$repo = $this->getDoctrine()->getRepository('AcmeBundle:Blog\Post');
$post = new Acme\AcmeBundle\Blog\Post('title', 'post', $author);

Use:

$repo = $this->get('project.repo.blogpost'); //Note repository_key "project.repo" usage.
$post = $this->get('project.repo.blogpost')->newEntity('title', 'post', $author);

ChangeLog

v0.1.3

  • Added getOriginalRepository decorator. Useful while configuring repos thru di container

v0.1.2

  • Added getAliasFor() method

v0.1.1

  • Added backloop interface

v0.1.0

  • Initial version
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor