Delete an object from tableless fields

@param int    $id
@param string $type
@param string $name

@return bool

@since 2.3.0
428873
public function delete_object_from_relationships( $id, $object, $name = null ) {

		/**
		 * @var $pods_init \PodsInit
		 */
		global $pods_init;

		$pod = false;

		// Run any bidirectional delete operations
		if ( is_array( $object ) ) {
			$pod = $object;
		} elseif ( is_object( $pods_init ) ) {
			$pod = PodsInit::$meta->get_object( $object, $name );
		}

		if ( ! empty( $pod ) ) {
			$object = $pod['type'];
			$name   = $pod['name'];

			foreach ( $pod['fields'] as $field ) {
				PodsForm::delete( $field['type'], $id, $field['name'], array_merge( $field, $field['options'] ), $pod );
			}
		}

		// Lookup related fields (non-bidirectional)
		$params = array(
			'where' => array(
				array(
					'key'   => 'type',
					'value' => 'pick'
				),
				array(
					'key'   => 'pick_object',
					'value' => $object
				)
			)
		);

		if ( ! empty( $name ) && $name !== $object ) {
			$params['where'][] = array(
				'key'   => 'pick_val',
				'value' => $name
			);
		}

		$fields = $this->load_fields( $params, false );

		if ( ! empty( $pod ) && 'media' === $pod['type'] ) {
			$params['where'] = array(
				array(
					'key'   => 'type',
					'value' => 'file'
				)
			);

			$fields = array_merge( $fields, $this->load_fields( $params, false ) );
		}

		if ( is_array( $fields ) && ! empty( $fields ) ) {
			foreach ( $fields as $related_field ) {
				$related_pod = $this->load_pod( array( 'id' => $related_field['pod_id'], 'fields' => false ), false );

				if ( empty( $related_pod ) ) {
					continue;
				}

				$related_from = $this->lookup_related_items_from( $related_field['id'], $related_pod['id'], $id, $related_field, $related_pod );

				$this->delete_relationships( $related_from, $id, $related_pod, $related_field );
			}
		}

		if ( ! empty( $pod ) && ! pods_tableless() ) {
			pods_query( "
				DELETE FROM `@wp_podsrel`
				WHERE
				(
					`pod_id` = %d
					AND `item_id` = %d
				)
				OR (
					`related_pod_id` = %d
					AND `related_item_id` = %d
				)
			", array(
				$pod['id'],
				$id,

				$pod['id'],
				$id
			) );
		}

		return true;
	}
64468
public function delete($indexName, $type, $id)
	{
		$index = $this->elasticSearcher->indicesManager()->getRegistered($indexName);

		$params = [
			'index' => $index->getInternalName(),
			'type'  => $type,
			'id'    => $id
		];

		return $this->elasticSearcher->getClient()->delete($params);
	}
1011846
public function delete($id) {

		$bean = \R::findOne( $this->type, ' id = :id ', [ ':id' => $id ] );
		if ( !$bean ) {
			throw new \Exception('This '.$this->type.' does not exist.');
		}

		// Check for property type specific delete methods
		foreach ( $this->properties as $property ) {

			// Check if specific delete property method exists
			$c = new $property['type'];
			if ( method_exists( $c, 'delete' ) ) {
				$c->delete( $bean, $property );
			}

		}

		\R::trash( $bean );

	}
1232238
public function unregister($type, $name)
    {
        if (!is_string($type) || !isset($this->algos[$type])) {
            throw new \InvalidArgumentException();
        }
        if (!is_string($name)) {
            throw new \InvalidArgumentException();
        }
        unset($this->algos[$type][$name]);
        return $this;
    }
