本文整理汇总了PHP中object::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP object::delete方法的具体用法?PHP object::delete怎么用?PHP object::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object
的用法示例。
在下文中一共展示了object::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Delete an account
*
* @param integer $account_id the account to delete
* @return boolean was the account deleted?
*/
public function delete($accountid)
{
if (parent::delete($accountid)) {
return $this->ldap->delete($accountid);
}
return false;
}
示例2: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$c = strtolower($this->argument('controller'));
$files = [];
$files[] = mkny_models_path($c) . '.php';
$files[] = mkny_model_config_path($c) . '.php';
$files[] = mkny_presenters_path($c) . 'Presenter.php';
$files[] = mkny_controllers_path($c) . 'Controller.php';
$files[] = mkny_requests_path($c) . 'Request.php';
$files[] = mkny_lang_path(\App::getLocale() . '/' . $c) . '.php';
$errors = [];
foreach ($files as $file) {
if (!$this->files->exists($file)) {
$errors[] = $file;
}
}
if (!$this->option('force') && count($errors)) {
$this->error("Nao foi possivel executar o delete-automatico!\nAlguns arquivos estao ausentes!");
} else {
if ($this->option('force') || $this->confirm("Deseja realmente remover os arquivos: \n'" . implode("',\n'", $files))) {
foreach ($files as $file) {
$this->files->delete($file);
}
$this->info('Deleted!');
}
}
}
示例3: testRoleSynchronisation
/**
* Test role synchronisation
*/
public function testRoleSynchronisation()
{
// create a first test ACL role
$query = $this->model->insert()->into('acl_role')->values(['name' => 'test role 1']);
$statement = $this->model->prepareStatementForSqlObject($query);
$statement->execute();
$this->aclRolesIds[] = $this->model->getAdapter()->getDriver()->getLastGeneratedValue();
// create a test user
$query = $this->model->insert()->into('user_list')->values(['nick_name' => Rand::getString(32), 'email' => Rand::getString(32), 'role' => $this->aclRolesIds[0]]);
$statement = $this->model->prepareStatementForSqlObject($query);
$statement->execute();
$this->usersIds[] = $this->model->getAdapter()->getDriver()->getLastGeneratedValue();
// delete the created ACL role
$query = $this->model->delete()->from('acl_role')->where(['id' => $this->aclRolesIds[0]]);
$statement = $this->model->prepareStatementForSqlObject($query);
$statement->execute();
// fire the delete ACL role event
AclEvent::fireDeleteAclRoleEvent($this->aclRolesIds[0]);
// check the created test user's role
$select = $this->model->select();
$select->from('user_list')->columns(['role'])->where(['user_id' => $this->usersIds[0]]);
$statement = $this->model->prepareStatementForSqlObject($select);
$resultSet = new ResultSet();
$result = $resultSet->initialize($statement->execute());
// user must be a default member
$this->assertEquals($result->current()['role'], AclBaseModel::DEFAULT_ROLE_MEMBER);
}
示例4: testDelete
/**
* testDelete function
*
* @return void
* @access public
*/
function testDelete()
{
// Without params
$this->Shell->delete();
$this->Shell->expectAt(0, 'out', array(new PatternExpectation('/Usage/')));
// Invalid config
$this->Shell->args = array('cache_test');
$this->Shell->delete();
$this->Shell->expectAt(0, 'err', array(new PatternExpectation('/not found/')));
$this->Shell->expectCallCount('_stop', 2);
Cache::config('cache_test', Cache::config('default'));
// With config
Cache::write('anything', array('a'), 'cache_test');
Cache::write('anything2', array('b'), 'cache_test');
$this->assertTrue(Cache::read('anything', 'cache_test') !== false);
$this->Shell->args = array('cache_test');
$this->Shell->delete();
$this->assertFalse(Cache::read('anything', 'cache_test'));
// With config
Cache::write('anything', array('a'), 'cache_test');
Cache::write('anything2', array('b'), 'cache_test');
$this->assertTrue(Cache::read('anything', 'cache_test') !== false);
$this->Shell->args = array('cache_test', 'anything');
$this->Shell->delete();
$this->assertFalse(Cache::read('anything', 'cache_test'));
$this->assertTrue(Cache::read('anything2', 'cache_test') !== false);
}
示例5: tearDown
/**
* Tear down
*/
protected function tearDown()
{
// delete a test user
if ($this->userIds) {
$query = $this->model->delete()->from('user_list')->where([new InPredicate('user_id', $this->userIds)]);
$statement = $this->model->prepareStatementForSqlObject($query);
$statement->execute();
$this->userIds = [];
}
}
示例6: tearDown
/**
* Tear down
*/
protected function tearDown()
{
// clear test settings
if ($this->settingsNames) {
$query = $this->settingModel->delete()->from('application_setting')->where(['name' => $this->settingsNames]);
$statement = $this->settingModel->prepareStatementForSqlObject($query);
$statement->execute();
$this->settingsNames = [];
}
}
示例7: replaceAndSave
/**
* Open haystack, find and replace needles, save haystack
* @param string $oldFile The haystack
* @param mixed $search String or array to look for (the needles)
* @param mixed $replace What to replace the needles for?
* @param string $newFile Where to save, defaults to $oldFile
* @param boolean $deleteOldFile Whether to delete $oldFile or not
* @return void
*/
public function replaceAndSave($oldFile, $search, $replace, $newFile = null, $deleteOldFile = false)
{
$newFile = $newFile === null ? $oldFile : $newFile;
$file = $this->files->get($oldFile);
$replacing = str_replace($search, $replace, $file);
$this->files->put($newFile, $replacing);
if ($deleteOldFile) {
$this->files->delete($oldFile);
}
}
示例8: delete
/**
* Deletes an item out of the cache, or multiple items
*
* @param string|array $key
* @return int
*/
public function delete($key)
{
$delCount = 0;
foreach (array_filter((array) $key) as $cacheKey) {
if ($this->memcached->delete($key)) {
++$delCount;
}
}
return $delCount;
}
示例9: delete
/**
* 删除文章评论
*
* @access public
*/
public function delete()
{
if (!($id = Request::input('id'))) {
return responseJson(Lang::get('common.action_error'));
}
$id = array_map('intval', (array) $id);
$comment = $this->commentModel->getCommentInIds($id);
if ($this->commentProcess->delete($id)) {
$this->setActionLog(['comment' => $comment]);
return responseJson(Lang::get('common.action_success'), true);
}
return responseJson($this->commentProcess->getErrorMessage());
}
示例10: delete
/**
* 删除文章分类
*
* @access public
*/
public function delete()
{
if (!($id = Request::input('id'))) {
return responseJson(Lang::get('common.action_error'));
}
if (!is_array($id)) {
$id = array($id);
}
$id = array_map('intval', $id);
if ($this->tagProcess->delete($id)) {
$this->setActionLog(['id' => $id]);
return responseJson(Lang::get('common.action_success'), true);
}
return responseJson($this->tagProcess->getErrorMessage());
}
示例11: deleteConfig
/**
* Delete a config from the database
*
* @param object &$config reference to a {@link XoopsConfigItem}
*/
function deleteConfig(&$config)
{
if (!$this->_cHandler->delete($config)) {
return false;
}
$options =& $config->getConfOptions();
$count = count($options);
if ($count == 0) {
$options = $this->getConfigOptions(new Criteria('conf_id', $config->getVar('conf_id')));
$count = count($options);
}
if (is_array($options) && $count > 0) {
for ($i = 0; $i < $count; $i++) {
$this->_oHandler->delete($options[$i]);
}
}
if (!empty($this->_cachedConfigs[$config->getVar('conf_modid')][$config->getVar('conf_catid')])) {
unset($this->_cachedConfigs[$config->getVar('conf_modid')][$config->getVar('conf_catid')]);
}
xoops_load("cache");
$key = "config_" . intval($config->getVar('conf_modid')) . "_" . intval($config->getVar('conf_catid'));
if (XoopsCache::read($key)) {
XoopsCache::delete($key);
}
return true;
}
示例12: delete_system_by_gid
/**
* Remove payment system object by GUID
*
* @param string $gid system GUID
* @return void
*/
public function delete_system_by_gid($gid)
{
$this->DB->where("gid", $gid);
$this->DB->delete(PAYMENTS_SYSTEMS_TABLE);
unset($this->systems_cache[$gid]);
return;
}
示例13: delete
/**
* 删除数据
*
* @author liu21st <liu21st@gmail.com>
* @lastmodify 2013-01-21 15:03:16 by mrmsl
*
* @param array $options 参数表达式
*
* @return bool true删除成功,否则false
*/
public function delete($options = array())
{
if (empty($options) && empty($this->_options['where'])) {
if (!empty($this->_data) && isset($this->_data[$v = $this->getPk()])) {
//如果删除条件为空 则删除当前数据对象所对应的记录
return $this->delete($this->_data[$v]);
}
return false;
}
if (is_numeric($options) || is_string($options)) {
$pk = $this->getPk();
//根据主键删除记录
$where[$pk] = strpos($options, ',') ? array('IN', $options) : $options;
$pk_value = $where[$pk];
$options = array('where' => $where);
}
$options = $this->_parseOptions($options);
//分析表达式
$result = $this->_db->delete($options);
if (false !== $result) {
$data = array();
isset($pk_value) && ($data[$pk] = $pk_value);
$this->_afterDelete($data, $options);
}
return $result;
}
示例14: delete
/**
* Deletes a cache file based on unique key.
*
* @since 6.2.0
* @param int|string $key
* Unique key of cache file.
* @param string $namespace
* Optional. Where the cache contents are namespaced.
*/
public function delete($key, $namespace = 'default')
{
if (empty($namespace)) {
$namespace = 'default';
}
return $this->_cache->delete($key, $namespace);
}
示例15: delete
public function delete($table, $cond, array $bind = array())
{
if (empty($this->_database)) {
return false;
}
return $this->_database->delete($table, $cond, $bind);
}