Seleciona pelo Id
@param $type
@param $id
@throws OwlException
177186
function GetById($type, $id){
        $newClass = NAMESPACE_ENTITIES . $type;
        if(class_exists ($newClass)) {
            $class = new $newClass();
            $primaryKey = ModelState::GetPrimary($class);
            if ($primaryKey != null)
                return $this->Get($type, $primaryKey . '=' . $id)->FirstOrDefault();

            return null;
        }

        throw new OwlException("Classe {$newClass} não encontrada", 1);
    }
314929
protected function _find($type, $id) {
        if (is_array($id)) {
            return $this->__mfind($this->index(), $type, $id);
        } else {
            return $this->__find($this->index(), $type, $id);
        }
    }
281599
public function delete($type = null, $id = null)
    {
        $this->_validateActionIsEnabled('delete');

        $this->_event('beforeDelete', [
            'id' => $id
        ]);

        $entity = $this->Model->get($id);

        $this->request->allowMethod(['post', 'delete']);

        if ($this->Model->delete($entity)) {
            $this->Flash->success(__d('CakeAdmin', 'The {0} has been deleted.', [$this->type['singularAliasLc']]));
        } else {
            $this->Flash->error(__d('CakeAdmin', 'The {0} could not be deleted. Please, try again.', [$this->type['singularAliasLc']]));
        }

        $this->_event('afterDelete', [
            'id' => $id
        ]);

        return $this->redirect(['action' => 'index', 'type' => $this->type['name']]);
    }
525891
public function setTypeId( $typeid )
	{
		if ( $typeid == $this->getTypeId() ) { return; }

		$this->_values['typeid'] = (int) $typeid;
		$this->setModified();
	}
534489
public function setTypeId( $typeId )
	{
		if ( $typeId == $this->getTypeId() ) { return; }

		$this->_values['typeid'] = (int) $typeId;
		$this->setModified();
	}
151145
private function set(string $type, string $id)
    {
        // is this already a type/class that is known to match multiple services?
        if (isset($this->ambiguousServiceTypes[$type])) {
            $this->ambiguousServiceTypes[$type][] = $id;

            return;
        }

        // check to make sure the type doesn't match multiple services
        if (!isset($this->types[$type]) || $this->types[$type] === $id) {
            $this->types[$type] = $id;

            return;
        }

        // keep an array of all services matching this type
        if (!isset($this->ambiguousServiceTypes[$type])) {
            $this->ambiguousServiceTypes[$type] = [$this->types[$type]];
            unset($this->types[$type]);
        }
        $this->ambiguousServiceTypes[$type][] = $id;
    }
502156
public function setId($id = null)
    {
        if ($id !== null) {
            $id = preg_replace("/[^a-z0-9_\\\d]/i", '_', $id);

            $this->id = (string) $id;
        }
    }
461463
protected function _create(array $data, $type, $id = null, array $parameters = []) {
        return $this->__create($data, $this->index(), $type, $id, $parameters);
    }
938763
protected function morphEagerTo($name, $type, $id)
    {
        return new MorphTo(
            $this->newQuery()->setEagerLoads([]), $this, $id, null, $type, $name
        );
    }
989069
protected function buildTemplateIdentifier($id, $type = self::TEMPLATE_IDENTIFIER_FORM)
    {
        $type = strtoupper($type);

        return self::TEMPLATE_BRACKETS_OPEN.
            self::TEMPLATE_PREFIX.
            $type.
            '-'.
            $id.
            self::TEMPLATE_BRACKETS_CLOSE;
    }
508790
public function setDatatableId($id)
    {
        if (!array_key_exists($id, self::$instances)) {
            self::$instances[$id] = $this;
        } else {
            throw new \Exception('Identifer already exists');
        }

        return $this;
    }
103704
public function updateEventTypeById($id, $fields) {
        $event = new \CEventType();
        if ($event->Update(array('ID' => $id), $fields)) {
            return $id;
        }

        $this->throwException(__METHOD__, 'event type not updated');
    }
469659
protected function getTypeById($type, $id)
    {
        $items = isset($this->$type) ? $this->$type : [];

        if (false === isset($items[$id])) {
            throw new \RuntimeException(sprintf("Unknown %s item with id '%s'", $type, $id), 404);
        }

        return $items[$id];
    }
1278898
public function addColumn($id, $label, $type) {
        $this->cols[] = new DataColumn($id, $label, $type);
    }
1280195
public function activate(Selector $listener, string $type, string $id)
    {
        $theme = $this->getAvailableTheme($type)->get($id);

        if (! in_array($type, $this->type) || is_null($theme)) {
            return $listener->themeFailedVerification();
        }

        $this->memory->put("site.theme.{$type}", $id);

        return $listener->themeHasActivated($type, $id);
    }
1309480
public function encode($id, $type = '')
    {
        if (!isset($this->_keys[$type])) {
            if ($this->_key === null) {
                $this->_key = $this->crypt->getDerivedKey('secint');
            }

            $this->_keys[$type] = md5($this->_key . $type, true);
        }

        while (true) {
            $rand = mt_rand() & 0xFFFF0000;
            $r = base64_encode(mcrypt_encrypt(MCRYPT_XTEA, $this->_keys[$type], pack('VV', $id, $rand), MCRYPT_MODE_ECB));
            if (strcspn($r, '+/') === 12) {
                return substr($r, 0, -1);
            }
        }

        return $id;
    }
874779
function GetCache($type, $id) {
		if (!isset($this->cache[$type]) || !$this->cache[$type]) // Dont cache this type of call
			return FALSE;
		if (isset($this->_cache[$type][$id]))
			return $this->_cache[$type][$id];
		return FALSE;
	}