Source for file Filter.php
Documentation is available at Filter.php
* $Id: Record.php 1298 2007-05-01 19:26:03Z zYne $
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.com>.
* Filters and prepares the record data
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @version $Revision: 1298 $
* @var Doctrine_Record $_record the record object this filter belongs to
* @param Doctrine_Record $_record the record object this filter belongs to
* @return Doctrine_Record $_record the record object this filter belongs to
* sets the default values for records internal data
* @param boolean $overwrite whether or not to overwrite the already set values
if ( ! $table->hasDefaultValues()) {
foreach ($data as $column =>
$value) {
$default =
$table->getDefaultValueOf($column);
if ($value ===
self::$_null ||
$overwrite) {
$this->_record->rawSet($column, $default);
$this->_record->setModified($modified);
* prepares identifiers for later use
* @param boolean $exists whether or not this record exists in persistent data store
$id =
$this->_table->getIdentifier();
if ($this->_data[$name] ===
self::$_null) {
$this->_id[$name] =
null;
$this->_id[$name] =
$this->_data[$name];
if (isset
($this->_data[$id]) &&
$this->_data[$id] !==
self::$_null) {
$this->_id[$id] =
$this->_data[$id];
* returns an array of modified fields and values with data preparation
* adds column aggregation inheritance and converts Records into primary key values
$array =
$this->_modified;
foreach ($array as $k =>
$v) {
$type =
$this->_table->getTypeOf($v);
if ($this->_data[$v] ===
self::$_null) {
$a[$v] =
$this->getTable()->getConnection()->convertBooleans($this->_data[$v]);
$a[$v] =
$this->_table->enumIndex($v,$this->_data[$v]);
$this->_data[$v] =
$this->_data[$v]->getIncremented();
$a[$v] =
$this->_data[$v];
$map =
$this->_table->inheritanceMap;
foreach ($map as $k =>
$v) {
$old =
$this->get($k, false);
if ((string)
$old !== (string)
$v ||
$old ===
null) {