#5781: Model::set Bug / Issue
-----------------------------------------------------+----------------------
    Reporter:  redcomet                              |         Owner:  
mark_story
        Type:  Bug                                   |        Status:  closed   
 
    Priority:  Low                                   |     Milestone:  1.2.x.x  
 
   Component:  Model                                 |       Version:  RC3      
 
    Severity:  Minor                                 |    Resolution:  invalid  
 
    Keywords:  set,keys,schema,model,beforevalidate  |   Php_version:  PHP 5    
 
Cake_version:                                        |  
-----------------------------------------------------+----------------------
Comment (by redcomet):

 Ah you are right the latest release of RC3 the file has been fixed.  I
 downloaded RC3 a couple weeks ago and it seems the package was updated
 since then.

 Here is the header information from both files I have

 Old:
 {{{
 /* SVN FILE: $Id: model.php 7296 2008-06-27 09:09:03Z gwoo $ */
 /**
  * Object-relational mapper.
  *
  * DBO-backed object data model, for mapping database tables to Cake
 objects.
  *
  * PHP versions 5
  *
  * CakePHP(tm) :  Rapid Development Framework <http://www.cakephp.org/>
  * Copyright 2005-2008, Cake Software Foundation, Inc.
  *                                                              1785 E.
 Sahara Avenue, Suite 490-204
  *                                                              Las Vegas,
 Nevada 89104
  *
  * Licensed under The MIT License
  * Redistributions of files must retain the above copyright notice.
  *
  * @filesource
  * @copyright           Copyright 2005-2008, Cake Software Foundation,
 Inc.
  * @link
 http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
  * @package                     cake
  * @subpackage          cake.cake.libs.model
  * @since                       CakePHP(tm) v 0.10.0.0
  * @version                     $Revision: 7296 $
  * @modifiedby          $LastChangedBy: gwoo $
  * @lastmodified        $Date: 2008-06-27 02:09:03 -0700 (Fri, 27 Jun
 2008) $
  * @license                     http://www.opensource.org/licenses/mit-
 license.php The MIT License
  */
 }}}

 New:
 {{{
 /* SVN FILE: $Id: model.php 7690 2008-10-02 04:56:53Z nate $ */
 /**
  * Object-relational mapper.
  *
  * DBO-backed object data model, for mapping database tables to Cake
 objects.
  *
  * PHP versions 5
  *
  * CakePHP(tm) :  Rapid Development Framework <http://www.cakephp.org/>
  * Copyright 2005-2008, Cake Software Foundation, Inc.
  *                                                              1785 E.
 Sahara Avenue, Suite 490-204
  *                                                              Las Vegas,
 Nevada 89104
  *
  * Licensed under The MIT License
  * Redistributions of files must retain the above copyright notice.
  *
  * @filesource
  * @copyright           Copyright 2005-2008, Cake Software Foundation,
 Inc.
  * @link
 http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
  * @package                     cake
  * @subpackage          cake.cake.libs.model
  * @since                       CakePHP(tm) v 0.10.0.0
  * @version                     $Revision: 7690 $
  * @modifiedby          $LastChangedBy: nate $
  * @lastmodified        $Date: 2008-10-02 00:56:53 -0400 (Thu, 02 Oct
 2008) $
  * @license                     http://www.opensource.org/licenses/mit-
 license.php The MIT License
  */
 }}}

 I guess it is possible that when I uploaded the new cake version this file
 was not overwritten for some reason, looking at the dates I would think
 so, but the version.txt I have on the server shows the latest 1.2.0.7692
 RC3 so maybe I am just going crazy.

 And the set function I was referring to was this

 {{{
            function set($one, $two = null) {
                 if (!$one) {
                         return;
                 }
                 if (is_object($one)) {
                         $one = Set::reverse($one);
                 }

                 if (is_array($one)) {
                         $data = $one;
                         if (empty($one[$this->alias])) {
                                 $keys = array_keys($one);

                                 if (in_array($keys[0],
 array_keys($this->_schema))) {
                                         $data = array($this->alias =>
 $one);
                                 }

                         }
                 } else {
                         $data = array($this->alias => array($one =>
 $two));
                 }

                 foreach ($data as $n => $v) {
                         if (is_array($v)) {

                                 foreach ($v as $x => $y) {
                                         if
 (isset($this->validationErrors[$x])) {
                                                 unset
 ($this->validationErrors[$x]);
                                         }

                                         if ($n === $this->alias) {
                                                 if ($x ===
 $this->primaryKey) {
                                                         $this->id = $y;
                                                 }
                                         }
                                         if (is_array($y) || is_object($y))
 {
                                                 $y =
 $this->deconstruct($x, $y);
                                         }
                                         $this->data[$n][$x] = $y;
                                 }
                         }
                 }
                 return $data;
         }
 }}}

 So I dont know if someone pulled a fast one and fixed it right after I
 downloaded it or if this ticket helped that along at all but I am glad
 that it works now.  Thanks for your time.

-- 
Ticket URL: <https://trac.cakephp.org/ticket/5781#comment:5>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets cakephp" 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.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to