@param $id
@param $obj

@return mixed
161466
public function admin_delete( $id, $obj ) {

		global $wp_roles;

		$id = $obj->id;

		if ( ! isset( $obj->data[ $id ] ) ) {
			return $obj->error( __( 'Role not found, it cannot be deleted.', 'pods' ) );
		}

		$default_role = get_option( 'default_role' );

		if ( $id == $default_role ) {
			return $obj->error( sprintf( __( 'You cannot remove the <strong>%s</strong> role, you must set a new default role for the site first.', 'pods' ), $obj->data[ $id ]['name'] ) );
		}

		$wp_user_query = new WP_User_Query( array( 'role' => $id ) );

		$users = $wp_user_query->get_results();

		if ( ! empty( $users ) && is_array( $users ) ) {
			foreach ( $users as $user ) {
				$user_object = new WP_User( $user );

				if ( $user_object->has_cap( $id ) ) {
					$user_object->remove_role( $id );
					$user_object->set_role( $default_role );
				}
			}
		}

		remove_role( $id );

		$roles = array();

		foreach ( $wp_roles->role_objects as $key => $role ) {
			$count = $this->count_users( $key );

			$roles[ $key ] = array(
				'id'           => $key,
				'label'        => $wp_roles->role_names[ $key ],
				'name'         => $key,
				'capabilities' => count( (array) $role->capabilities ),
				'users'        => sprintf( _n( '%s User', '%s Users', $count, 'pods' ), $count ),
			);

			if ( $default_role == $key ) {
				$roles[ $key ]['label'] .= ' (site default)';
			}

			if ( 0 < $count && pods_is_admin( array( 'list_users' ) ) ) {
				$roles[ $key ]['users'] .= '<br /><a href="' . admin_url( esc_url( 'users.php?role=' . $key ) ) . '">' . __( 'View Users', 'pods' ) . '</a>';
			}
		}

		$name = $obj->data[ $id ]['label'] . ' (' . $obj->data[ $id ]['name'] . ')';

		$obj->data        = $roles;
		$obj->total       = count( $roles );
		$obj->total_found = count( $roles );

		$obj->message( '<strong>' . $name . '</strong> ' . __( 'role removed from site.', 'pods' ) );
	}
343753
public function getObject($id, $context, $pageObject = null)
    {
        return self::createObject($this->class, $this->id, $id, $context, $pageObject);
    }
149265
public static function create($id = null)
    {
        $obj = new self();

        $obj->id = ($id) ? (string) $id : Uuid::uuid4()->toString();

        return $obj;
    }
1269705
public function get($id)
	{
		$this->getResponse()
			->setStatusCode(Response::STATUS_CODE_200);
		
		$classifiedService = $this->getServiceLocator()->get('document.service.classified');
		
		try {
			$data = $classifiedService->get($id);
		} catch(\Exception $e) {
			$this->getResponse()
				->setStatusCode(Response::STATUS_CODE_500);
			$data = new \StdClass();
		}
		
		return new JsonModel(array(
			'data' => $data
		));
	}
215541
public function offsetGet($id)
    {
        $value = parent::offsetGet($id);

        if (is_object($value)) {
            $this->initialize($value);
        }

        return $value;
    }
1302400
public function read($id)
    {
        $class = $this->getEntityClassFromType($this->apiRecordType);
        $entity = $this->getEntityManager()->find($class, $id);

        if (!$entity) {
            return new Response('', Response::HTTP_NOT_FOUND);
        }

        return new JsonResponse($this->getApiWriter()->writeObject($entity), Response::HTTP_CREATED);
    }
586679
public function getResponse($id)
	{
		foreach ($this->_responses as $response)
			if ($response->id == $id)
				return $response;

		return null;
	}
154668
public function getAction($id)
    {
        $bundle = $this->getBundleById($id);

        try {
            $this->granted('EDIT', $bundle);
        } catch (\Exception $e) {
            if ($bundle->isEnabled()) {
                $this->granted('VIEW', $bundle);
            } else {
                throw $e;
            }
        }

        return $this->createJsonResponse($bundle);
    }
75039
public function getToken($id)
    {
        $result = $this->request('GET', '/tokens/' . $id);

        return $this->objectConverter->convert($result);
    }
1341669
public static function getEntityObject($objType, $objID=null) {
		if( is_object($objType) ) {
			$objID		= $objType->entity_id;
			$objType	= $objType->entity_type;
		}
		$class = isset(static::$entityClasses[$objType]) ? static::$entityClasses[$objType] : $objType;
		return $class::load($objID);
	}
1306946
public function getById($id)
    {
        if (isset($this->idList[$id])) {
            return $this->idList[$id];
        }

        return null;
    }
523316
public static function invokeWithIocParams($obj, $method) {
        $method = new \ReflectionMethod(get_class($obj), $method);
        $args = [];
        if ($method->getNumberOfParameters() > 0) {
            $params = $method->getParameters();
            foreach ($params as $param) {
                $class = $param->getClass();
                if ($class) {
                    $className = $class->getName();
                    $bean = Ioc::get($className);
                    if (!$bean) {
                        $args[] = method_exists($className, 'instance') ? $className::instance() : new $className();
                    } else {
                        $args[] = $bean;
                    }
                } else {
                    $args[] = null;
                }
            }
        }
        $val = $method->invokeArgs($obj, $args);
        return $val;
    }
206610
public function get_from_id(int $id) {
        $records = $this->get_from_ids([$id]);
        return count($records) ? array_shift($records) : null;
    }
687717
public function parent($id){
		$geo = Geo::find($id)->getParent();
		$this->applyFilter($geo);
		return \Response::json($geo);
	}
334864
protected function resolved($obj)
	{
		if( ! is_object($obj) )
		{
			return true;
		}

		$data = get_object_vars($obj);
		if( count($data) == 2
			&& array_key_exists('id', $data)
			&& array_key_exists('type', $data)
		)
		{
			return false;
		}

		return true;
	}
416265
public function getJS($obj)
    {
        $this->hook('pre-getJS');

        $r = '';
        foreach ($obj->js as $key => $chains) {
            $o = '';
            foreach ($chains as $chain) {
                $o .= $chain->_render().";\n";
            }
            switch ($key) {
                case 'never':
                    // send into debug output
                    //$s = "if(console)console.log(".
                    //    "'Element','".$obj->name."','no action:','".str_replace("\n",'',addslashes($o))."')"
                    //if(strlen($o)>2) $this->addOnReady($s);
                    continue;

                case 'always':
                    $r .= $o;
                    break;
                default:
                    $o = '';
                    foreach ($chains as $chain) {
                        $o .= $chain->_enclose($key)->_render().";\n";
                    }
                    $r .= $o;
            }
        }
        if ($r) {
            $this->addOnReady($r);
        }

        return $r;
    }
801385
public function mapObjToChoice($obj)
    {
        $map = $this->choiceObjMap();

        $choice = [];

        foreach ($map as $key => $props) {
            $choice[$key] = null;

            $props = explode(':', $props);
            foreach ($props as $prop) {
                $choice[$key] = $this->renderChoiceObjMap($obj, $prop);
                break;
            }
        }

        return $choice;
    }