Weave 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.
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator