cakephp2-php8/cake/libs/model/model.php

1555 lines
44 KiB
PHP
Raw Normal View History

<?php
/* SVN FILE: $Id$ */
/**
* Object-relational mapper.
*
* DBO-backed object data model, for mapping database tables to Cake objects.
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
* Copyright (c) 2005, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2005, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
Merging from sandboxes [1079] Merged [1005] committed by nate but not added to core prior to release. Merged [1078] prior to modifying all developers sandboxes. [1081] adding view and template directories [1082] adding base files for view generator [1083] correcting all package and sub package tags for in doc blocks. Making sure every file in the core has doc block in them [1084] renaming working copy of latest release [1093] Added fix for associations using underscores if var $useTable is set in the associated models. This closes ticket #11. [1094] Fix for Ticket #24. The problem was tracked to a variable in View::_render(); $loadedHelpers was being assigned a reference when it when it should not have been. [1096] Initial work on controller components needs testing. Also added a work around for the basics.php uses(). Using the define DS where the files from the original version are now located in deeper libs directories. [1097] committing a few typos in the code I added [1098] reformatting code in component.php [1104] changed the test route and corrected a regex in inflector. [1111] removing the contructor from dispatcher, it is not needed [1112] Changes made for errors when a file is not present in webroot. Fixed the regex used in Router::parse(). Change the error layout template. [1113] Changes to Folder class to allow setting the permissions mode when constructing. This class needs to be refactored and move everything that is in the contructor out. The constructor should set the vars for use in other Folder::"methods"(). Will work on this at a later time. git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1114 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-09 01:56:21 +00:00
* @subpackage cake.cake.libs.model
* @since CakePHP v 0.10.0.0
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Enter description here...
*/
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
uses('class_registry', 'validators');
/**
* Short description for class
*
Merging from sandboxes [1079] Merged [1005] committed by nate but not added to core prior to release. Merged [1078] prior to modifying all developers sandboxes. [1081] adding view and template directories [1082] adding base files for view generator [1083] correcting all package and sub package tags for in doc blocks. Making sure every file in the core has doc block in them [1084] renaming working copy of latest release [1093] Added fix for associations using underscores if var $useTable is set in the associated models. This closes ticket #11. [1094] Fix for Ticket #24. The problem was tracked to a variable in View::_render(); $loadedHelpers was being assigned a reference when it when it should not have been. [1096] Initial work on controller components needs testing. Also added a work around for the basics.php uses(). Using the define DS where the files from the original version are now located in deeper libs directories. [1097] committing a few typos in the code I added [1098] reformatting code in component.php [1104] changed the test route and corrected a regex in inflector. [1111] removing the contructor from dispatcher, it is not needed [1112] Changes made for errors when a file is not present in webroot. Fixed the regex used in Router::parse(). Change the error layout template. [1113] Changes to Folder class to allow setting the permissions mode when constructing. This class needs to be refactored and move everything that is in the contructor out. The constructor should set the vars for use in other Folder::"methods"(). Will work on this at a later time. git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1114 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-09 01:56:21 +00:00
* DBO-backed object data model.
* Automatically selects a database table name based on a pluralized lowercase object class name
* (i.e. class 'User' => table 'users'; class 'Man' => table 'men')
* The table is required to have at least 'id auto_increment', 'created datetime',
* and 'modified datetime' fields.
*
* @package cake
Merging from sandboxes [1079] Merged [1005] committed by nate but not added to core prior to release. Merged [1078] prior to modifying all developers sandboxes. [1081] adding view and template directories [1082] adding base files for view generator [1083] correcting all package and sub package tags for in doc blocks. Making sure every file in the core has doc block in them [1084] renaming working copy of latest release [1093] Added fix for associations using underscores if var $useTable is set in the associated models. This closes ticket #11. [1094] Fix for Ticket #24. The problem was tracked to a variable in View::_render(); $loadedHelpers was being assigned a reference when it when it should not have been. [1096] Initial work on controller components needs testing. Also added a work around for the basics.php uses(). Using the define DS where the files from the original version are now located in deeper libs directories. [1097] committing a few typos in the code I added [1098] reformatting code in component.php [1104] changed the test route and corrected a regex in inflector. [1111] removing the contructor from dispatcher, it is not needed [1112] Changes made for errors when a file is not present in webroot. Fixed the regex used in Router::parse(). Change the error layout template. [1113] Changes to Folder class to allow setting the permissions mode when constructing. This class needs to be refactored and move everything that is in the contructor out. The constructor should set the vars for use in other Folder::"methods"(). Will work on this at a later time. git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1114 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-09 01:56:21 +00:00
* @subpackage cake.cake.libs.model
* @since CakePHP v 0.2.9
*
*/
class Model extends Object
{
/**
* Enter description here...
*
* @var unknown_type
* @access public
*/
var $parent = false;
/**
* Custom database table name
*
* @var string
* @access public
*/
var $useTable = null;
/**
* Enter description here...
*
* @var unknown_type
* @access public
*/
var $id = false;
/**
* Container for the data that this model gets from persistent storage (the database).
*
* @var array
* @access public
*/
var $data = array();
/**
* Table name for this Model.
*
* @var string
* @access public
*/
var $table = false;
[1258] Author: phpnut Date: 8:13:45 PM, Friday, October 28, 2005 Message: adding version text file [1257] Author: phpnut Date: 8:03:24 PM, Friday, October 28, 2005 Message: small typo in last commit [1256] Author: phpnut Date: 7:16:50 PM, Friday, October 28, 2005 Message: Added fix for a self join of 1 to 1 associations. This is automatic and adds Child_ to the joined class for hasOne or belongsTo. Scaffold is updated to work with this change. You will have to consider the Child_ prefix when working with self joins. [1253] Author: phpnut Date: 4:07:55 PM, Friday, October 28, 2005 Message: Fixed problem with session cookies being set for each path in the URL. Added char to switch in Controller::generateFieldNames() [1252] Author: phpnut Date: 1:59:49 PM, Friday, October 28, 2005 Message: Updated routes.php.default with change to route case. Removed debug code I had added to Model::findAll [1251] Author: phpnut Date: 1:51:00 PM, Friday, October 28, 2005 Message: Added a fix for class already defined error. Updated core.php docblock with level 3 setting for DEBUG. Change instances of AppController to Controller for loading error messages. Updated 404 errors to use default layout [1250] Author: phpnut Date: 1:34:08 PM, Friday, October 28, 2005 Message: renaming error or error404 [1249] Author: phpnut Date: 1:32:51 PM, Friday, October 28, 2005 Message: moving error.thtml to errors directory git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1259 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-29 01:21:47 +00:00
/**
* Primary Key.
*
* If set in the model sub class this will be used.
* If not set, 'id' will be expected as the primary key
[1258] Author: phpnut Date: 8:13:45 PM, Friday, October 28, 2005 Message: adding version text file [1257] Author: phpnut Date: 8:03:24 PM, Friday, October 28, 2005 Message: small typo in last commit [1256] Author: phpnut Date: 7:16:50 PM, Friday, October 28, 2005 Message: Added fix for a self join of 1 to 1 associations. This is automatic and adds Child_ to the joined class for hasOne or belongsTo. Scaffold is updated to work with this change. You will have to consider the Child_ prefix when working with self joins. [1253] Author: phpnut Date: 4:07:55 PM, Friday, October 28, 2005 Message: Fixed problem with session cookies being set for each path in the URL. Added char to switch in Controller::generateFieldNames() [1252] Author: phpnut Date: 1:59:49 PM, Friday, October 28, 2005 Message: Updated routes.php.default with change to route case. Removed debug code I had added to Model::findAll [1251] Author: phpnut Date: 1:51:00 PM, Friday, October 28, 2005 Message: Added a fix for class already defined error. Updated core.php docblock with level 3 setting for DEBUG. Change instances of AppController to Controller for loading error messages. Updated 404 errors to use default layout [1250] Author: phpnut Date: 1:34:08 PM, Friday, October 28, 2005 Message: renaming error or error404 [1249] Author: phpnut Date: 1:32:51 PM, Friday, October 28, 2005 Message: moving error.thtml to errors directory git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1259 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-29 01:21:47 +00:00
*
* @var string
* @access public
*/
var $primaryKey = null;
/**
* Table metadata
*
* @var array
* @access private
*/
var $_tableInfo = null;
/**
* Array of other Models this Model references in a belongsTo (one-to-one) relationship.
*
* @var array
* @access private
*/
var $_belongsToOther = array();
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
/**
* Array of other Models this Model references in a hasOne (one-to-one) relationship.
*
* @var array
* @access private
*/
var $_oneToOne = array();
/**
* Array of other Models this Model references in a hasMany (one-to-many) relationship.
*
* @var array
* @access private
*/
var $_oneToMany = array();
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
/**
* Array of other Models this Model references in a hasAndBelongsToMany (many-to-many) relationship.
*
* @var array
* @access private
*/
var $_manyToMany = array();
/**
* Enter description here...
*
* append entries for validation as ('field_name' => '/^perl_compat_regexp$/') that has to match with preg_match()
* validate with Model::validate()
* @var array
*/
var $validate = array();
/**
* Append entries for validation as ('field_name' => '/^perl_compat_regexp$/') that has to match with preg_match()
* validate with Model::validate()
* @var array
*/
var $validationErrors = null;
/**
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
* Prefix for tables in model.
*
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
* @var string
*/
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
var $tablePrefix = null;
/**
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
* Name of the model.
*
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
* @var string
*/
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
var $name = null;
/**
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
* Name of the model.
*
* @var string
*/
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
var $currentModel = null;
/**
* Enter description here...
*
* @var unknown_type
*/
var $tableToModel = array();
/**
* Enter description here...
*
* @var unknown_type
*/
var $alias = array();
/**
* Custom database configuration name to use
*
* @var string
* @access public
*/
var $useDbConfig = 'default';
/**
* Constructor. Binds the Model's database table to the object.
*
* @param unknown_type $id
* @param string $table Database table to use.
* @param unknown_type $db Database connection object.
*/
function __construct ($id=false, $table=null, $db=null)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
[1178] Author: phpnut Date: 8:52:12 PM, Sunday, October 23, 2005 Message: adding cakephp power image [1177] Author: phpnut Date: 8:48:32 PM, Sunday, October 23, 2005 Message: Updated scaffold to use new layout template. [1176] Author: phpnut Date: 7:09:27 PM, Sunday, October 23, 2005 Message: renaming cake/conf to cake/config [1175] Author: phpnut Date: 7:06:04 PM, Sunday, October 23, 2005 Message: moving tags.ini.php to cake/conf/tags.ini.php [1174] Author: phpnut Date: 6:52:19 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1173] Author: phpnut Date: 6:46:07 PM, Sunday, October 23, 2005 Message: updating css/cake.deafult.css and default layout [1172] Author: phpnut Date: 6:42:48 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1171] Author: phpnut Date: 6:41:00 PM, Sunday, October 23, 2005 Message: Adding spaces to tags.ini file [1170] Author: phpnut Date: 6:37:17 PM, Sunday, October 23, 2005 Message: Removing code that is no longer used [1169] Author: phpnut Date: 6:34:24 PM, Sunday, October 23, 2005 Message: removing files that are no longer used [1168] Author: phpnut Date: 6:19:46 PM, Sunday, October 23, 2005 Message: Cleaning up Scaffold class. [1167] Author: phpnut Date: 5:26:27 PM, Sunday, October 23, 2005 Message: Changes are added to remove the $this->models array that would hold the instance of the models. Now they are available as $this->ModelName; This should be CamelCased. Added check in the Scaffold to return forms when accessing the actions update, create without a form being submitted. [1166] Author: phpnut Date: 3:53:08 PM, Sunday, October 23, 2005 Message: Making change to allow setting the name of a class camel cased to fix issues with PHP 4. In both the model and the controllers: Model: var $name = 'ModelName'; Controller: var $name = 'ControllerName'; ControllerName not ControllerNameController. [1165] Author: phpnut Date: 1:45:17 PM, Sunday, October 23, 2005 Message: Fix added for problems with key name that was added to the class registry when underscored git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1179 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-24 01:56:20 +00:00
if($this->name === null)
{
$this->name = get_class($this);
}
if($this->primaryKey == null)
[1258] Author: phpnut Date: 8:13:45 PM, Friday, October 28, 2005 Message: adding version text file [1257] Author: phpnut Date: 8:03:24 PM, Friday, October 28, 2005 Message: small typo in last commit [1256] Author: phpnut Date: 7:16:50 PM, Friday, October 28, 2005 Message: Added fix for a self join of 1 to 1 associations. This is automatic and adds Child_ to the joined class for hasOne or belongsTo. Scaffold is updated to work with this change. You will have to consider the Child_ prefix when working with self joins. [1253] Author: phpnut Date: 4:07:55 PM, Friday, October 28, 2005 Message: Fixed problem with session cookies being set for each path in the URL. Added char to switch in Controller::generateFieldNames() [1252] Author: phpnut Date: 1:59:49 PM, Friday, October 28, 2005 Message: Updated routes.php.default with change to route case. Removed debug code I had added to Model::findAll [1251] Author: phpnut Date: 1:51:00 PM, Friday, October 28, 2005 Message: Added a fix for class already defined error. Updated core.php docblock with level 3 setting for DEBUG. Change instances of AppController to Controller for loading error messages. Updated 404 errors to use default layout [1250] Author: phpnut Date: 1:34:08 PM, Friday, October 28, 2005 Message: renaming error or error404 [1249] Author: phpnut Date: 1:32:51 PM, Friday, October 28, 2005 Message: moving error.thtml to errors directory git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1259 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-29 01:21:47 +00:00
{
$this->primaryKey = 'id';
[1258] Author: phpnut Date: 8:13:45 PM, Friday, October 28, 2005 Message: adding version text file [1257] Author: phpnut Date: 8:03:24 PM, Friday, October 28, 2005 Message: small typo in last commit [1256] Author: phpnut Date: 7:16:50 PM, Friday, October 28, 2005 Message: Added fix for a self join of 1 to 1 associations. This is automatic and adds Child_ to the joined class for hasOne or belongsTo. Scaffold is updated to work with this change. You will have to consider the Child_ prefix when working with self joins. [1253] Author: phpnut Date: 4:07:55 PM, Friday, October 28, 2005 Message: Fixed problem with session cookies being set for each path in the URL. Added char to switch in Controller::generateFieldNames() [1252] Author: phpnut Date: 1:59:49 PM, Friday, October 28, 2005 Message: Updated routes.php.default with change to route case. Removed debug code I had added to Model::findAll [1251] Author: phpnut Date: 1:51:00 PM, Friday, October 28, 2005 Message: Added a fix for class already defined error. Updated core.php docblock with level 3 setting for DEBUG. Change instances of AppController to Controller for loading error messages. Updated 404 errors to use default layout [1250] Author: phpnut Date: 1:34:08 PM, Friday, October 28, 2005 Message: renaming error or error404 [1249] Author: phpnut Date: 1:32:51 PM, Friday, October 28, 2005 Message: moving error.thtml to errors directory git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1259 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-29 01:21:47 +00:00
}
$this->currentModel = Inflector::underscore($this->name);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
if($db != null)
{
$this->db =& $db;
}
else
{
$dboFactory = DboFactory::getInstance($this->useDbConfig);
$this->db =& $dboFactory;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
if(empty($this->db))
{
$this->missingConnection();
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$classRegistry =& ClassRegistry::getInstance();
[1178] Author: phpnut Date: 8:52:12 PM, Sunday, October 23, 2005 Message: adding cakephp power image [1177] Author: phpnut Date: 8:48:32 PM, Sunday, October 23, 2005 Message: Updated scaffold to use new layout template. [1176] Author: phpnut Date: 7:09:27 PM, Sunday, October 23, 2005 Message: renaming cake/conf to cake/config [1175] Author: phpnut Date: 7:06:04 PM, Sunday, October 23, 2005 Message: moving tags.ini.php to cake/conf/tags.ini.php [1174] Author: phpnut Date: 6:52:19 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1173] Author: phpnut Date: 6:46:07 PM, Sunday, October 23, 2005 Message: updating css/cake.deafult.css and default layout [1172] Author: phpnut Date: 6:42:48 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1171] Author: phpnut Date: 6:41:00 PM, Sunday, October 23, 2005 Message: Adding spaces to tags.ini file [1170] Author: phpnut Date: 6:37:17 PM, Sunday, October 23, 2005 Message: Removing code that is no longer used [1169] Author: phpnut Date: 6:34:24 PM, Sunday, October 23, 2005 Message: removing files that are no longer used [1168] Author: phpnut Date: 6:19:46 PM, Sunday, October 23, 2005 Message: Cleaning up Scaffold class. [1167] Author: phpnut Date: 5:26:27 PM, Sunday, October 23, 2005 Message: Changes are added to remove the $this->models array that would hold the instance of the models. Now they are available as $this->ModelName; This should be CamelCased. Added check in the Scaffold to return forms when accessing the actions update, create without a form being submitted. [1166] Author: phpnut Date: 3:53:08 PM, Sunday, October 23, 2005 Message: Making change to allow setting the name of a class camel cased to fix issues with PHP 4. In both the model and the controllers: Model: var $name = 'ModelName'; Controller: var $name = 'ControllerName'; ControllerName not ControllerNameController. [1165] Author: phpnut Date: 1:45:17 PM, Sunday, October 23, 2005 Message: Fix added for problems with key name that was added to the class registry when underscored git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1179 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-24 01:56:20 +00:00
$classRegistry->addObject($this->currentModel, $this);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
if ($id)
{
$this->id = $id;
}
if($this->useTable !== false)
{
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$tableName = $table? $table: ($this->useTable? $this->useTable: Inflector::tableize($this->name));
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
if (in_array('settableprefix', get_class_methods($this->name)))
{
$this->setTablePrefix();
}
$this->tablePrefix? $this->setTable($this->tablePrefix.$tableName): $this->setTable($tableName);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
parent::__construct();
$this->createLinks();
}
else
{
parent::__construct();
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
/**
* Creates association relationships.
*
*/
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
function createLinks()
{
if (!empty($this->belongsTo))
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
{
$this->_belongsToLink();
}
if (!empty($this->hasOne))
{
$this->_hasOneLink();
}
if (!empty($this->hasMany))
{
$this->_hasManyLinks();
}
if (!empty($this->hasAndBelongsToMany))
{
$this->_hasAndBelongsToManyLinks();
}
}
/**
* Enter description here...
*
* @access private
*/
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
function _belongsToLink()
{
if(is_array($this->belongsTo))
{
foreach ($this->belongsTo as $association => $associationValue)
{
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$className = $association;
$this->_associationSwitch($association, $className, $associationValue, 'Belongs');
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
else
{
$association = explode(',', $this->belongsTo);
foreach ($association as $className)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$this->_constructAssociatedModels($className, $className , 'Belongs');
$this->linkAssociation('Belongs', $className, $className, $this->id);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
}
}
/**
* Enter description here...
*
* @access private
*/
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
function _hasOneLink()
{
if(is_array($this->hasOne))
{
foreach ($this->hasOne as $association => $associationValue)
{
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$className = $association;
$this->_associationSwitch($association, $className, $associationValue, 'One');
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
else
{
$association = explode(',', $this->hasOne);
foreach ($association as $className)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$this->_constructAssociatedModels($className, $className , 'One');
$this->linkAssociation('One', $className, $className, $this->id);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
}
}
/**
* Enter description here...
*
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
* @access private
*/
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
function _hasManyLinks()
{
if(is_array($this->hasMany))
{
foreach ($this->hasMany as $association => $associationValue)
{
$className = $association;
$this->_associationSwitch($association, $className, $associationValue, 'Many');
}
}
else
{
$association = explode(',', $this->hasMany);
foreach ($association as $className)
{
$this->_constructAssociatedModels($className, $className , 'Many');
$this->linkAssociation('Many', $className, $className, $this->id);
}
}
}
/**
* Enter description here...
*
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
* @access private
*/
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
function _hasAndBelongsToManyLinks()
{
if(is_array($this->hasAndBelongsToMany))
{
foreach ($this->hasAndBelongsToMany as $association => $associationValue)
{
$className = $association;
$this->_associationSwitch($association, $className, $associationValue, 'ManyTo');
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
}
else
{
$association = explode(',', $this->hasAndBelongsToMany);
foreach ($association as $className)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$this->_constructAssociatedModels($className, $className , 'ManyTo');
$this->linkAssociation('ManyTo', $className, $className, $this->id);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
}
}
/**
* Enter description here...
*
* @param unknown_type $className
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
* @param unknown_type $associationValue
* @param unknown_type $type
* @access private
*/
function _associationSwitch($association, $className, $associationValue, $type)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$classCreated = false;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
foreach ($associationValue as $option => $optionValue)
{
if (($option === 'className') && ($classCreated === false))
{
$className = $optionValue;
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
if ($classCreated === false)
{
$this->_constructAssociatedModels($association, $className , $type);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$classCreated = true;
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
switch($option)
{
case 'associationForeignKey':
$this->{$association.'_associationforeignkey'} = $optionValue;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
break;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
case 'conditions':
$this->{$association.'_conditions'} = $optionValue;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
break;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
case 'counterCache':
$this->{$association.'_countercache'} = $optionValue;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
break;
case 'counterSql':
$this->{$association.'_countersql'} = $optionValue;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
break;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
case 'deleteSql':
$this->{$association.'_deletesql'} = $optionValue;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
break;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
case 'dependent':
$this->{$association.'_dependent'} = $optionValue;
break;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
case 'exclusive':
$this->{$association.'_exclusive'} = $optionValue;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
break;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
case 'finderSql':
$this->{$association.'_findersql'} = $optionValue;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
break;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
case 'foreignKey':
$this->{$association.'_foreignkey'} = $optionValue;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
break;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
case 'insertSql':
$this->{$association.'_insertsql'} = $optionValue;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
break;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
case 'joinTable':
$this->{$association.'_jointable'} = $optionValue;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
break;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
case 'order':
$this->{$association.'_order'} = $optionValue;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
break;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
case 'uniq':
$this->{$association.'_uniq'} = $optionValue;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
break;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
case 'fields':
$this->{$association.'_fields'} = $optionValue;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
break;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
}
$this->linkAssociation($type, $association, $className, $this->id);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
/**
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
* Enter description here...
*
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
* @param unknown_type $className
* @param unknown_type $type
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
* @access private
*/
function _constructAssociatedModels($association, $className, $type)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$collectionKey = Inflector::underscore($className);
$classRegistry =& ClassRegistry::getInstance();
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
if(!$classRegistry->isKeySet($collectionKey))
{
$this->{$className} = new $className();
}
else
{
$this->{$className} = $classRegistry->getObject($collectionKey);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
switch($type)
{
case 'Belongs':
$this->{$association.'_conditions'} = null;
$this->{$association.'_order'} = null;
$this->{$association.'_foreignkey'} = Inflector::singularize($this->{$className}->table).'_id';
$this->{$association.'_countercache'} = null;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
break;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
case 'One':
$this->{$association.'_conditions'} = null;
$this->{$association.'_order'} = null;
$this->{$association.'_dependent'} = null;
$this->{$association.'_foreignkey'} = Inflector::singularize($this->table).'_id';
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
break;
case 'Many':
$this->{$association.'_conditions'} = null;
$this->{$association.'_order'} = null;
$this->{$association.'_foreignkey'} = Inflector::singularize($this->table).'_id';
$this->{$association.'_fields'} = '*';
$this->{$association.'_dependent'} = null;
$this->{$association.'_exclusive'} = null;
$this->{$association.'_findersql'} = null;
$this->{$association.'_countersql'} = null;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
break;
case 'ManyTo':
$tableSort[0] = $this->table;
$tableSort[1] = $this->{$className}->table;
sort($tableSort);
$joinTable = $tableSort[0] . '_' . $tableSort[1];
$key1 = Inflector::singularize($this->table) . '_id';
$key2 = Inflector::singularize($this->{$className}->table) . '_id';
$this->{$association.'_jointable'} = $joinTable;
$this->{$association.'_fields'} = '*';
$this->{$association.'_foreignkey'} = $key1;
$this->{$association.'_associationforeignkey'} = $key2;
$this->{$association.'_conditions'} = null;
$this->{$association.'_order'} = null;
$this->{$association.'_uniq'} = null;
$this->{$association.'_findersql'} = null;
$this->{$association.'_deletesql'} = null;
$this->{$association.'_insertsql'} = null;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
break;
}
$this->tableToModel[$this->{$className}->table] = $className;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
/**
* Enter description here...
*
* @param unknown_type $type
* @param unknown_type $tableName
* @param unknown_type $value
*/
function linkAssociation ($type, $association, $model, $value=null)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
switch ($type)
{
case 'Belongs':
$this->alias[$association] = $this->{$model}->table;
$this->_belongsToOther[] = array($association, $model, $value);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
break;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
case 'One':
$this->alias[$association] = $this->{$model}->table;
$this->_oneToOne[] = array($association, $model, $value);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
break;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
case 'Many':
$this->alias[$association] = $this->{$model}->table;
$this->_oneToMany[] = array($association, $model, $value);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
break;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
case 'ManyTo':
$this->alias[$association] = $this->{$model}->table;
$this->_manyToMany[] = array($association, $model, $value);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
break;
}
}
/**
* Sets a custom table for your controller class. Used by your controller to select a database table.
*
* @param string $tableName Name of the custom table
*/
function setTable($tableName)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
if (!in_array(strtolower($tableName), $this->db->tables()))
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$this->missingTable($tableName);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
exit();
}
else
{
$this->table = $tableName;
$this->tableToModel[$this->table] = $this->name;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$this->loadInfo();
}
}
/**
* This function does two things: 1) it scans the array $one for they key 'id',
* and if that's found, it sets the current id to the value of $one[id].
* For all other keys than 'id' the keys and values of $one are copied to the 'data' property of this object.
* 2) Returns an array with all of $one's keys and values.
* (Alternative indata: two strings, which are mangled to
* a one-item, two-dimensional array using $one for a key and $two as its value.)
*
* @param mixed $one Array or string of data
* @param string $two Value string for the alternative indata method
* @return unknown
*/
function set ($one, $two=null)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$this->validationErrors = null;
$data = is_array($one)? $one : array($one=>$two);
foreach ($data as $n => $v)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
foreach ($v as $x => $y)
{
if($x == $this->primaryKey)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$this->id = $y;
}
$this->data[$n][$x] = $y;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
}
return $data;
}
/**
* Sets current Model id to given $id.
*
* @param int $id Id
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
*/
function setId ($id)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$this->id = $id;
}
/**
* Returns an array of table metadata (column names and types) from the database.
*
* @return array Array of table metadata
*/
function loadInfo ()
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
if (empty($this->_tableInfo))
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$this->_tableInfo = new NeatArray($this->db->fields($this->table));
}
return $this->_tableInfo;
}
/**
* Returns true if given field name exists in this Model's database table.
* Starts by loading the metadata into the private property table_info if that is not already set.
*
* @param string $name Name of table to look in
* @return boolean
*/
function hasField ($name)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
if (empty($this->_tableInfo))
{
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$this->loadInfo();
}
return $this->_tableInfo->findIn('name', $name);
}
/**
* Initializes the model for writing a new record
*
* @return boolean True on success
*/
function create ()
{
$this->id = false;
unset($this->data);
$this->data = array();
}
/**
* Returns a list of fields from the database
*
* @param mixed $fields String of single fieldname, or an array of fieldnames.
* @return array Array of database fields
*/
function read ($fields=null)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$this->validationErrors = null;
if(is_array($this->id))
{
return $this->id? $this->find("$this->name.$this->primaryKey = '{$this->id[0]}'", $fields): false;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
else
{
return $this->id? $this->find("$this->name.$this->primaryKey = '{$this->id}'", $fields): false;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
}
/**
* Returns contents of a field in a query matching given conditions.
*
* @param string $name Name of field to get
* @param string $conditions SQL conditions (defaults to NULL)
* @return field contents
*/
function field ($name, $conditions=null, $order=null)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
if (isset($this->data[$this->name][$name]))
{
return $this->data[$this->name][$name];
}
if ($conditions)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$conditions = $this->parseConditions($conditions);
}
if ($data = $this->find($conditions, $name, $order))
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
return isset($data[$this->name][$name])? $data[$this->name][$name]: false;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
else
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
return false;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
}
/**
* Saves a single field to the database.
*
* @param string $name Name of the table field
* @param mixed $value Value of the field
* @return boolean True on success save
*/
function saveField($name, $value)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
return Model::save(array($this->name=>array($name=>$value)), false);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
/**
* Saves model data to the database.
*
* @param array $data Data to save.
* @param boolean $validate
* @return boolean success
*/
function save ($data=null, $validate=true)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
if ($data)
{
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$this->set($data);
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
if ($validate && !$this->validates())
{
return false;
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$fields = $values = array();
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$count = 0;
if(count($this->data) > 1)
{
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$weHaveMulti = true;
$joined = false;
}
else
{
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$weHaveMulti = false;
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
foreach ($this->data as $n=>$v)
{
if(isset($weHaveMulti) && $count > 0 && !empty($this->_manyToMany))
{
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$joined[] = $v;
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
else
{
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
foreach ($v as $x => $y)
{
if ($this->hasField($x))
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
if($x == $this->primaryKey && $y === '')
{
continue;
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$fields[] = $x;
if($y === NULL)
{
$values[] = 'NULL';
}
else
{
$values[] = (ini_get('magic_quotes_gpc') == 1) ?
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$this->db->prepare(stripslashes($y)) : $this->db->prepare($y);
}
if($x == $this->primaryKey && !is_numeric($y))
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$newID = $y;
}
}
}
$count++;
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
if (empty($this->id) && $this->hasField('created') && !in_array('created', $fields))
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$fields[] = 'created';
$values[] = date("'Y-m-d H:i:s'");
}
if ($this->hasField('modified') && !in_array('modified', $fields))
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$fields[] = 'modified';
$values[] = 'NOW()';
}
if(!$this->exists())
{
$this->id = false;
}
if(count($fields))
{
if(!empty($this->id))
{
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$sql = array();
foreach (array_combine($fields, $values) as $field=>$value)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$sql[] = $field.'='.$value;
}
$sql = "UPDATE {$this->table} SET ".join(',', $sql)." WHERE $this->primaryKey = '{$this->id}'";
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
if ($this->db->query($sql))
{
if(!empty($joined))
{
$this->_saveMulti($joined, $this->id);
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$this->data = false;
return true;
}
else
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
return $this->db->hasAny($this->table, "$this->primaryKey = '{$this->id}'");
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
}
else
{
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$fields = join(',', $fields);
$values = join(',', $values);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$sql = "INSERT INTO {$this->table} ({$fields}) VALUES ({$values})";
if($this->db->query($sql))
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$this->id = $this->db->lastInsertId($this->table, $this->primaryKey);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
if(!empty($joined))
{
if(!$this->id > 0 && isset($newID))
{
$this->id = $newID;
}
$this->_saveMulti($joined, $this->id);
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
return true;
}
else
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
return false;
}
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
else
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
return false;
}
}
/**
* Saves model hasAndBelongsToMany data to the database.
*
* @param array $joined Data to save.
* @param string $id
* @return
* @access private
*/
function _saveMulti ($joined, $id)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
foreach ($joined as $x => $y)
{
foreach ($y as $association => $value)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$joinTable[] = $this->{$association.'_jointable'};
$mainKey = $this->{$association.'_foreignkey'};
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$keys[] = $mainKey;
$keys[] = $this->{$association.'_associationforeignkey'};
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$fields[] = join(',', $keys);
unset($keys);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
foreach ($value as $update)
{
if(!empty($update))
{
$values[] = (ini_get('magic_quotes_gpc') == 1) ? $this->db->prepare(stripslashes($id)) : $this->db->prepare($id);
$values[] = (ini_get('magic_quotes_gpc') == 1) ? $this->db->prepare(stripslashes($update)) : $this->db->prepare($update);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$values = join(',', $values);
$newValues[] = "({$values})";
unset($values);
}
}
if(!empty($newValues))
{
$newValue[] = join(',', $newValues);
unset($newValues);
}
}
}
$total = count($joinTable);
for ($count = 0; $count < $total; $count++)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$this->db->query("DELETE FROM {$joinTable[$count]} WHERE $mainKey = '{$id}'");
if(!empty($newValue[$count]))
{
$this->db->query("INSERT INTO {$joinTable[$count]} ({$fields[$count]}) VALUES {$newValue[$count]}");
}
}
}
/**
* Synonym for del().
*
* @param mixed $id
* @see function del
* @return boolean True on success
*/
function remove ($id=null)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
return $this->del($id);
}
/**
* Removes record for given id. If no id is given, the current id is used. Returns true on success.
*
* @param mixed $id Id of database record to delete
* @return boolean True on success
*/
function del ($id=null)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
if ($id)
{
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$this->id = $id;
}
if ($this->id && $this->db->query("DELETE FROM {$this->table} WHERE {$this->primaryKey} = '{$this->id}'"))
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$this->id = false;
return true;
}
else
{
return false;
}
}
/**
* Returns true if a record with set id exists.
*
* @return boolean True if such a record exists
*/
function exists ()
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
return $this->id? $this->db->hasAny($this->table, "$this->primaryKey = '{$this->id}'"): false;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
/**
* Returns true if a record that meets given conditions exists
*
* @return boolean True if such a record exists
*/
function hasAny ($conditions = null)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
return $this->findCount($conditions);
}
/**
* Return a single row as a resultset array.
*
* @param string $conditions SQL conditions
* @param mixed $fields Either a single string of a field name, or an array of field names
* @param string $order SQL ORDER BY conditions (e.g. "price DESC" or "name ASC")
* @return array Array of records
*/
function find ($conditions = null, $fields = null, $order = null)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$data = Model::findAll($conditions, $fields, $order, 1);
return empty($data[0])? false: $data[0];
}
/** parses conditions array (or just passes it if it's a string)
* @return string
*
*/
function parseConditions ($conditions)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
if (is_string($conditions))
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
return $conditions;
}
elseif (is_array($conditions))
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$out = array();
foreach ($conditions as $key=>$value)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$slashedValue = (ini_get('magic_quotes_gpc') == 1) ? $this->db->prepare(stripslashes($value)) : $this->db->prepare($value);
//Should remove the = below so LIKE and other compares can be used
$out[] = "{$key}=".($value===null? 'null': $slashedValue);
}
return join(' and ', $out);
}
else
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
return null;
}
}
/**
* Returns a resultset array with specified fields from database matching given conditions.
*
* @param mixed $conditions SQL conditions as a string or as an array('field'=>'value',...)
* @param mixed $fields Either a single string of a field name, or an array of field names
* @param string $order SQL ORDER BY conditions (e.g. "price DESC" or "name ASC")
* @param int $limit SQL LIMIT clause, for calculating items per page
* @param int $page Page number
* @return array Array of records
*/
function findAll ($conditions = null, $fields = null, $order = null, $limit=50, $page=1)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$conditions = $this->parseConditions($conditions);
[1258] Author: phpnut Date: 8:13:45 PM, Friday, October 28, 2005 Message: adding version text file [1257] Author: phpnut Date: 8:03:24 PM, Friday, October 28, 2005 Message: small typo in last commit [1256] Author: phpnut Date: 7:16:50 PM, Friday, October 28, 2005 Message: Added fix for a self join of 1 to 1 associations. This is automatic and adds Child_ to the joined class for hasOne or belongsTo. Scaffold is updated to work with this change. You will have to consider the Child_ prefix when working with self joins. [1253] Author: phpnut Date: 4:07:55 PM, Friday, October 28, 2005 Message: Fixed problem with session cookies being set for each path in the URL. Added char to switch in Controller::generateFieldNames() [1252] Author: phpnut Date: 1:59:49 PM, Friday, October 28, 2005 Message: Updated routes.php.default with change to route case. Removed debug code I had added to Model::findAll [1251] Author: phpnut Date: 1:51:00 PM, Friday, October 28, 2005 Message: Added a fix for class already defined error. Updated core.php docblock with level 3 setting for DEBUG. Change instances of AppController to Controller for loading error messages. Updated 404 errors to use default layout [1250] Author: phpnut Date: 1:34:08 PM, Friday, October 28, 2005 Message: renaming error or error404 [1249] Author: phpnut Date: 1:32:51 PM, Friday, October 28, 2005 Message: moving error.thtml to errors directory git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1259 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-29 01:21:47 +00:00
$alias = null;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
if (is_array($fields))
{
$f = $fields;
}
elseif ($fields)
{
$f = array($fields);
}
else
{
$f = array('*');
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$joins = $whers = array();
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
if(!empty($this->_oneToOne))
{
foreach ($this->_oneToOne as $rule)
{
list($association, $model, $value) = $rule;
if(!empty($this->{$association.'_foreignkey'}))
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
if($this->name == $this->{$model}->name and $this->name == $association)
[1258] Author: phpnut Date: 8:13:45 PM, Friday, October 28, 2005 Message: adding version text file [1257] Author: phpnut Date: 8:03:24 PM, Friday, October 28, 2005 Message: small typo in last commit [1256] Author: phpnut Date: 7:16:50 PM, Friday, October 28, 2005 Message: Added fix for a self join of 1 to 1 associations. This is automatic and adds Child_ to the joined class for hasOne or belongsTo. Scaffold is updated to work with this change. You will have to consider the Child_ prefix when working with self joins. [1253] Author: phpnut Date: 4:07:55 PM, Friday, October 28, 2005 Message: Fixed problem with session cookies being set for each path in the URL. Added char to switch in Controller::generateFieldNames() [1252] Author: phpnut Date: 1:59:49 PM, Friday, October 28, 2005 Message: Updated routes.php.default with change to route case. Removed debug code I had added to Model::findAll [1251] Author: phpnut Date: 1:51:00 PM, Friday, October 28, 2005 Message: Added a fix for class already defined error. Updated core.php docblock with level 3 setting for DEBUG. Change instances of AppController to Controller for loading error messages. Updated 404 errors to use default layout [1250] Author: phpnut Date: 1:34:08 PM, Friday, October 28, 2005 Message: renaming error or error404 [1249] Author: phpnut Date: 1:32:51 PM, Friday, October 28, 2005 Message: moving error.thtml to errors directory git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1259 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-29 01:21:47 +00:00
{
$alias = 'Child_'.$association;
[1258] Author: phpnut Date: 8:13:45 PM, Friday, October 28, 2005 Message: adding version text file [1257] Author: phpnut Date: 8:03:24 PM, Friday, October 28, 2005 Message: small typo in last commit [1256] Author: phpnut Date: 7:16:50 PM, Friday, October 28, 2005 Message: Added fix for a self join of 1 to 1 associations. This is automatic and adds Child_ to the joined class for hasOne or belongsTo. Scaffold is updated to work with this change. You will have to consider the Child_ prefix when working with self joins. [1253] Author: phpnut Date: 4:07:55 PM, Friday, October 28, 2005 Message: Fixed problem with session cookies being set for each path in the URL. Added char to switch in Controller::generateFieldNames() [1252] Author: phpnut Date: 1:59:49 PM, Friday, October 28, 2005 Message: Updated routes.php.default with change to route case. Removed debug code I had added to Model::findAll [1251] Author: phpnut Date: 1:51:00 PM, Friday, October 28, 2005 Message: Added a fix for class already defined error. Updated core.php docblock with level 3 setting for DEBUG. Change instances of AppController to Controller for loading error messages. Updated 404 errors to use default layout [1250] Author: phpnut Date: 1:34:08 PM, Friday, October 28, 2005 Message: renaming error or error404 [1249] Author: phpnut Date: 1:32:51 PM, Friday, October 28, 2005 Message: moving error.thtml to errors directory git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1259 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-29 01:21:47 +00:00
}
else
{
$alias = $association;
[1258] Author: phpnut Date: 8:13:45 PM, Friday, October 28, 2005 Message: adding version text file [1257] Author: phpnut Date: 8:03:24 PM, Friday, October 28, 2005 Message: small typo in last commit [1256] Author: phpnut Date: 7:16:50 PM, Friday, October 28, 2005 Message: Added fix for a self join of 1 to 1 associations. This is automatic and adds Child_ to the joined class for hasOne or belongsTo. Scaffold is updated to work with this change. You will have to consider the Child_ prefix when working with self joins. [1253] Author: phpnut Date: 4:07:55 PM, Friday, October 28, 2005 Message: Fixed problem with session cookies being set for each path in the URL. Added char to switch in Controller::generateFieldNames() [1252] Author: phpnut Date: 1:59:49 PM, Friday, October 28, 2005 Message: Updated routes.php.default with change to route case. Removed debug code I had added to Model::findAll [1251] Author: phpnut Date: 1:51:00 PM, Friday, October 28, 2005 Message: Added a fix for class already defined error. Updated core.php docblock with level 3 setting for DEBUG. Change instances of AppController to Controller for loading error messages. Updated 404 errors to use default layout [1250] Author: phpnut Date: 1:34:08 PM, Friday, October 28, 2005 Message: renaming error or error404 [1249] Author: phpnut Date: 1:32:51 PM, Friday, October 28, 2005 Message: moving error.thtml to errors directory git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1259 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-29 01:21:47 +00:00
}
$oneToOneConditions = $this->parseConditions($this->{$association.'_conditions'});
$oneToOneOrder = $this->{$association.'_order'};
$joins[] = "LEFT JOIN {$this->{$model}->table} AS `$alias` ON
`$alias`.{$this->{$association.'_foreignkey'}} = {$this->name}.$this->primaryKey"
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
.($oneToOneConditions? " WHERE {$oneToOneConditions}":null)
.($oneToOneOrder? " ORDER BY {$oneToOneOrder}": null);
}
}
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
if(!empty($this->_belongsToOther))
{
foreach ($this->_belongsToOther as $rule)
{
list($association, $model, $value) = $rule;
if(!empty($this->{$association.'_foreignkey'}))
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
if($this->name == $this->{$model}->name and $this->name == $association)
[1258] Author: phpnut Date: 8:13:45 PM, Friday, October 28, 2005 Message: adding version text file [1257] Author: phpnut Date: 8:03:24 PM, Friday, October 28, 2005 Message: small typo in last commit [1256] Author: phpnut Date: 7:16:50 PM, Friday, October 28, 2005 Message: Added fix for a self join of 1 to 1 associations. This is automatic and adds Child_ to the joined class for hasOne or belongsTo. Scaffold is updated to work with this change. You will have to consider the Child_ prefix when working with self joins. [1253] Author: phpnut Date: 4:07:55 PM, Friday, October 28, 2005 Message: Fixed problem with session cookies being set for each path in the URL. Added char to switch in Controller::generateFieldNames() [1252] Author: phpnut Date: 1:59:49 PM, Friday, October 28, 2005 Message: Updated routes.php.default with change to route case. Removed debug code I had added to Model::findAll [1251] Author: phpnut Date: 1:51:00 PM, Friday, October 28, 2005 Message: Added a fix for class already defined error. Updated core.php docblock with level 3 setting for DEBUG. Change instances of AppController to Controller for loading error messages. Updated 404 errors to use default layout [1250] Author: phpnut Date: 1:34:08 PM, Friday, October 28, 2005 Message: renaming error or error404 [1249] Author: phpnut Date: 1:32:51 PM, Friday, October 28, 2005 Message: moving error.thtml to errors directory git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1259 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-29 01:21:47 +00:00
{
$alias = 'Child_'.$association;
[1258] Author: phpnut Date: 8:13:45 PM, Friday, October 28, 2005 Message: adding version text file [1257] Author: phpnut Date: 8:03:24 PM, Friday, October 28, 2005 Message: small typo in last commit [1256] Author: phpnut Date: 7:16:50 PM, Friday, October 28, 2005 Message: Added fix for a self join of 1 to 1 associations. This is automatic and adds Child_ to the joined class for hasOne or belongsTo. Scaffold is updated to work with this change. You will have to consider the Child_ prefix when working with self joins. [1253] Author: phpnut Date: 4:07:55 PM, Friday, October 28, 2005 Message: Fixed problem with session cookies being set for each path in the URL. Added char to switch in Controller::generateFieldNames() [1252] Author: phpnut Date: 1:59:49 PM, Friday, October 28, 2005 Message: Updated routes.php.default with change to route case. Removed debug code I had added to Model::findAll [1251] Author: phpnut Date: 1:51:00 PM, Friday, October 28, 2005 Message: Added a fix for class already defined error. Updated core.php docblock with level 3 setting for DEBUG. Change instances of AppController to Controller for loading error messages. Updated 404 errors to use default layout [1250] Author: phpnut Date: 1:34:08 PM, Friday, October 28, 2005 Message: renaming error or error404 [1249] Author: phpnut Date: 1:32:51 PM, Friday, October 28, 2005 Message: moving error.thtml to errors directory git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1259 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-29 01:21:47 +00:00
}
else
{
$alias = $association;
[1258] Author: phpnut Date: 8:13:45 PM, Friday, October 28, 2005 Message: adding version text file [1257] Author: phpnut Date: 8:03:24 PM, Friday, October 28, 2005 Message: small typo in last commit [1256] Author: phpnut Date: 7:16:50 PM, Friday, October 28, 2005 Message: Added fix for a self join of 1 to 1 associations. This is automatic and adds Child_ to the joined class for hasOne or belongsTo. Scaffold is updated to work with this change. You will have to consider the Child_ prefix when working with self joins. [1253] Author: phpnut Date: 4:07:55 PM, Friday, October 28, 2005 Message: Fixed problem with session cookies being set for each path in the URL. Added char to switch in Controller::generateFieldNames() [1252] Author: phpnut Date: 1:59:49 PM, Friday, October 28, 2005 Message: Updated routes.php.default with change to route case. Removed debug code I had added to Model::findAll [1251] Author: phpnut Date: 1:51:00 PM, Friday, October 28, 2005 Message: Added a fix for class already defined error. Updated core.php docblock with level 3 setting for DEBUG. Change instances of AppController to Controller for loading error messages. Updated 404 errors to use default layout [1250] Author: phpnut Date: 1:34:08 PM, Friday, October 28, 2005 Message: renaming error or error404 [1249] Author: phpnut Date: 1:32:51 PM, Friday, October 28, 2005 Message: moving error.thtml to errors directory git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1259 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-29 01:21:47 +00:00
}
$belongsToOtherConditions = $this->parseConditions($this->{$association.'_conditions'});
$belongsToOtherOrder = $this->{$association.'_order'};
$joins[] = "LEFT JOIN {$this->{$model}->table} AS `$alias` ON {$this->name}.{$this->{$association.'_foreignkey'}} = `$alias`.{$this->{$model}->primaryKey}"
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
.($belongsToOtherConditions? " WHERE {$belongsToOtherConditions}":null)
.($belongsToOtherOrder? " ORDER BY {$belongsToOtherOrder}": null);
}
}
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$joins = count($joins)? join(' ', $joins): null;
$whers = count($whers)? '('.join(' AND ', $whers).')': null;
$conditions .= ($conditions && $whers? ' AND ': null).$whers;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$offset = $page > 1? ($page-1) * $limit: 0;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$limit_str = $limit
? $this->db->selectLimit($limit, $offset)
: '';
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$sql = "SELECT " .join(', ', $f)
." FROM {$this->table} AS `{$this->name}` {$joins}"
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
.($conditions? " WHERE {$conditions}":null)
.($order? " ORDER BY {$order}": null)
.$limit_str;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$data = $this->db->all($sql);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
if(!empty($this->_oneToMany))
{
$newValue = $this->_findOneToMany($data);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
if(!empty($newValue))
{
$data = $newValue;
}
}
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
if(!empty($this->_manyToMany))
{
$newValue = $this->_findManyToMany($data);
if(!empty($newValue))
{
$data = $newValue;
}
}
return $data;
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
/**
* Enter description here...
*
* @param unknown_type $data
* @return unknown
*/
function _findOneToMany(&$data)
{
$datacheck = $data;
$original = $data;
foreach ($this->_oneToMany as $rule)
{
$count = 0;
list($association, $model, $value) = $rule;
foreach ($datacheck as $key => $value1)
{
foreach ($value1 as $key2 => $value2)
{
[1258] Author: phpnut Date: 8:13:45 PM, Friday, October 28, 2005 Message: adding version text file [1257] Author: phpnut Date: 8:03:24 PM, Friday, October 28, 2005 Message: small typo in last commit [1256] Author: phpnut Date: 7:16:50 PM, Friday, October 28, 2005 Message: Added fix for a self join of 1 to 1 associations. This is automatic and adds Child_ to the joined class for hasOne or belongsTo. Scaffold is updated to work with this change. You will have to consider the Child_ prefix when working with self joins. [1253] Author: phpnut Date: 4:07:55 PM, Friday, October 28, 2005 Message: Fixed problem with session cookies being set for each path in the URL. Added char to switch in Controller::generateFieldNames() [1252] Author: phpnut Date: 1:59:49 PM, Friday, October 28, 2005 Message: Updated routes.php.default with change to route case. Removed debug code I had added to Model::findAll [1251] Author: phpnut Date: 1:51:00 PM, Friday, October 28, 2005 Message: Added a fix for class already defined error. Updated core.php docblock with level 3 setting for DEBUG. Change instances of AppController to Controller for loading error messages. Updated 404 errors to use default layout [1250] Author: phpnut Date: 1:34:08 PM, Friday, October 28, 2005 Message: renaming error or error404 [1249] Author: phpnut Date: 1:32:51 PM, Friday, October 28, 2005 Message: moving error.thtml to errors directory git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1259 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-29 01:21:47 +00:00
if($key2 === $this->name)
{
if($this->{$association.'_findersql'})
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$tmpSQL = $this->{$association.'_findersql'};
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
else
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$oneToManyConditions = $this->parseConditions($this->{$association.'_conditions'});
$oneToManyOrder = $this->{$association.'_order'};
$tmpSQL = "SELECT {$this->{$association.'_fields'}} FROM {$this->{$model}->table} AS `{$association}`
WHERE ({$this->{$association.'_foreignkey'}}) = '{$value2[$this->primaryKey]}'"
.($oneToManyConditions? "AND {$oneToManyConditions}":null)
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
.($oneToManyOrder? " ORDER BY {$oneToManyOrder}": null);
}
$oneToManySelect[$association] = $this->db->all($tmpSQL);
if( !empty($oneToManySelect[$association]) && is_array($oneToManySelect[$association]))
{
$newKey = $association;
foreach ($oneToManySelect[$association] as $key => $value)
{
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$oneToManySelect1[$newKey][$key] = $value[$newKey];
}
$merged = array_merge_recursive($data[$count],$oneToManySelect1);
$newdata[$count] = $merged;
unset( $oneToManySelect[$association], $oneToManySelect1);
}
if(!empty($newdata[$count]))
{
$original[$count] = $newdata[$count];
}
}
}
$count++;
}
if(empty($newValue) && !empty($original))
{
for ($i = 0; $i< count($original); $i++)
{
$newValue[$i] = $original[$i];
}
}
elseif(!empty($original))
{
for ($i = 0; $i< count($original); $i++)
{
$newValue[$i] = array_merge($newValue[$i], $original[$i]);
}
}
}
if(!empty($newValue))
{
return $newValue;
}
}
/**
* Enter description here...
*
* @param unknown_type $data
* @return unknown
*/
function _findManyToMany(&$data)
{
$datacheck = $data;
$original = $data;
foreach ($this->_manyToMany as $rule)
{
$count = 0;
list($association, $model, $value) = $rule;
foreach ($datacheck as $key => $value1)
{
foreach ($value1 as $key2 => $value2)
{
if($key2 === $this->name)
{
if( 0 == strncmp($key2, $this->{$association.'_foreignkey'}, $key2) )
{
if(!empty ($value2[$this->primaryKey]))
{
if($this->{$association.'_findersql'})
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$tmpSQL = $this->{$association.'_findersql'};
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
else
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
{
$manyToManyConditions = $this->parseConditions($this->{$association.'_conditions'});
$manyToManyOrder = $this->{$association.'_order'};
$tmpSQL = "SELECT {$this->{$association.'_fields'}} FROM {$this->{$model}->table} AS `{$association}`
JOIN {$this->{$association.'_jointable'}}
ON {$this->{$association.'_jointable'}}.
{$this->{$association.'_foreignkey'}} = '{$value2[$this->primaryKey]}'
AND {$this->{$association.'_jointable'}}.
{$this->{$association.'_associationforeignkey'}} = `{$association}` .{$this->{$model}->primaryKey}"
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
.($manyToManyConditions? " WHERE {$manyToManyConditions}":null)
.($manyToManyOrder? " ORDER BY {$manyToManyOrder}": null);
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
}
$manyToManySelect[$association] = $this->db->all($tmpSQL);
}
if( !empty($manyToManySelect[$association]) && is_array($manyToManySelect[$association]))
{
$newKey = $association;
foreach ($manyToManySelect[$association] as $key => $value)
{
[1159] Author: phpnut Date: 1:39:26 PM, Saturday, October 22, 2005 Message: Just about done with refactoring the model class. This should be tested to make sure all changes are working as expected. [1158] Author: phpnut Date: 5:34:41 AM, Saturday, October 22, 2005 Message: More work on associations. Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany [1157] Author: phpnut Date: 3:39:13 AM, Saturday, October 22, 2005 Message: More cleanup in Model class. [1156] Author: phpnut Date: 2:43:38 AM, Saturday, October 22, 2005 Message: Removing duplicate code the the associations. Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code. [1155] Author: phpnut Date: 1:52:47 AM, Saturday, October 22, 2005 Message: More cleaning up of the model class [1154] Author: phpnut Date: 1:40:34 AM, Saturday, October 22, 2005 Message: Cleaning up code layout [1153] Author: phpnut Date: 1:32:05 AM, Saturday, October 22, 2005 Message: removing temp variables and extra calls to Inflector::underscore(); [1152] Author: phpnut Date: 1:22:58 AM, Saturday, October 22, 2005 Message: More work on associations. Removing code that is no longer needed. [1151] Author: phpnut Date: 12:02:43 AM, Saturday, October 22, 2005 Message: more work on associations [1150] Author: phpnut Date: 6:25:45 PM, Friday, October 21, 2005 Message: more refactoring of associations [1149] Author: phpnut Date: 6:04:18 PM, Friday, October 21, 2005 Message: refactoring model and adding more association code [1145] Author: phpnut Date: 2:43:05 PM, Thursday, October 20, 2005 Message: more refactoring on associations [1143] Author: phpnut Date: 1:44:42 PM, Thursday, October 20, 2005 Message: Refactoring associations code. Starting work allowing full use of associations array settings git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
$manyToManySelect1[$newKey][$key] = $value[$newKey];
}
$merged = array_merge_recursive($data[$count],$manyToManySelect1);
$newdata[$count] = $merged;
unset( $manyToManySelect[$association], $manyToManySelect1 );
}
if(!empty($newdata[$count]))
{
$original[$count] = $newdata[$count];
}
}
}
}
$count++;
}
if(empty($newValue) && !empty($original))
{
$originalCount = count($original);
for ($i = 0; $i< $originalCount; $i++)
{
$newValue[$i] = $original[$i];
}
}
elseif(!empty($original))
{
$originalCount = count($original);
for ($i = 0; $i< $originalCount; $i++)
{
$newValue[$i] = array_merge($newValue[$i], $original[$i]);
}
}
}
if(!empty($newValue))
{
return $newValue;
}
}
/**
* Returns an array of all rows for given SQL statement.
*
* @param string $sql SQL query
* @return array
*/
function findBySql ($sql)
{
$data = $this->db->all($sql);
foreach ($data as $key => $value)
{
foreach ($this->tableToModel as $key1 => $value1)
{
if (isset($data[$key][$key1]))
{
$newData[$key][$value1] = $data[$key][$key1];
}
}
}
if (!empty($newData))
{
return $newData;
}
else
{
return $data;
}
}
/**
* Returns number of rows matching given SQL condition.
*
* @param string $conditions SQL conditions (WHERE clause conditions)
* @return int Number of matching rows
*/
function findCount ($conditions)
{
list($data) = Model::findAll($conditions, 'COUNT(*) AS count');
return isset($data[0]['count'])? $data[0]['count']: false;
}
/**
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
* Finds all children of $parent_id using 'parent_id' field.
*
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
* @param int $parent_id
* @param string $conditions SQL conditions (WHERE clause conditions)
* @param unknown_type $fields
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
* @return unknown type
*/
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
function findAllThreaded ($conditions=null, $fields=null, $sort=null, $parent_id='0')
{
return $this->_doThread(Model::findAll($conditions, $fields, $sort), $parent_id);
}
/**
* Enter description here...
*
* @param unknown_type $data
* @param unknown_type $root NULL or id for root node of operation
* @return array
* @access private
*/
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
function _doThread ($data, $root)
{
$out = array();
for ($ii=0; $ii<sizeof($data); $ii++)
{
if ($data[$ii][$this->name]['parent_id'] == $root)
{
$tmp = $data[$ii];
$tmp['children'] = isset($data[$ii][$this->name][$this->primaryKey])? $this->_doThread($data, $data[$ii][$this->name][$this->primaryKey]): null;
$out[] = $tmp;
}
}
return $out;
}
/**
* Returns an array with keys "prev" and "next" that holds the id's of neighbouring data,
* which is useful when creating paged lists.
*
* @param string $conditions SQL conditions for matching rows
* @param unknown_type $field
* @param unknown_type $value
* @return array Array with keys "prev" and "next" that holds the id's
*/
function findNeighbours ($conditions, $field, $value)
{
@list($prev) = Model::findAll($conditions." AND {$field} < '{$value}'", $field, "{$field} DESC", 1);
@list($next) = Model::findAll($conditions." AND {$field} > '{$value}'", $field, "{$field} ASC", 1);
$prev = isset($prev) ? $prev: false;
$next = isset($next) ? $next: false;
return array('prev'=>$prev, 'next'=>$next);
}
/**
* Returns a resultset for given SQL statement.
*
* @param string $sql SQL statement
* @return array Resultset
*/
function query ($sql)
{
return $this->db->query($sql);
}
/**
* Returns true if all fields pass validation.
*
* @param array $data POST data
* @return boolean True if there are no errors
*/
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
function validates ($data = null)
{
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
if (!$data)
{
$data = $this->data;
}
$errors = count($this->invalidFields($data));
return $errors == 0;
}
/**
* Returns an array of invalid fields.
*
* @param array $data
* @return array Array of invalid fields
*/
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
function invalidFields ($data = null)
{
if (!isset($this->validate))
{
return true;
}
if (is_array($this->validationErrors))
{
return $this->validationErrors;
}
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
if (!$data)
{
if (isset($this->data))
{
$data = $this->data;
}
else
{
$data = array();
}
}
$errors = array();
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
foreach ($data as $table => $field)
{
foreach ($this->validate as $field_name=>$validator)
{
if (isset($data[$table][$field_name]) && !preg_match($validator, $data[$table][$field_name]))
{
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
$errors[$field_name] = 1;
}
}
$this->validationErrors = $errors;
return $errors;
}
}
/**
* This function determines whether or not a string is a foreign key
*
* @param string $field Returns true if the input string ends in "_id"
* @return True if the field is a foreign key listed in the belongsTo array.
*/
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
function isForeignKey( $field )
{
$foreignKeys = array();
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
if(!empty($this->_belongsToOther))
{
foreach ($this->_belongsToOther as $rule)
{
list($association, $model, $value) = $rule;
$foreignKeys[$this->{$association.'_foreignkey'}] = $this->{$association.'_foreignkey'};
}
}
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
if( array_key_exists($field, $foreignKeys) )
{
return true;
}
return false;
}
/**
* Enter description here...
*
* @return unknown
*/
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
function getDisplayField()
{
// $displayField defaults to 'name'
$dispField = 'name';
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
// If the $displayField variable is set in this model, use it.
if( isset( $this->displayField ) ) {
$dispField = $this->displayField;
}
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
// And if the display field does not exist in the table info structure, use the ID field.
if( false == $this->hasField( $dispField ) )
$dispField = $this->primaryKey;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
return $dispField;
}
/**
* Enter description here...
*
* @return unknown
*/
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
function getLastInsertID()
{
return $this->db->lastInsertId($this->table, $this->primaryKey);
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
}
}
?>