<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Thu, 20 Nov 2008 11:17:21 -0600</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[AskAboutPHP.com: CodeIgniter: Extending the native 'Model' and make it your own.]]></title>
      <guid>http://www.phpdeveloper.org/news/11394</guid>
      <link>http://www.phpdeveloper.org/news/11394</link>
      <description><![CDATA[<p>
The AskAboutPHP.com blog has <A href="http://www.askaboutphp.com/beginners/50/codeigniter-extending-the-native-model-and-make-it-your-own.html">posted a helpful new tutorial</a> for those using <a href="http://www.codeigniter.org">CodeIgniter</a> out there - how to extend the native Model class to bend it to your will.
</p>
<blockquote>
I'm in the process of creating models for my CI project, and realized that certain functions within the models were getting repetitive. Using CI's ability to create my own custom libraries, I was able to create my own custom 'Model' which extends from the core 'Model' object. How this simple architecture has cleaned up my code is simply remarkable.
</blockquote>
<p>
Rather than overwriting the main Model.php file with some of your own changes, he suggests creating a new library, a "parent model" that can be extended instead to provide some common functions that all of your application's models might need. For something a bit more complex, he also points to <A href="http://www.phpfour.com/blog/2008/07/12/extended-model-for-codeigniter/">this library</a> that extends the models to give it CakePHP-like functionality.
</p>]]></description>
      <pubDate>Wed, 12 Nov 2008 09:31:24 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Jani Hartikainen's Blog: Understanding Doctrine's NestedSet feature]]></title>
      <guid>http://www.phpdeveloper.org/news/10943</guid>
      <link>http://www.phpdeveloper.org/news/10943</link>
      <description><![CDATA[<p>
On his CodeUtopia blog <i>Jani Hartikainen</i> gives an <a href="http://codeutopia.net/blog/2008/08/30/understanding-doctrines-nestedset-feature/">inside look</a> at a feature of Doctrine, nested sets.
</p>
<blockquote>
The Doctrine library comes with a feature called nested set, which makes saving trees in a database easy. However, it's quite easy to accidentally cause a lot of extra unneeded queries if not being careful. Here are some pointers to keep in mind while working with the nested set, and some example queries to make understanding it easier.
</blockquote>
<p>
He gives an example, showing how to get rows from the database - parent and child - and some optimization tips to keep things light. There's also some pros and cons included for doing it either way (the standard fetching or using the more optimized versions).
</p>]]></description>
      <pubDate>Tue, 02 Sep 2008 10:29:56 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Daniel Cousineau's Blog: Displaying N-Deep Trees (Remember Your Algorithms Course?)]]></title>
      <guid>http://www.phpdeveloper.org/news/10784</guid>
      <link>http://www.phpdeveloper.org/news/10784</link>
      <description><![CDATA[<p>
On his Tower of Power blog <i>Daniel Cousineau</i> has <a href="http://www.toosweettobesour.com/2008/08/05/displaying-n-deep-trees-remember-your-algorithms-course/">written up a look</a> at using a more detailed categorization method than just a parent/child relationship on your data - <a href="http://en.wikipedia.org/wiki/Tree_traversal">Tree Traversals</a>.
</p>
<blockquote>
If the software calls for only 2 levels of categorization (Parent and Child only), a simple nested for loop will suffice. However, software requirements change and you'll soon find yourself up shit creek without a paddle if you need to support 3 or 4 levels of nesting. [...] To those who's training is less formal (most web developers I meet have practical training, not formal), I'll help you out: <a href="http://en.wikipedia.org/wiki/Tree_traversal">Tree Traversals</a> (or if you are completely lost, <a href="http://en.wikipedia.org/wiki/Recursion">Recursion</a>).
</blockquote>
<p>
He creates a recursive function that, when passed in a category set with different types in it, can handle each of them and then calls itself again with the new child data. His sample code creates url out of a set of categories.
</p>]]></description>
      <pubDate>Thu, 07 Aug 2008 12:03:23 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Mike Lively's Blog: Late Static Binding (LSB) forward_static_call()]]></title>
      <guid>http://www.phpdeveloper.org/news/9939</guid>
      <link>http://www.phpdeveloper.org/news/9939</link>
      <description><![CDATA[<p>
On his blog, <i>Mike Lively</i> has <a href="http://www.ds-o.com/archives/69-Late-Static-Binding-LSB-forward_static_call.html">posted a look</a> at some of the work he's been doing on patches for the late static binding functionality to be included in PHP, including an example of the updates in action.
</p>
<blockquote>
This weekend I wrapped up a few small tests and sent the patch in and it was subsequently pushed to <a href="http://www.ds-o.com/exit.php?url_id=193&entry_id=69">php 5.3 and php 6.0</a>. Now, this is not at all the way I wanted things to work, in all honesty I think the patch is pretty hokey but unfortunately nobody really spoke up in support of the changes I wanted to make to parent:: in regards to LSB.
</blockquote>
<p>
His example shows how to override a static method and push that new method's execution to the parent class (in two ways - safe using forward_static_call and the not so safe calling itself with a parent:: override).
</p>]]></description>
      <pubDate>Wed, 09 Apr 2008 11:24:19 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Arnold Daniels' Blog: A dark corner of PHP: class casting]]></title>
      <guid>http://www.phpdeveloper.org/news/9670</guid>
      <link>http://www.phpdeveloper.org/news/9670</link>
      <description><![CDATA[<p>
In <a href="http://blog.adaniels.nl/articles/a-dark-corner-of-php-class-casting/">this blog entry</a> <i>Arnold Daniels</i> talks about an issue he had in the past (needing a bit more functionality than the <a href="http://pear.php.net/package/DB">PEAR DB library</a> could offer) and how he ended up solving it with what he calls a "dark corner" of PHP - class casting.
</p>
<blockquote>
PHP has a function serialize, which can create a hash from any type of variable, scalars, array, but objects as well. Using the unserialize function, PHP can recreate the variable from the serialized hashed. If we look at how an object is serialized, we see only the properties and the class name are stored.
</blockquote>
<p>
<a href="http://blog.adaniels.nl/articles/a-dark-corner-of-php-class-casting/">His method</a> allows for class manipulation via changes to the serialized class information (like changing the value of the name parameter). His "casttoclass()" function makes changing this value simple.
</p>]]></description>
      <pubDate>Wed, 20 Feb 2008 12:08:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Mike Lively's Blog: Late Static Binding - Changes to parent]]></title>
      <guid>http://www.phpdeveloper.org/news/9112</guid>
      <link>http://www.phpdeveloper.org/news/9112</link>
      <description><![CDATA[<p>
<i>Mike Lively</i> has <a href="http://www.ds-o.com/archives/68-Late-Static-Binding-Changes-to-parent.html">shared some of his thoughts</a> on the late static binding functionality that will be in the upcoming PHP 5.3 - specifically the relationships of parents and children it has.
</p>
<blockquote>
I won't rehash all of the arguments as you can quite easily find out my full thoughts by previous posts and on that mailing list thread. To put it simply I feel that somehow there needs to be a way to call methods in a parent class without losing the ability to reference back to the original called static.
</blockquote>
<p>
He gives an example of what he's talking about (code) and, to help further his cause he's <a href="http://www.ds-o.com/exit.php?url_id=185&entry_id=68">created</a> <a href="http://www.ds-o.com/exit.php?url_id=186&entry_id=68">three</a> <a href="http://www.ds-o.com/exit.php?url_id=187&entry_id=68">patches</a> to make it work how he'd like.
</p>]]></description>
      <pubDate>Mon, 26 Nov 2007 09:37:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Paul Jones' Blog: Memory Leaks With Objects in PHP 5]]></title>
      <guid>http://www.phpdeveloper.org/news/8746</guid>
      <link>http://www.phpdeveloper.org/news/8746</link>
      <description><![CDATA[<p>
<i>Paul Jones</i> <a href="http://paul-m-jones.com/blog/?p=262">presents a problem</a> he was having in a new post to his blog - the issue was with memory leaks in objects in a PHP5 application he was working on.
</p>
<blockquote>
One of the nice things about using a scripting language is that it automates garbage collection for you. You don't have to worry about releasing memory when you're done with your variables. [...] But there is at least one circumstance in which PHP will not free memory for you when you call unset(). Cf. <a href="http://bugs.php.net/bug.php?id=33595">http://bugs.php.net/bug.php?id=33595</a>.
</blockquote>
<p>
The <a href="http://paul-m-jones.com/blog/?p=262">problem</a> is that, when trying to unset the parent object in a parent/child relationship, the memory space for the parent reference in the child isn't removed. The problem, left unchecked can cause a script to go over the memory limit pretty easily (especially with larger objects).
</p>
<p>
He suggests two solutions - one that the user can control (calling a destructor before unsetting the object) or a PHP internals method that involves fixing issues with the reference counts created with the objects.
</p>]]></description>
      <pubDate>Fri, 28 Sep 2007 08:46:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Mike Lively's Blog: Late static binding....sorta :/]]></title>
      <guid>http://www.phpdeveloper.org/news/8741</guid>
      <link>http://www.phpdeveloper.org/news/8741</link>
      <description><![CDATA[<p>
<i>Mike Lively</i> is happy about one thing - that late static binding (<a href="http://www.colder.ch/news/08-24-2007/28/late-static-bindings-expl.html">definition</a>) has been committed and will be included with PHP 5.3. Unfortunately, <a href="http://www.ds-o.com/archives/65-Late-static-binding....sorta.html">he has a downside too</a>:
</p>
<blockquote>
The good news is late static binding has been introduced into head and looks like it will be merged into 5.3 before it is released. The horrible news is I really don't think the patch went as far as it needs to.
</blockquote>
<p>
He talks about the original intention of the functionality (flexible inheritance for static methods/properties/constants) and how it was implemented, but with one small issue - that "static will ALWAYS return the 'resolved' name of the class used to call the current function". He illustrates with a code example showing an extended class returning a static property.
</p>
<p>
He also mentions two suggestions to help fix this issue:
</p>
<ul>
<li>setting the behavior of parent:: such that it forwards the calling class through the next function call.
<li>introducing another scope [...] using a new keyword so parent:: could remain the same
</ul>]]></description>
      <pubDate>Thu, 27 Sep 2007 12:58:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[WebReference.com: Class Inheritance with PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/8637</guid>
      <link>http://www.phpdeveloper.org/news/8637</link>
      <description><![CDATA[<p>
WebReference.com has a <a href="http://www.webreference.com/programming/php/class_inherit/index.html">new tutorial</a> posted today (from <i>Kris Hadlock</i>) concerning the class inheritance functionlaity that's a part of the object oriented structure in PHP:
</p>
<blockquote>
There are many benefits of inheritance with PHP, the most common is simplifying and reducing instances of redundant code. Class inheritance may sound complicated, but think of it this way. Consider a tree. A tree is made up of many parts, such as the roots that reside in the ground, the trunk, bark, branches, leaves, etc. Essentially inheritance is a connection between a child and its parent. [...] This article assumes a basic understanding of OOP with PHP.
</blockquote>
<p>
They show how to <a href="http://www.webreference.com/programming/php/class_inherit/index.html">create the parent object</a> as a base and how to inherit it into a child class - using the extend keyword in the class definition. They give an example of their sample code in action so you can see how the inheritance is handled. 
</p>]]></description>
      <pubDate>Wed, 12 Sep 2007 09:38:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Lukas Smith's Blog: Its the end of the world as we know it.]]></title>
      <guid>http://www.phpdeveloper.org/news/8334</guid>
      <link>http://www.phpdeveloper.org/news/8334</link>
      <description><![CDATA[<p>
In <a href="http://pooteeweet.org/blog/811">a post</a> from <i>Lukas Smith</i>, he gives responses to some of the questions/comments people have to say about PHP, specifically in how it's related to Java.
</p>
<blockquote>
Whenever someone asks me why PHP is more "agile" than Java, I tell them that in PHP you can break most of the rules your comp sci course told you about and get away with it. Of course this means that you need PHP developers to constantly clean up their code.
</blockquote>
<p>
He <a href="http://pooteeweet.org/blog/811">talks about rules</a> for developing in PHP, one being not to change a method so make it incompatible with its parent. He recommends one way to avoid this - the E_STRICT warning to protect against possible conflicts and issues (the same kind of functionality in PHP6 is in E_FATAL though).
</p>
<blockquote>
Please, lets get the sense back here. Lets not make things that are not fatal an E_FATAL. Lets use E_STRICT for the pedantic, lets add a E_DEPRECATED for all things deprecated. Lets not kill what makes PHP more agile than those other languages that think they know what I should be spending my time on.
</blockquote>]]></description>
      <pubDate>Thu, 26 Jul 2007 08:44:00 -0500</pubDate>
    </item>
  </channel>
</rss>
