#1681: No way to ask a table which column is the slug
--------------------------+-------------------------------------------------
  Reporter:  popthestack  |       Owner:  guilhermeblanco      
      Type:  defect       |      Status:  reopened             
  Priority:  minor        |   Milestone:                       
 Component:  Sluggable    |     Version:  1.0-DEV              
Resolution:               |    Keywords:  slug                 
  Has_test:  0            |    Mystatus:  Pending Core Response
 Has_patch:  0            |  
--------------------------+-------------------------------------------------
Changes (by Markus.Staab):

  * status:  closed => reopened
  * resolution:  fixed =>

Comment:

 would be nice to have the possiblity when using getters (like getOption in
 this case) to pass a default value to return, when nothing was found.

 this is a common behaviour and also used in a lot of places in the symfony
 framework.

 e.g.


 {{{
 +    public function getOption($name, $default = null)
 +    {
 +        if (isset($this->_options[$name])) {
 +            return $this->_options[$name];
 +        }
 +        return $default;
 +    }
 }}}


 this will save the caller to add an additional if clause, which checks if
 the option is not set.
 also the resulting caller code is more readable.

 compare


 {{{
 $opt = $template->getOption('exampleOption', 'defaultvalue');
 }}}


 against


 {{{
 $opt = $template->getOption('exampleOption');
 if($opt === NULL)
 {
   $opt = 'defaultValue';
 }
 }}}

-- 
Ticket URL: <http://trac.doctrine-project.org/ticket/1681#comment:3>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"doctrine-svn" group.
 To post to this group, send email to [email protected]
 To unsubscribe from this group, send email to [EMAIL PROTECTED]
 For more options, visit this group at 
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---

Reply via email to