<?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"
	>
<channel>
	<title>Comments on: ActiveRecord Angst&#8230; ReActivated.</title>
	<atom:link href="http://mademedia.co.uk/2006/03/04/activerecord-angst-reactivated/feed/" rel="self" type="application/rss+xml" />
	<link>http://mademedia.co.uk/2006/03/04/activerecord-angst-reactivated/</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Fri, 21 Nov 2008 11:39:05 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Peter</title>
		<link>http://mademedia.co.uk/2006/03/04/activerecord-angst-reactivated/#comment-24910</link>
		<dc:creator>Peter</dc:creator>
		<pubDate>Tue, 30 Oct 2007 19:29:19 +0000</pubDate>
		<guid isPermaLink="false">http://madeblog.dev.mmnet.co.uk/?p=19#comment-24910</guid>
		<description>Thanks for this class. It's pretty handy (compared to the other ActiveRecord implementations out there for PHP 4). I made a tweak to the populate method, to handle date and datetime fields, so I thought I'd share:

	function populate($arrVals)
	{
		if( is_array($arrVals) )
		{
			$table = MyActiveRecord::Class2Table(get_class($this));
			
			foreach($arrVals as $key=&#62;$val)
			{
				if(MyActiveRecord::GetType($table, $key) == 'datetime')
				{
					$this-&#62;set_datetime($key, MyActiveRecord::TimeStamp($val));
				}
				else if(MyActiveRecord::GetType($table, $key) == 'date')
				{
					$this-&#62;set_date($key, MyActiveRecord::TimeStamp($val));
				}
				else
				{
					$this-&#62;$key=$val;
				}	
			}
			return true;
		}
		else
		{
			return false;
		}
	}</description>
		<content:encoded><![CDATA[<p>Thanks for this class. It&#8217;s pretty handy (compared to the other ActiveRecord implementations out there for PHP 4). I made a tweak to the populate method, to handle date and datetime fields, so I thought I&#8217;d share:</p>
<p>function populate($arrVals)<br />
{<br />
if( is_array($arrVals) )<br />
{<br />
$table = MyActiveRecord::Class2Table(get_class($this));</p>
<p>foreach($arrVals as $key=>$val)<br />
{<br />
if(MyActiveRecord::GetType($table, $key)  'datetime')</p>
<p>				{<br />
					$this-&gt;set_datetime($key, MyActiveRecord::TimeStamp($val));<br />
				}<br />
				else if(MyActiveRecord::GetType($table, $key)  &#8216;date&#8217;)<br />
{<br />
$this->set_date($key, MyActiveRecord::TimeStamp($val));<br />
}<br />
else<br />
{<br />
$this->$key=$val;<br />
}<br />
}<br />
return true;<br />
}<br />
else<br />
{<br />
return false;<br />
}<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>