1324945
public function RemoveAddon($Type, $Name, $TransientKey = '') {
      $RequiredPermission = 'Undefined';
      switch ($Type) {
         case SettingsModule::TYPE_APPLICATION:
            $Manager = Gdn::Factory('ApplicationManager');
            $Enabled = 'EnabledApplications';
            $Remove  = 'RemoveApplication';
            $RequiredPermission = 'Garden.Settings.Manage';
         break;
         case SettingsModule::TYPE_PLUGIN:
            $Manager = Gdn::Factory('PluginManager');
            $Enabled = 'EnabledPlugins';
            $Remove  = 'RemovePlugin';
            $RequiredPermission = 'Garden.Settings.Manage';
         break;
      }
      
      $Session = Gdn::Session();
      if ($Session->ValidateTransientKey($TransientKey) && $Session->CheckPermission($RequiredPermission)) {
         try {
            if (array_key_exists($Name, $Manager->$Enabled()) === FALSE) {
               $Manager->$Remove($Name);
            }
         } catch (Exception $e) {
            $this->Form->AddError(strip_tags($e->getMessage()));
         }
      }
      if ($this->Form->ErrorCount() == 0)
         Redirect('/settings/plugins');
   }
714902
public function delete( $id = null, $name = null, $options = null, $pod = null ) {

		if ( empty( self::$api ) ) {
			self::$api = pods_api();
		}

		$simple_tableless_objects = $this->simple_objects();

		// Bidirectional relationship requirement checks.
		$related_object = pods_v( static::$type . '_object', $options, '' );
		// pod, post_type, taxonomy, etc..
		$related_val = pods_v( static::$type . '_val', $options, $related_object, true );
		// pod name, post type name, taxonomy name, etc..
		$related_sister_id = (int) pods_v( 'sister_id', $options, 0 );

		if ( ! empty( $related_sister_id ) && ! in_array( $related_object, $simple_tableless_objects, true ) ) {
			$related_pod = self::$api->load_pod(
				array(
					'name'       => $related_val,
					'table_info' => false,
				), false
			);

			if ( false !== $related_pod && ( 'pod' === $related_object || $related_object === $related_pod['type'] ) ) {
				$related_field = false;

				// Ensure sister_id exists on related Pod.
				foreach ( $related_pod['fields'] as $related_pod_field ) {
					if ( 'pick' === $related_pod_field['type'] && (int) $related_sister_id === (int) $related_pod_field['id'] ) {
						$related_field = $related_pod_field;

						break;
					}
				}

				if ( ! empty( $related_field ) ) {
					$values = self::$api->lookup_related_items( $options['id'], $pod['id'], $id, $options, $pod );

					if ( ! empty( $values ) ) {
						$no_conflict = pods_no_conflict_check( $related_pod['type'] );

						if ( ! $no_conflict ) {
							pods_no_conflict_on( $related_pod['type'] );
						}

						self::$api->delete_relationships( $values, $id, $related_pod, $related_field );

						if ( ! $no_conflict ) {
							pods_no_conflict_off( $related_pod['type'] );
						}
					}
				}
			}//end if
		}//end if

	}
885359
public function remove($id_option, string $type = 'page'): ?int
  {
    if ( $id_option = $this->_get_id_option($id_option, $type) ){
      return $this->pref->delete($id_option);
    }
    return null;
  }
161936
public function delete ($list_name, $ID, array $data = array()) {
		return $this->deleteMultiple($list_name, array($ID), array($ID => $data));
	}
674553
public static function getById($id, $type = 0, $table = null)
    {
        if ($type instanceof ObjectDefinition)
            $od = $type;
            else $od = new ObjectDefinition($type, $table);

        return parent::getByIdType($id, $od);
    }
787403
public function delete($id) {
		$dt = $this->getDataTable();
		
		if (! $dt)
			return $this->createResponse($this->getNameManager()->getTableNames(), 401, "Tabels");
		
		return $this->createResponse([], 200, "{$this->getNameManager()->entityName}: No Delete");
	}
572162
protected static function write_revert($name, $type, $file)
	{
		// remove the migration just run
		\DB::delete(static::$table)
			->where('name', $name)
			->where('type', $type)
			->where('migration', $file)
		->execute(static::$connection);

		// remove the file from the list of run migrations
		if (($key = array_search($file, static::$migrations[$type][$name])) !== false)
		{
			unset(static::$migrations[$type][$name][$key]);
		}

		// make sure the migrations are in the correct order
		sort(static::$migrations[$type][$name]);

		// and save the update to the config file
		\Config::set('migrations.version.'.$type.'.'.$name, static::$migrations[$type][$name]);
		\Config::save(\Fuel::$env.DS.'migrations', 'migrations');
	}
