public function execute(array $bindParams = array(), array $bindTypes = array()) { if (!empty($bindParams)) { $this->bind($bindParams); } if (!empty($bindTypes)) { $this->bindTypes($bindTypes); } $response = parent::execute(true); if ($response instanceof Resultset) { return $response->count() == 0 ? true : $response; } return false; }
private static function _prepareFind($parameters = false, $first = false) { //manager exists ? $manager = self::getModelsManager(); if (!is_null($manager)) { $model = $manager->getModel(self::getCalledModelName()); if (is_null($model)) { $model = self::getCalledModel(); } $criteria = $manager->getModelCriteria(self::getCalledModelName()); if (is_null($criteria)) { $criteria = new Criteria($model); $manager->saveModelCriteria(self::getCalledModelName(), $criteria); } $criteria->reset(); } else { $model = self::getCalledModel(); $criteria = new Criteria($model); } if ($first) { $criteria->limit(1); } if (is_numeric($parameters)) { $conditions = $model->getPrimaryKeyName() . " = " . $parameters; $criteria->where($conditions); } else { if (is_string($parameters)) { $criteria->where($parameters); } else { if (is_array($parameters)) { $criteria->conditions($parameters); } } } if (!is_null($manager)) { $manager->saveQuery(self::getCalledModelName(), $criteria->resolveQuery()); } return $criteria->execute(); }