Created
November 2, 2011 16:52
CakePHP: Creating a white list dynamically.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Model constructor. | |
*/ | |
public function __construct( $id = false, $table = null, $ds = null ) { | |
parent::__construct( $id, $table, $ds ); | |
# Generate a whitelist that doesn't require me to make an update every time | |
# I add a property...unless I don't want that property to be batch updated. | |
# For me, this is usually the exception rather than the rule. | |
$this->whitelist = array_diff( array_keys( $this->schema() ), array( 'id', 'admin', 'last_login', 'active', 'created', 'modified' ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment