<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>《symfony2实战入门信息录入6:文件上传》的评论</title>
	<atom:link href="http://www.newlifeclan.com/symfony/archives/247/feed" rel="self" type="application/rss+xml" />
	<link>http://www.newlifeclan.com/symfony/archives/247</link>
	<description>站在巨人肩膀上的phpweb框架</description>
	<lastBuildDate>Sun, 16 Sep 2018 07:12:18 +0000</lastBuildDate>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.0.38</generator>
	<item>
		<title>作者：napoleon</title>
		<link>http://www.newlifeclan.com/symfony/archives/247#comment-74</link>
		<dc:creator><![CDATA[napoleon]]></dc:creator>
		<pubDate>Sun, 16 Sep 2018 07:12:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.newlifeclan.com/symfony/?p=247#comment-74</guid>
		<description><![CDATA[你可以试试清除缓存，或者doctrine:schema:update –force
你也可以看看中文站关于这方面的文章
http://www.symfonychina.com/doc/current/doctrine/lifecycle_callbacks.html]]></description>
		<content:encoded><![CDATA[<p>你可以试试清除缓存，或者doctrine:schema:update –force<br />
你也可以看看中文站关于这方面的文章<br />
<a href="http://www.symfonychina.com/doc/current/doctrine/lifecycle_callbacks.html" rel="nofollow">http://www.symfonychina.com/doc/current/doctrine/lifecycle_callbacks.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：davedeng</title>
		<link>http://www.newlifeclan.com/symfony/archives/247#comment-73</link>
		<dc:creator><![CDATA[davedeng]]></dc:creator>
		<pubDate>Wed, 12 Sep 2018 11:19:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.newlifeclan.com/symfony/?p=247#comment-73</guid>
		<description><![CDATA[楼主，您好，我遇到了和leoric一样的问题？经过调试，我发现是因为 @ORM\PrePersist 这些事件没有生效，我用的是symfony2.8,现在还没解决，下面是我的简单的一个demo：

entity中部分代码：

&lt;?php
namespace Nlc\InformationBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
 * @ORM\Entity()
 * @ORM\HasLifecycleCallbacks()
 */
class Adminuser
{
        /**
         * @ORM\PrePersist
        */
       public function test(){
            dump(1);die;
        }
}

controller中部分代码：

getDoctrine()-&gt;getManager();
        $adminuser = new Adminuser();
        $adminuser-&gt;setUsername(&#039;dave&#039;);
        $adminuser-&gt;setPassword(&#039;123&#039;);
        $em-&gt;persist($adminuser);
        $em-&gt;flush();
        return new Response();
    }
}
希望前辈您看到后能回复我一下，谢谢！]]></description>
		<content:encoded><![CDATA[<p>楼主，您好，我遇到了和leoric一样的问题？经过调试，我发现是因为 @ORM\PrePersist 这些事件没有生效，我用的是symfony2.8,现在还没解决，下面是我的简单的一个demo：</p>
<p>entity中部分代码：</p>
<p>&lt;?php<br />
namespace Nlc\InformationBundle\Entity;<br />
use Doctrine\ORM\Mapping as ORM;<br />
/**<br />
 * @ORM\Entity()<br />
 * @ORM\HasLifecycleCallbacks()<br />
 */<br />
class Adminuser<br />
{<br />
        /**<br />
         * @ORM\PrePersist<br />
        */<br />
       public function test(){<br />
            dump(1);die;<br />
        }<br />
}</p>
<p>controller中部分代码：</p>
<p>getDoctrine()-&gt;getManager();<br />
        $adminuser = new Adminuser();<br />
        $adminuser-&gt;setUsername(&#8216;dave&#8217;);<br />
        $adminuser-&gt;setPassword(&#8216;123&#8242;);<br />
        $em-&gt;persist($adminuser);<br />
        $em-&gt;flush();<br />
        return new Response();<br />
    }<br />
}<br />
希望前辈您看到后能回复我一下，谢谢！</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：muscleape</title>
		<link>http://www.newlifeclan.com/symfony/archives/247#comment-61</link>
		<dc:creator><![CDATA[muscleape]]></dc:creator>
		<pubDate>Tue, 11 Oct 2016 01:14:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.newlifeclan.com/symfony/?p=247#comment-61</guid>
		<description><![CDATA[果然，需要更新一下。执行php app/console doctrine:schema:update --force页面就正常了。]]></description>
		<content:encoded><![CDATA[<p>果然，需要更新一下。执行php app/console doctrine:schema:update &#8211;force页面就正常了。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：leoric</title>
		<link>http://www.newlifeclan.com/symfony/archives/247#comment-54</link>
		<dc:creator><![CDATA[leoric]]></dc:creator>
		<pubDate>Thu, 03 Mar 2016 08:06:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.newlifeclan.com/symfony/?p=247#comment-54</guid>
		<description><![CDATA[我自己已经改好了，谢谢楼主的教程！]]></description>
		<content:encoded><![CDATA[<p>我自己已经改好了，谢谢楼主的教程！</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：leoric</title>
		<link>http://www.newlifeclan.com/symfony/archives/247#comment-53</link>
		<dc:creator><![CDATA[leoric]]></dc:creator>
		<pubDate>Thu, 03 Mar 2016 07:26:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.newlifeclan.com/symfony/?p=247#comment-53</guid>
		<description><![CDATA[楼主辛苦了。

从第一篇看到这里，不明白的是 sql语句执行错误了：
INSERT INTO employeetable (name, age, sex, education, photopath, jlpath, createtime, updatetime, categoryid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)

这里 数据库中是photo 和 file,可程序中改成photopath 和jlpath了 这难道要 php bin/console doctrine:schema:update --force？ 

麻烦指点一下，谢谢]]></description>
		<content:encoded><![CDATA[<p>楼主辛苦了。</p>
<p>从第一篇看到这里，不明白的是 sql语句执行错误了：<br />
INSERT INTO employeetable (name, age, sex, education, photopath, jlpath, createtime, updatetime, categoryid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)</p>
<p>这里 数据库中是photo 和 file,可程序中改成photopath 和jlpath了 这难道要 php bin/console doctrine:schema:update &#8211;force？ </p>
<p>麻烦指点一下，谢谢</p>
]]></content:encoded>
	</item>
</channel>
</rss>
