Uploaded image for project: 'Doctrine 2 - ORM'
  1. Doctrine 2 - ORM
  2. DDC-2163

Export entity data to array and create new entity by this array


    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:


      Entity serialization is really pain operation for doctrine2 entities, but why we need serialization? If we may just get array of table's row for entity and store this array anywhere!

      For example, we have Entity:

      id, category_id, title

      (where category_id is many to one to Category entity)

      If we will able to get just array from entity like
      'id' => 1,
      'category_id' => 2,
      'title' => 'Some title'
      That's all!

      I look at code and find a place where table row converted to object: https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php#L341

      This method is protected, so we can't call it directly. Can we change it to public?

      Another question how we can get this raw values array from entity. I found method https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/UnitOfWork.php#L2692 but it return data with related entities.


        wiistriker Anton created issue -
        ocramius Marco Pivetta made changes -
        Field Original Value New Value
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Won't Fix [ 2 ]


          • Assignee:
            beberlei Benjamin Eberlei
            wiistriker Anton
          • Votes:
            0 Vote for this issue
            3 Start watching this issue


            • Created: