Skip to content

Commit f08fc44

Browse files
author
Samuel Akopyan
committed
Added __isset to some classes
1 parent 3f47e27 commit f08fc44

File tree

2 files changed

+34
-12
lines changed

2 files changed

+34
-12
lines changed

framework/db/CActiveRecord.php

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@
2020
* __construct _relations _parentModel (static)
2121
* __set _customFields _createObjectFromTable
2222
* __get _encryptedFields _getRelations
23-
* __unset _beforeSave _getCustomFields
24-
* __callStatic _afterSave _addCustomFields
25-
* _beforeDelete _removeCustomFields
26-
* init (static) _afterDelete _prepareLimit
27-
* set _tableName
28-
* get _isEncryptedField
29-
* resultArray _getEncryptedFields
30-
* allowedColumns _getEncryptedField
23+
* __isset _beforeSave _getCustomFields
24+
* __unset _afterSave _addCustomFields
25+
* __callStatic _beforeDelete _removeCustomFields
26+
* _afterDelete _prepareLimit
27+
* init (static) _tableName
28+
* set _isEncryptedField
29+
* get _getEncryptedFields
30+
* resultArray _getEncryptedField
31+
* allowedColumns
3132
* isColumnExists
3233
* setSpecialField
3334
* getSpecialField
@@ -191,7 +192,17 @@ public function __get($index)
191192
return '';
192193
}
193194
}
194-
195+
196+
/**
197+
* Checks if active record property exists
198+
* @param string $index
199+
* @return bool
200+
*/
201+
public function __isset($index)
202+
{
203+
return array_key_exists($index, $this->_columns) ? true : false;
204+
}
205+
195206
/**
196207
* Sets a active record property to be null
197208
* @param string $index

framework/db/CRecordEntity.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* CRecordEntity base class for classes that represent a single database row.
4-
* It implements the Active Record design pattern.
4+
* It implements the Record Entity design pattern.
55
*
66
* @project ApPHP Framework
77
* @author ApPHP <info@apphp.com>
@@ -15,6 +15,7 @@
1515
* __construct
1616
* __set
1717
* __get
18+
* __isset
1819
* __unset
1920
* set
2021
* get
@@ -79,9 +80,19 @@ public function __get($index)
7980
return '';
8081
}
8182
}
82-
83+
84+
/**
85+
* Checks if record entity property exists
86+
* @param string $index
87+
* @return bool
88+
*/
89+
public function __isset($index)
90+
{
91+
return array_key_exists($index, $this->_columns) ? true : false;
92+
}
93+
8394
/**
84-
* Sets a active record property to be null
95+
* Sets a record entity property to be null
8596
* @param string $index
8697
* @return void
8798
*/

0 commit comments

Comments
 (0)