本文整理汇总了PHP中Ak::deprecateWarning方法的典型用法代码示例。如果您正苦于以下问题:PHP Ak::deprecateWarning方法的具体用法?PHP Ak::deprecateWarning怎么用?PHP Ak::deprecateWarning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ak
的用法示例。
在下文中一共展示了Ak::deprecateWarning方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _loadConfig
/**
* @deprecated
*/
static function _loadConfig($dictionary)
{
Ak::deprecateWarning('AkInflector::_loadConfig is deprecated and will be removed in future Akelos versions. Please use AkInflector::loadConfig() instead.');
return AkInflector::loadConfig($dictionary);
}
示例2: _extractConditionsFromArgs
public function _extractConditionsFromArgs($args, $options)
{
if (empty($args)) {
$fetch = 'all';
} else {
$fetch = $args[0];
}
$num_args = count($args);
// deprecated: acts like findFirstBySQL
if ($num_args === 1 && !is_numeric($args[0]) && is_string($args[0]) && $args[0] != 'all' && $args[0] != 'first') {
// $Users->find("last_name = 'Williams'"); => find('first',"last_name = 'Williams'");
Ak::deprecateWarning(array("AR::find('%sql') is ambiguous and therefore deprecated, use AR::find('first',%sql) instead", '%sql' => $args[0]));
$options = array('conditions' => $args[0]);
return array('first', $options);
}
//end
// set fetch_mode to 'all' if none is given
if (!is_numeric($fetch) && !is_array($fetch) && $fetch != 'all' && $fetch != 'first') {
array_unshift($args, 'all');
$num_args = count($args);
}
if ($num_args > 1) {
if (is_string($args[1])) {
// $Users->find(:fetch_mode,"first_name = ?",'Tim');
$fetch = array_shift($args);
$options = array_merge($options, array('conditions' => $args));
//TODO: merge_conditions
} elseif (is_array($args[1])) {
// $Users->find(:fetch_mode,array('first_name = ?,'Tim'));
$fetch = array_shift($args);
$options = array_merge($options, array('conditions' => $args[0]));
//TODO: merge_conditions
}
}
return array($fetch, $options);
}
示例3: array
/**
* Works like find_all, but requires a complete SQL string. Examples:
* $Post->findBySql("SELECT p.*, c.author FROM posts p, comments c WHERE p.id = c.post_id");
* $Post->findBySql(array("SELECT * FROM posts WHERE author = ? AND created_on > ?", $author_id, $start_date));
*/
function &findBySql($sql, $limit = null, $offset = null, $bindings = null, $returns = 'default', $simulation_class = 'AkActiveRecordMock')
{
if ($limit || $offset){
Ak::deprecateWarning("You're calling AR::findBySql with \$limit or \$offset parameters. This has been deprecated.");
$this->_db->addLimitAndOffset($sql, array('limit'=>$limit,'offset'=>$offset));
}
if(!isset($this->_activeRecordHasBeenInstantiated)){
return Ak::handleStaticCall();
}
$objects = array();
$records = $this->_db->select ($sql,'selecting');
foreach ($records as $record){
if ($returns == 'default') {
$objects[] =& $this->instantiate($this->getOnlyAvailableAttributes($record), false);
} else if ($returns == 'simulated') {
$objects[] = $this->_castAttributesFromDatabase($this->getOnlyAvailableAttributes($record),$this);
} else if ($returns == 'array') {
$objects[] = $this->_castAttributesFromDatabase($this->getOnlyAvailableAttributes($record),$this);
}
}
if ($returns == 'simulated') {
$false = false;
$objects = $this->_generateStdClasses($simulation_class,$objects,$this->getType(),$false,$false,array('__owner'=>array('pk'=>$this->getPrimaryKey(),'class'=>$this->getType())));
}
return $objects;
}
示例4: array
/**
* Works like find_all, but requires a complete SQL string. Examples:
* $Post->findBySql("SELECT p.*, c.author FROM posts p, comments c WHERE p.id = c.post_id");
* $Post->findBySql(array("SELECT * FROM posts WHERE author = ? AND created_on > ?", $author_id, $start_date));
*/
function &findBySql($sql, $limit = null, $offset = null, $bindings = null)
{
if ($limit || $offset) {
Ak::deprecateWarning("You're calling AR::findBySql with \$limit or \$offset parameters. This has been deprecated.");
$this->_db->addLimitAndOffset($sql, array('limit' => $limit, 'offset' => $offset));
}
if (!isset($this->_activeRecordHasBeenInstantiated)) {
return Ak::handleStaticCall();
}
$objects = array();
$records = $this->_db->select($sql, 'selecting');
foreach ($records as $record) {
$objects[] =& $this->instantiate($this->getOnlyAvailableAttributes($record), false);
}
return $objects;
}
示例5: _create
/**
* Creates a new record with values matching those of the instance attributes.
* Must be called as a result of a call to createOrUpdate.
*/
private function _create()
{
if (!$this->beforeCreate() || !$this->notifyObservers('beforeCreate')) {
return $this->transactionFail();
}
$this->_setRecordTimestamps();
// deprecated section
if ($this->isLockingEnabled() && is_null($this->get('lock_version'))) {
Ak::deprecateWarning(array("Column %lock_version_column should have a default setting. Assumed '1'.", '%lock_version_column' => 'lock_version'));
$this->setAttribute('lock_version', 1);
}
// end
$attributes = $this->getColumnsForAttributes($this->getAttributes());
foreach ($attributes as $column => $value) {
$attributes[$column] = $this->castAttributeForDatabase($column, $value);
}
$pk = $this->getPrimaryKey();
$table = $this->getTableName();
$id = $this->_db->incrementsPrimaryKeyAutomatically() ? null : $this->_db->getNextSequenceValueFor($table);
$attributes[$pk] = $id;
$inserted_id = $this->_db->insertWithAttributes($table, $attributes, $pk, 'Create ' . $this->getModelName());
if ($this->transactionHasFailed()) {
return false;
}
$this->setId($inserted_id);
$this->_newRecord = false;
if (!$this->afterCreate() || !$this->notifyObservers('afterCreate')) {
return $this->transactionFail();
}
return true;
}
示例6: call_user_func_array
static function &call_user_func_array($function_name, $parameters)
{
Ak::deprecateWarning('Ak::call_user_func_array() is deprecated and will be removed from Akelos in future releases. Please use PHP\'s native call_user_func_array() function instead.');
$result = call_user_func_array($function_name, $parameters);
return $result;
}