Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: Professional PHP Design Patterns
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional PHP Design Patterns
This is the forum to discuss the Wrox book Professional PHP Design Patterns by Aaron Saray ISBN: 978-0-470-49670-1
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional PHP Design Patterns section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 8th, 2010, 09:26 PM
Registered User
 
Join Date: Jun 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Qns regarding Builder Pattern example

With reference to productBuilder class in page 35, i wonder what does the statement
Code:
$this->_xml = $configs;
do?

or should the build() method be

Code:
public function build(){
 $this->_product->setSize($this->_xml['size']);
 $this->_product->setType($this->_xml['type']);
 $this->_product->setColor($this->_xml['color']);
}
instead?
Reply With Quote
  #2 (permalink)  
Old January 10th, 2010, 01:59 PM
Wrox Author
Points: 118, Level: 2
Points: 118, Level: 2 Points: 118, Level: 2 Points: 118, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2009
Location: Milwaukee, WI
Posts: 15
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Hey - great catch. The example should be the following code:

PHP Code:
class productBuilder
{
    protected 
$_product NULL;
    protected 
$_configs = array();

    public function 
__construct($configs)
    {
        
$this->_product = new product();
        
$this->_configs $configs;
    }

    public function 
build()
    {
        
$this->_product->setSize($this->_configs['size']);
        
$this->_product->setType($this->_configs['type']);
        
$this->_product->setColor($this->_configs['color']);
    }

    public function 
getProduct()
    {
        return 
$this->_product;
    }

Sorry for any confusion. Thanks so much!
__________________
-aaron
--
aaronsaray.com || <-- yeah... try it.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Platform Builder and C# Bill_Thompson C# 2005 0 January 21st, 2009 08:26 PM
course builder youyou_hym Dreamweaver (all versions) 1 May 28th, 2008 03:09 AM
Command Builder BSkelding ASP.NET 1.0 and 1.1 Professional 3 April 18th, 2005 12:03 PM
DirectoryInfo.GetFiles(pattern): search pattern fo arif_1947 VS.NET 2002/2003 1 October 19th, 2004 11:59 PM



All times are GMT -4. The time now is 06:07 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.