PHPackages                             ev/ev-copy-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. ev/ev-copy-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

ev/ev-copy-bundle
=================

This is a Symfony Bundle helps you to copy an entity

v1.4(2y ago)512.1k1MITPHPPHP &gt;=5.4.0

Since Jun 10Pushed 2y ago2 watchersCompare

[ Source](https://github.com/evalandgo/EVCopyBundle)[ Packagist](https://packagist.org/packages/ev/ev-copy-bundle)[ Docs](http://github.com/evalandgo/EVCopyBundle)[ RSS](/packages/ev-ev-copy-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (1)Versions (6)Used By (0)

EVCopyBundle
============

[](#evcopybundle)

This is a Symfony Bundle helps you to copy an entity with its dependencies

Features
--------

[](#features)

- Easily configure the copying behavior of entities

Installation
------------

[](#installation)

In composer.json file, add :

```
{
    "require": {
        "ev/ev-copy-bundle": "^1.2"
    }
}
```

In app/AppKernel.php file, add :

```
public function registerBundles()
{
    return array(
        // ...
        new EV\CopyBundle\EVCopyBundle(),
        // ...
    );
}
```

Entity configuration
--------------------

[](#entity-configuration)

### Annotations

[](#annotations)

- **@Copy\\Simple** : Takes the value and adding to the copy
- **@Copy\\Variable** : Set the value based on parameters given to Cloner

    Required attributes:

    - **name**
- **@Copy\\Collection** : Copy each entity of collection

    Optional attributes:

    - **memorizeMatching** : Enable the matching memory and define a name of the memory bag
- **@Copy\\Entity** : Copy the entity
- **@Copy\\UseMatching** : Takes an entity copied previously. It uses the matching memory system

    Required attributes:

    - **name** : Name of the memory bag
- **@Copy\\Construct** : Gives parameters to the constructor based on parameters given to Cloner

    Required attributes:

    - **variables** : Array of parameters

### Example

[](#example)

```
namespace EV\BlogBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use EV\CopyBundle\Annotation as Copy;

class Article
{

    /**
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @ORM\Column(name="title", type="string", length=255)
     * @Copy\Variable(name="articleTitle")
     */
    private $title;

    /**
     * @ORM\Column(name="content", type="text")
     * @Copy\Simple
     */
    private $content;

    /**
     * @ORM\Column(name="date", type="datetime")
     */
    private $date;

    /**
     * @ORM\OneToOne(targetEntity="EV\BlogBundle\Entity\Options", cascade={"persist","remove"})
     * @ORM\JoinColumn(name="optionsId", referencedColumnName="id")
     * @Copy\Entity
     */
    private $options;

    /**
     * @ORM\ManyToOne(targetEntity="EV\BlogBundle\Entity\Author", inversedBy="articles")
     * @ORM\JoinColumn(name="authorId", referencedColumnName="id", nullable=false)
     * @Copy\Simple
     */
    private $author;

    /**
     * @ORM\OneToMany(targetEntity="EV\BlogBundle\Entity\Comment", mappedBy="article", cascade={"persist"})
     * @Copy\Collection
     */
    private $comments

    /**
     * @ORM\ManyToOne(targetEntity="EV\BlogBundle\Entity\Blog", inversedBy="articles")
     * @ORM\JoinColumn(name="blogId", referencedColumnName="id", onDelete="cascade")
     */
    protected $blog;

    /**
     * @Copy\Construct(variables={"blog"})
     */
    public function __construct(Blog $blog)
    {
        $this->blog = $blog;
        $this->date = new \DateTime('now');
    }

    // Getters, Setters and Adders methods...

    public function addComment(\EV\BlogBundle\Entity\Comment $comment)
    {
        $this->comments[] = $comment;

        // IMPORTANT : without this line, the copy won't work
        $comment->setArticle($this);

        return $this;
    }

}
```

```
namespace EV\BlogBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use EV\CopyBundle\Annotation as Copy;

class Comment
{

    /**
     * @ORM\Column(name="pseudo", type="string", length=255)
     * @Copy\Simple
     */
    $pseudo;

    /**
     * @ORM\Column(name="content", type="text")
     * @Copy\Simple
     */
    $content;

    /**
     * @ORM\ManyToOne(targetEntity="EV\BlogBundle\Entity\Article", inversedBy="comments")
     * @ORM\JoinColumn(name="articleId", referencedColumnName="id", nullable=false)
     */
    protected $article;

    // Getters, Setters and Adders methods...

}
```

Usage example
-------------

[](#usage-example)

```
public function articleCopyAction() {

    //...

    $params = array(
        'blog' => $blog,
        'articleTitle' => $article->getTitle().' - Copy'
    );

    $articleCopy = $this->get('ev_copy.factory.cloner')->copy($article, $params);

    //...

}
```

Future features
---------------

[](#future-features)

- Add an annotation in order to condition the copy of a parameter
- Define an order to copy parameters

How to contribute
-----------------

[](#how-to-contribute)

To contribute just open a Pull Request with your new code taking into account that if you add new features or modify existing ones you have to document in this README what they do.

License
-------

[](#license)

EVCopyBundle is licensed under [MIT](https://github.com/evalandgo/EVCopyBundle/blob/master/LICENSE)

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 91.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~784 days

Total

5

Last Release

903d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b5e15ef6030922e0d03c811ace7991a80b92fe9ef1570ae771e2d64d9d42d468?d=identicon)[evalandgo](/maintainers/evalandgo)

---

Top Contributors

[![micka130](https://avatars.githubusercontent.com/u/3065592?v=4)](https://github.com/micka130 "micka130 (11 commits)")[![plandolt](https://avatars.githubusercontent.com/u/922919?v=4)](https://github.com/plandolt "plandolt (1 commits)")

---

Tags

bundleclonedoctrinecopyentityentitiescloner

### Embed Badge

![Health badge](/badges/ev-ev-copy-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/ev-ev-copy-bundle/health.svg)](https://phpackages.com/packages/ev-ev-copy-bundle)
```

###  Alternatives

[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[fresh/doctrine-enum-bundle

Provides support of ENUM type for Doctrine2 in Symfony applications.

4747.0M12](/packages/fresh-doctrine-enum-bundle)[omines/datatables-bundle

Symfony DataTables Bundle with native Doctrine ORM, Elastica and MongoDB support

2841.5M6](/packages/omines-datatables-bundle)[ahmed-bhs/doctrine-doctor

Runtime analysis tool for Doctrine ORM integrated into Symfony Web Profiler. Unlike static linters, it analyzes actual query execution at runtime to detect performance bottlenecks, security vulnerabilities, and best practice violations during development with real execution context and data.

9410.8k](/packages/ahmed-bhs-doctrine-doctor)[rtxlabs/datatransformation-bundle

Provides mappers for generate complex JSON outputs from entities

131.5k](/packages/rtxlabs-datatransformation-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
