/**
  * <p>Gibt die Bedingungen als Array zurück.</p>
  * @return array
  */
 public function getWheres()
 {
     if (count($this->_aPlaceholders) > 0) {
         throw new Dkplus_Model_Exception('There are still free placeholders.');
     }
     return parent::getWheres();
 }
	/**
	 * <p>Holt alle vom übergebenen Model abhängigen Werte.</p>
	 * @param Dkplus_Model_Interface $model
	 * @param scalar $modelValue
	 * @param Dkplus_Model_Criteria_Interface $crit
	 * @return Dkplus_Model_Rowset_Interface
	 */
	public function fetchDependent(Dkplus_Model_Interface $model, $modelValue, $crit = null){
		$modelClass = get_class($model);
		
		if(
			$this->_hasOneToManyReference($modelClass)
		){	
			if(
				is_null($crit)
			){
				$crit = new Dkplus_Model_Criteria();
				$crit->andWhere($this->_getReference($modelClass), $modelValue);
			}
			elseif(
				$crit->getWhereConnector() == Dkplus_Model_Criteria::WHERE_AND
			){
				$crit->andWhere($this->_getReference($modelClass), $modelValue);
			}
			else{
				$crit2 = new Dkplus_Model_Criteria();
				$crit2->andWhere($this->_getReference($modelClass), $modelValue);				
				$exec = new Dkplus_Model_Criteria_Executor();
				$exec->setAlias($this->_alias)
					->setArray($this->_getData())
					->setCriteria($crit2);
				$data = $exec->execute();
				
				$exec = new Dkplus_Model_Criteria_Executor();
				$exec->setAlias($this->_alias)
					->setArray($data)
					->setCriteria($crit);
				$data = $exec->execute();
								
				return new $this->_rowsetClass($this, $data);
			}
			return $this->fetchRowset($crit);
		}
		
		/**
		 * @see Dkplus_Model_Exception
		 */
		//require-once 'Dkplus/Model/Exception.php';
		throw new Dkplus_Model_Exception('There is no Relation to '.$modelClass);
	}
	/**
	 * Implementiert eine Inflection. Für Näheres siehe {@link Dkplus_Model_Db_Abstract hier}.
	 * @see Dkplus/Model/Dkplus_Model_Interface#__call()
	 * @throws {@link Dkplus_Model_Exception} if there is no inner row or if the inner row
	 * does not implements the method.
	 * Wirft eine {@link Dkplus_Model_Exception} wenn kein "inneres Objekt" existiert oder
	 * das "inner Objekt" die Methode nicht implementiert.
	 * @uses Dkplus_Model_Criteria
	 */
	public function __call($method, array $arguments)
	{
		$method = (string) $method;
		if (subStr($method, 0, 7) == 'fetchBy'
			&& $this->_hasAlias(subStr($method, 7)))
		{
			if (count($arguments) != 1)
			{
				/** 
				 * @see Dkplus_Model_Exception
 				*/
				//require-once 'Dkplus/Model/Exception.php';
				throw new Dkplus_Model_Exception('There must be exactly one argument for fetchByXyz-Methods.');
			}
			
			$crit = new Dkplus_Model_Criteria();
			$crit->andWhere($this->_transformAlias(subStr($method, 7)), $arguments[0]);
			return $this->fetchRowset($crit);
		}
		
		if (subStr($method, 0, 13) == 'fetchRowsetBy'
			&& $this->_hasAlias(subStr($method, 13)))
		{
			if (count($arguments) != 1)
			{
				/** 
				 * @see Dkplus_Model_Exception
 				*/
				//require-once 'Dkplus/Model/Exception.php';
				throw new Dkplus_Model_Exception('There must be exactly one argument for fetchRowsetByXyz-Methods.');
			}
			$crit = new Dkplus_Model_Criteria();
			$crit->andWhere($this->_transformAlias(subStr($method, 13)), $arguments[0]);
			return $this->fetchRowset($crit);
		}
		
		if (subStr($method, 0, 10) == 'fetchRowBy'
			&& $this->_hasAlias(subStr($method, 10)))
		{
			if(count($arguments) != 1)
			{
				/** 
				 * @see Dkplus_Model_Exception
 				*/
				//require-once 'Dkplus/Model/Exception.php';
				throw new Dkplus_Model_Exception('There must be exactly one argument for fetchRowByXyz-Methods.');
			}
			$crit = new Dkplus_Model_Criteria();
			$crit->andWhere($this->_transformAlias(subStr($method, 10)), $arguments[0]);
			return $this->fetchRow($crit);
		}
		
		throw new Dkplus_Model_Mapper_Exception('Method ' . $method
			. ' does not exist and was not trabbed.');
	}
 /**
  * <p>Holt alle vom übergebenen Model abhängigen Werte.</p>
  * @param Dkplus_Model_Interface $model
  * @param scalar $modelValue
  * @param Dkplus_Model_Criteria_Interface $crit
  * @return Dkplus_Model_Rowset_Interface
  */
 public function fetchDependent(Dkplus_Model_Interface $model, $modelValue, $crit = null)
 {
     $modelClass = get_class($model);
     if ($this->_hasOneToManyReference($modelClass)) {
         if (is_null($crit)) {
             $crit = new Dkplus_Model_Criteria();
             $crit->andWhere($this->_getReference($modelClass), $modelValue);
         } elseif ($crit->getWhereConnector() == Dkplus_Model_Criteria::WHERE_AND) {
             $crit->andWhere($this->_getReference($modelClass), $modelValue);
         } else {
             $select = $this->_critToQuery($crit);
             $select->where($this->_getReference($modelClass) . ' = ?', $modelValue);
             return $this->_fetchRowsetBySelect($select);
         }
         return $this->fetchRowset($crit);
     }
     if ($this->_hasManyToManyReference($modelClass)) {
         if (is_null($crit)) {
             $select = $this->_getDbTable()->select();
         } else {
             $select = $this->_critToQuery($crit);
         }
         return $this->_fetchRowsetBySelect($select->from(array('a' => $this->_getReferenceTable($modelClass)), '')->joinLeft(array('b' => $this->_getDbTable()->info('name')), 'a.' . $this->_getReferenceTableCol($modelClass) . ' = b.' . $this->_getReferenceCol($modelClass), 'b.*')->where('a.' . $this->_getReferenceModelCol($modelClass) . ' = ?', $modelValue));
     }
     throw new Dkplus_Model_Exception('There is no relation defined for class ' . $modelClass . '.');
 }
	/**
	 * @return Dkplus_Model_Row_Abstract
	 */
	protected function _delete(){
		$crit = new Dkplus_Model_Criteria();
		foreach($this->_unsavedData AS $k => $v){
			$crit->andWhere($k, $v);
		}
		$this->_getModel()->delete($crit);
		return $this;
	}
 /**
  * Implementiert eine Inflection. Für Näheres siehe {@link Dkplus_Model_Db_Abstract hier}.
  * @see Dkplus/Model/Dkplus_Model_Interface#__call()
  * @throws {@link Dkplus_Model_Exception} if there is no inner row or if the inner row
  * does not implements the method.
  * Wirft eine {@link Dkplus_Model_Exception} wenn kein "inneres Objekt" existiert oder
  * das "inner Objekt" die Methode nicht implementiert.
  * @uses Dkplus_Model_Criteria
  */
 public function __call($method, array $arguments)
 {
     $method = (string) $method;
     if (subStr($method, 0, 7) == 'fetchBy' && $this->_hasAlias(subStr($method, 7))) {
         if (count($arguments) != 1) {
             /** 
              * @see Dkplus_Model_Exception
              */
             //require-once 'Dkplus/Model/Exception.php';
             throw new Dkplus_Model_Exception('There must be exactly one argument for fetchByXyz-Methods.');
         }
         $crit = new Dkplus_Model_Criteria();
         $crit->andWhere($this->_transformAlias(subStr($method, 7)), $arguments[0]);
         return $this->fetchRowset($crit);
     }
     if (subStr($method, 0, 13) == 'fetchRowsetBy' && $this->_hasAlias(subStr($method, 13))) {
         if (count($arguments) != 1) {
             /** 
              * @see Dkplus_Model_Exception
              */
             //require-once 'Dkplus/Model/Exception.php';
             throw new Dkplus_Model_Exception('There must be exactly one argument for fetchRowsetByXyz-Methods.');
         }
         $crit = new Dkplus_Model_Criteria();
         $crit->andWhere($this->_transformAlias(subStr($method, 13)), $arguments[0]);
         return $this->fetchRowset($crit);
     }
     if (subStr($method, 0, 10) == 'fetchRowBy' && $this->_hasAlias(subStr($method, 10))) {
         if (count($arguments) != 1) {
             /** 
              * @see Dkplus_Model_Exception
              */
             //require-once 'Dkplus/Model/Exception.php';
             throw new Dkplus_Model_Exception('There must be exactly one argument for fetchRowByXyz-Methods.');
         }
         $crit = new Dkplus_Model_Criteria();
         $crit->andWhere($this->_transformAlias(subStr($method, 10)), $arguments[0]);
         return $this->fetchRow($crit);
     }
     if (!$this->_hasInnerRow()) {
         /** 
          * @see Dkplus_Model_Exception
          */
         //require-once 'Dkplus/Model/Exception.php';
         throw new Dkplus_Model_Exception('There is no inner row, method ' . $method . ' cannot be called.');
     }
     if (!method_exists($this->fetchInnerRow(), $method)) {
         /** 
          * @see Dkplus_Model_Exception
          */
         //require-once 'Dkplus/Model/Exception.php';
         throw new Dkplus_Model_Exception('There is an inner row but it does not implements a method ' . $method . '.');
     }
     return call_user_func_array(array($this->fetchInnerRow(), $method), $arguments);
 }