mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-15 05:59:50 +00:00
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7002 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
fbdb4af2c1
commit
9b514352dc
2 changed files with 9 additions and 1 deletions
|
@ -922,12 +922,15 @@ class Set extends Object {
|
|||
* @access public
|
||||
*/
|
||||
function combine($data, $path1 = null, $path2 = null, $groupPath = null) {
|
||||
if (empty($data)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
if (is_a($this, 'set') && is_string($data) && is_string($path1) && is_string($path2)) {
|
||||
$groupPath = $path2;
|
||||
$path2 = $path1;
|
||||
$path1 = $data;
|
||||
$data = $this->get();
|
||||
|
||||
} elseif (is_a($this, 'set') && is_string($data) && empty($path2)) {
|
||||
$path2 = $path1;
|
||||
$path1 = $data;
|
||||
|
|
|
@ -727,6 +727,11 @@ class SetTest extends UnitTestCase {
|
|||
}
|
||||
|
||||
function testCombine() {
|
||||
$result = Set::combine(array(), '{n}.User.id', '{n}.User.Data');
|
||||
$this->assertFalse($result);
|
||||
$result = Set::combine('', '{n}.User.id', '{n}.User.Data');
|
||||
$this->assertFalse($result);
|
||||
|
||||
$a = array(
|
||||
array('User' => array('id' => 2, 'group_id' => 1,
|
||||
'Data' => array('user' => 'mariano.iglesias','name' => 'Mariano Iglesias'))),
|
||||
|
|
Loading…
Add table
Reference in a new issue