309706
public function delete($id)
    {
        if ($this->has($id)) {
            //remove instance
            unset($this->instances[$id]);

            //remove interface reference if exists
            foreach ($this->interfaces as $int => $classes) {
                $key = array_search($id, $classes);
                if ($key !== false) {
                    unset($classes[$key]);
                    $this->interfaces[$int] = $classes;
                }
            }

            //remove instance from singleton binding
            if ($this->hasDefinition($id)) {
                $definition = $this->getDefinition($id);
                if ($definition instanceof Singleton) {
                    $definition->deleteStoredInstance();
                }
            }
        }
        return $this;
    }
592266
public function delete($id = null)
    {
        // If an ID is passed to the method, we will set the where clause to check the
        // ID to let developers to simply and quickly remove a single row from this
        // database without manually specifying the "where" clauses on the query.
        if (! is_null($id)) {
            $this->where($this->from.'.id', '=', $id);
        }

        return $this->connection->delete(
            $this->grammar->compileDelete($this), $this->cleanBindings(
                $this->grammar->prepareBindingsForDelete($this->bindings)
            )
        );
    }
1214687
public function remove( $type, $name ) {
		if ( ! $this->exists( $type, $name ) ) {
			return false;
		}

		$pattern  = sprintf( '/(?<=^|;|<\?php\s|<\?\s)%s\s*(\S|$)/m', preg_quote( $this->wp_configs[ $type ][ $name ]['src'], '/' ) );
		$contents = preg_replace( $pattern, '$1', $this->wp_config_src );

		return $this->save( $contents );
	}
938763
protected function morphEagerTo($name, $type, $id)
    {
        return new MorphTo(
            $this->newQuery()->setEagerLoads([]), $this, $id, null, $type, $name
        );
    }
371918
public boolean deleteDocument(String name, String type, String id) throws IOException {
        CloseableHttpClient client = HttpClients.createDefault();
        HttpDelete delete = new HttpDelete(String.format("http://%s:%d/%s/%s/%s", host, port, name, type, id));
        try {
            return client.execute(delete).getStatusLine().getStatusCode() == HttpStatus.SC_OK;
        } finally {
            delete.releaseConnection();
        }
    }
1205122
public function deleteAction($id)
    {
        $request = $this->getRequest();
        $id = $request->get($this->admin->getIdParameter());
        $object = $this->admin->getObject($id);

        if (!$object) {
            throw $this->createNotFoundException(sprintf('unable to find the object with id: %s', $id));
        }

        $this->checkParentChildAssociation($request, $object);

        $this->admin->checkAccess('delete', $object);

        $preResponse = $this->preDelete($request, $object);
        if (null !== $preResponse) {
            return $preResponse;
        }

        if ('DELETE' === $this->getRestMethod()) {
            // check the csrf token
            $this->validateCsrfToken('sonata.delete');

            $objectName = $this->admin->toString($object);

            try {
                $this->admin->delete($object);

                if ($this->isXmlHttpRequest()) {
                    return $this->renderJson(['result' => 'ok'], 200, []);
                }

                $this->addFlash(
                    'sonata_flash_success',
                    $this->trans(
                        'flash_delete_success',
                        ['%name%' => $this->escapeHtml($objectName)],
                        'SonataAdminBundle'
                    )
                );
            } catch (ModelManagerException $e) {
                $this->handleModelManagerException($e);

                if ($this->isXmlHttpRequest()) {
                    return $this->renderJson(['result' => 'error'], 200, []);
                }

                $this->addFlash(
                    'sonata_flash_error',
                    $this->trans(
                        'flash_delete_error',
                        ['%name%' => $this->escapeHtml($objectName)],
                        'SonataAdminBundle'
                    )
                );
            }

            return $this->redirectTo($object);
        }

        // NEXT_MAJOR: Remove this line and use commented line below it instead
        $template = $this->admin->getTemplate('delete');
        // $template = $this->templateRegistry->getTemplate('delete');

        return $this->renderWithExtraParams($template, [
            'object' => $object,
            'action' => 'delete',
            'csrf_token' => $this->getCsrfToken('sonata.delete'),
        ], null);
    }