<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Sat May 25 00:29:07 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-1955/DDC-1955.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-1955] Support for @EntityListeners</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1955</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Support for @EntityListeners&lt;/p&gt;

&lt;p&gt;Now subscribers are called for ALL entities, to increase the performance we should allow the configuration listeners for entities that need them.&lt;/p&gt;

&lt;p&gt;The @EntityListeners annotation specifies the callback listener classes to be used for an entity or mapped superclass. The @EntityListeners annotation may be applied to an entity class or mapped superclass.&lt;/p&gt;

&lt;p&gt;The listenner callbacks methods are annotated by the current callback annotations (@PreUpdate, @PrePersist, etc...)&lt;/p&gt;

&lt;p&gt;Example : &lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
/**
 * @EntityListeners({&lt;span class=&quot;code-quote&quot;&gt;&quot;ContractSubscriber&quot;&lt;/span&gt;})
 */
class CompanyContract
{
}

class ContractSubscriber
{
    /**
     * @PrePersist
     */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function prePersistHandler(CompanyContract $contract)
    {
        &lt;span class=&quot;code-comment&quot;&gt;// &lt;span class=&quot;code-keyword&quot;&gt;do&lt;/span&gt; something
&lt;/span&gt;    }

    /**
     * @PostPersist
     * Most of cases just the entity is needed.
     * as a second parameter LifecycleEventArgs allow access to the entity manager.
     */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function postPersistHandler(CompanyContract $contract, LifecycleEventArgs $args)
    {
        &lt;span class=&quot;code-comment&quot;&gt;// &lt;span class=&quot;code-keyword&quot;&gt;do&lt;/span&gt; something
&lt;/span&gt;    }
}

$contract = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; CompanyFlexContract();
&lt;span class=&quot;code-comment&quot;&gt;// &lt;span class=&quot;code-keyword&quot;&gt;do&lt;/span&gt; something
&lt;/span&gt;
$em-&amp;gt;persist($contract);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="13893">DDC-1955</key>
            <summary>Support for @EntityListeners</summary>
                <type id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/newfeature.png">New Feature</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/resolved.png">Resolved</status>
                    <resolution id="1">Fixed</resolution>
                    <security id="10000">All</security>
                        <assignee username="fabio.bat.silva">Fabio B. Silva</assignee>
                                <reporter username="fabio.bat.silva">Fabio B. Silva</reporter>
                        <labels>
                    </labels>
                <created>Sun, 29 Jul 2012 15:37:44 +0000</created>
                <updated>Sat, 2 Feb 2013 20:01:07 +0000</updated>
                    <resolved>Sat, 2 Feb 2013 20:01:07 +0000</resolved>
                                            <fixVersion>2.4</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="18416" author="stof" created="Mon, 30 Jul 2012 10:00:25 +0000"  >&lt;p&gt;I don&apos;t see how this could improve performances much: there is only one event manager, so all listeners would be registered in the same. This means that the event manager would then need to contain some checks to know whether the listener should be called for this entity. This means that it will add overhead for &lt;b&gt;all&lt;/b&gt; listeners instead of only in listeners needing to check the entity.&lt;/p&gt;</comment>
                    <comment id="18417" author="ocramius" created="Mon, 30 Jul 2012 10:10:54 +0000"  >&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=stof&quot; class=&quot;user-hover&quot; rel=&quot;stof&quot;&gt;Christophe Coevoet&lt;/a&gt; I think there&apos;s a bit of overhead when calling the event listeners. Btw we could get a huge improvement if the UoW was able to group the operations by entity name. I&apos;m not sure if this already happens.&lt;/p&gt;</comment>
                    <comment id="18418" author="fabio.bat.silva" created="Mon, 30 Jul 2012 14:07:15 +0000"  >&lt;p&gt;Hi guys&lt;/p&gt;

&lt;p&gt;This feature does not change anything on the current event system, just add another way to handle events.&lt;br/&gt;
Actually, the event manager dont filter/group event calls.&lt;br/&gt;
So, the listener implementation must filter which entities accept and process.&lt;/p&gt;

&lt;p&gt;My idea is build something more simple, like lifecycle callbacks instead of use a event manager.&lt;br/&gt;
Grouping the calls in the entity metadata and centralizing the listener instances in a static point.&lt;/p&gt;

&lt;p&gt;It should avoid lots of calls from UoW to notify entities without subscribers.&lt;/p&gt;</comment>
                    <comment id="19456" author="fabio.bat.silva" created="Sat, 2 Feb 2013 20:01:07 +0000"  >&lt;p&gt;fixed : &lt;a href=&quot;https://github.com/doctrine/doctrine2/commit/71a68a5c6fcd49538c3ef2f86d64bcde1958251c&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/commit/71a68a5c6fcd49538c3ef2f86d64bcde1958251c&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>