Skip to content

Latest commit

 

History

History
executable file
·
37 lines (26 loc) · 1.56 KB

README.md

File metadata and controls

executable file
·
37 lines (26 loc) · 1.56 KB

Kdyby/DoctrineCollectionsReadonly

This package provides an implementation of a readonly collection wrapper, so you can return collections from your entities, without having to copy the contents of the collection, or exposing the object's state outside of it's control.

Build Status Downloads this Month Latest stable Coverage Status

Installation

The best way to install Kdyby/DoctrineCollectionsReadonly is using Composer:

$ composer require kdyby/doctrine-collections-readonly

Usage

Simply wrap your collection and return it.

public function getComments() : Collection
{
	return new ReadOnlyCollectionWrapper($this->comments);
}

Now you can use the Collection api as you're used to, you just cannot modifying it :)


Homepage http://www.kdyby.org and repository http://github.com/Kdyby/DoctrineCollectionsReadonly.