<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Sat May 25 18:06:50 UTC 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://www.doctrine-project.org/jira/si/jira.issueviews:issue-xml/DDC-2163/DDC-2163.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Doctrine Project</title>
    <link>http://www.doctrine-project.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>5.2.7</version>
        <build-number>850</build-number>
        <build-date>21-02-2013</build-date>
    </build-info>

<item>
            <title>[DDC-2163] Export entity data to array and create new entity by this array</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2163</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Entity serialization is really pain operation for doctrine2 entities, but why we need serialization? If we may just get array of table&apos;s row for entity and store this array anywhere!&lt;/p&gt;

&lt;p&gt;For example, we have Entity:&lt;/p&gt;

&lt;p&gt;id, category_id, title&lt;/p&gt;

&lt;p&gt;(where category_id is many to one to Category entity)&lt;/p&gt;

&lt;p&gt;If we will able to get just array from entity like&lt;br/&gt;
array(&lt;br/&gt;
    &apos;id&apos; =&amp;gt; 1,&lt;br/&gt;
    &apos;category_id&apos; =&amp;gt; 2,&lt;br/&gt;
    &apos;title&apos; =&amp;gt; &apos;Some title&apos;&lt;br/&gt;
)&lt;br/&gt;
That&apos;s all!&lt;/p&gt;

&lt;p&gt;I look at code and find a place where table row converted to object: &lt;a href=&quot;https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php#L341&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php#L341&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This method is protected, so we can&apos;t call it directly. Can we change it to public?&lt;/p&gt;

&lt;p&gt;Another question how we can get this raw values array from entity. I found method &lt;a href=&quot;https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/UnitOfWork.php#L2692&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/UnitOfWork.php#L2692&lt;/a&gt; but it return data with related entities.&lt;/p&gt;</description>
                <environment></environment>
            <key id="14260">DDC-2163</key>
            <summary>Export entity data to array and create new entity by this array</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="2">Won&apos;t Fix</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="wiistriker">Anton</reporter>
                        <labels>
                        <label>serialize</label>
                    </labels>
                <created>Fri, 23 Nov 2012 00:38:50 +0000</created>
                <updated>Tue, 27 Nov 2012 07:00:44 +0000</updated>
                    <resolved>Fri, 23 Nov 2012 08:28:30 +0000</resolved>
                                                                    <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="19033" author="wiistriker" created="Fri, 23 Nov 2012 02:39:45 +0000"  >&lt;p&gt;i write some weird code: &lt;a href=&quot;http://stackoverflow.com/questions/13507300/doctrine2-export-entity-to-array/13522452#13522452&quot; class=&quot;external-link&quot;&gt;http://stackoverflow.com/questions/13507300/doctrine2-export-entity-to-array/13522452#13522452&lt;/a&gt;&lt;br/&gt;
please, take a look.&lt;/p&gt;</comment>
                    <comment id="19034" author="ocramius" created="Fri, 23 Nov 2012 08:25:18 +0000"  >&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=wiistriker&quot; class=&quot;user-hover&quot; rel=&quot;wiistriker&quot;&gt;Anton&lt;/a&gt; the namespace `Internal` is there for a reason. If you want to convert entities to array or the opposite, please use either JMS Serializer, Symfony Serializer or Zend\StdLib\Hydrator with DoctrineModule\StdLib\Hydrator.&lt;/p&gt;

&lt;p&gt;Currently, we don&apos;t support serialization&lt;/p&gt;</comment>
                    <comment id="19035" author="ocramius" created="Fri, 23 Nov 2012 08:28:30 +0000"  >&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=wiistriker&quot; class=&quot;user-hover&quot; rel=&quot;wiistriker&quot;&gt;Anton&lt;/a&gt; this is not the correct approach to the problem. Serialization/unserialization is a problem related to (probably) Doctrine\Common.&lt;/p&gt;</comment>
                    <comment id="19067" author="wiistriker" created="Tue, 27 Nov 2012 07:00:44 +0000"  >&lt;p&gt;Marco Pivetta, thanks for reply. With JMSSerializer or Symfony serializer can i later insert\update object in db? I see in sources, that UnitOfWork get changeset for each entity. How doctrine2 knows which properties of serialized\deserialized entitiy was changed?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>