Sets the schema for the element

@param Element $obj The element to analyze

@return Element the translated element
338303
public function preCacheTranslateObject(ModelObject $obj)
    {
        // merge aspects
        //$db = $this->getConnection();

//        $q = new Query();
//        $q->select('aspectid');
//        $q->from('elementaspectrel');
//        $q->where("elementid = {$db->quote($obj->{$obj->getPrimaryKey()})}");

//        $aspectIDs = $db->readCol($q);

//        $this->populateRels();

//        $aspectSlugs = array_key_exists($obj->Slug, $this->aspectrel)?$this->aspectrel[$obj->Slug]['Aspects']:array();

        $aspectSlugs = $obj->getAspectSlugs();

        $schema = new NodeSchema();

        if (!empty($aspectSlugs)) {

            $aspects = $this->AspectDAO->multiGetBySlug($aspectSlugs);

            $newAspects = array();
            foreach ($aspects as $aspect) {
//                $plugin = $this->PluginService->getByID($aspect['PluginID']);
//                if(empty($plugin) || !$plugin->isInstalled() || !$plugin->isEnabled())
//                    continue;


                $aspectSchema = $aspect->getSchema();
                foreach ($aspectSchema->getTagDefs() as $tagDef)
                    $schema->addTagDef($tagDef);
                foreach ($aspectSchema->getMetaDefs() as $metaDef)
                    $schema->addMetaDef($metaDef);

                $newAspects[] = $aspect;
            }

            $obj->setAspects($newAspects);

        }

        $obj->setSchema($schema);
        $obj->setAnchoredSite($this->SiteService->getAnchoredSite());
        $obj->setAnchoredSiteSlug($obj->getAnchoredSite()->getSlug());

        return $obj;
    }
1069432
private function applyTransaction($obj)
    {
        if(null !== $this->str_next_transaction) {
            $obj->setTransaction($this->str_next_transaction);
            $this->str_next_transaction = null;
        }
        return $obj;
    }
625641
public function pegaAtributosDoObjeto($obj)
    {
        $properties      = [];
        $reflectionClass = new ReflectionClass($obj);
        $propriedades    = $reflectionClass->getProperties(
            ReflectionProperty::IS_PUBLIC |
            ReflectionProperty::IS_PROTECTED | 
            ReflectionProperty::IS_PRIVATE
        );
     
        $iterator = 0;
        $limit    = count($propriedades);
        for ($iterator = 0; $iterator < $limit; $iterator++) {
            $properties[$iterator] = $propriedades[$iterator]->name;
        }

        return $properties;
    }
1079019
protected function setupObject()
    {
        $schemaType = strtoupper($this->getAttribute("type"));
        $this->copy($this->getDatabase()->getPlatform()->getDomainForType($schemaType));

        //Name
        $this->name = $this->getAttribute("name");

        // Default value
        $defval = $this->getAttribute("defaultValue", $this->getAttribute("default"));
        if ($defval !== null) {
            $this->setDefaultValue(new ColumnDefaultValue($defval, ColumnDefaultValue::TYPE_VALUE));
        } elseif ($this->getAttribute("defaultExpr") !== null) {
            $this->setDefaultValue(new ColumnDefaultValue($this->getAttribute("defaultExpr"), ColumnDefaultValue::TYPE_EXPR));
        }

        $this->size = $this->getAttribute("size");
        $this->scale = $this->getAttribute("scale");
        $this->description = $this->getAttribute("description");
    }
427190
private function objectToXml($obj, $dom = 0, $item = 0)
    {
        if (!$dom) {
            $dom = new \DOMDocument("1.0");
        }
        if (!$item) {
            $item = $dom->createElement("root");
            $dom->appendChild($item);
        }
        //var_dump($obj);
        foreach ($obj as $key => $val) {
            $itemx = $dom->createElement(is_string($key) ? $key : "item");
            $item->appendChild($itemx);

            if (!is_object($val)) {
                if (is_array($val)) {
                    $val = $this->arrToXml($val, $dom, $itemx);
                } else {
                    $text = $dom->createTextNode($val);
                    $itemx->appendChild($text);
                }
            } else {
                $this->objectToXml($val, $dom, $itemx);
            }
        }
        return $dom->saveXML();
    }
81085
public function whereTuple($obj)
    {
        $where = $obj->buildWhere();
        if ($where) {
            $where = substr($where, 6);
        }
        $this->_sql['wheretuple'][] = [$where, 'and'];
        return $this;
    }
421990
def obj_for(self, obj_or_name: Union[str, Element]) -> Optional[Union[str, Element]]:
        
        name = obj_or_name.name if isinstance(obj_or_name, Element) else obj_or_name
        return self.schema.classes[name] if name in self.schema.classes \
            else self.schema.slots[name] if name in self.schema.slots \
            else self.schema.types[name] if name in self.schema.types else name if name in builtin_names \
            else None
599026
public function setClassName($sClass)
    {
        $this->sPrefix = $this->getOption('core.prefix.function');

        $sClass = trim($sClass, '.\\ ');
        if(!$sClass)
        {
            return $this;
        }

        if(!($xCallable = $this->xRepository->getCallableObject($sClass)))
        {
            // Todo: decide which of these values to return
            // return null;
            return $this;
        }

        $this->sPrefix = $this->getOption('core.prefix.class') . $xCallable->getJsName() . '.';
        return $this;
    }
748352
public function delete($obj){
        $key  = $this->getModel()->table() . '_' . $obj->{$this->getModel()->getPK()->identifier()};
        $this->getDriver()->remove($key);

        return $this->getModel()->delete($obj);
    }
929864
private function toArray($obj) {
        $arr = array();

        if (is_array($obj)) {
            foreach ($obj as $value) {
                $arr[] = $this->toArray($value);
            }
        } else if (is_object($obj)) {
            $arObj = (array) $obj;
            foreach ($arObj as $key => $value) {
                $attribute = str_replace(get_class($obj), "", $key);
                if (is_object($value) || is_array($value)) {
                    $value = $this->toArray($value);
                } else {
                    $arr[$attribute] = $this->utf8_encode_all($value);
                }
            }
        } else {
            $arr = $this->utf8_encode_all($obj);
        }
        return $arr;
    }
11324
public Message setObject(Object obj) {
        if(obj == null) return this;
        if(obj instanceof byte[])
            return setBuffer((byte[])obj);
        if(obj instanceof Buffer)
            return setBuffer((Buffer)obj);
        try {
            return setBuffer(Util.objectToByteBuffer(obj));
        }
        catch(Exception ex) {
            throw new IllegalArgumentException(ex);
        }
    }
791290
public function sub($obj, $cb)
    {
        $act = $this->count() === 0;
        $this->attach($obj, $cb);
        if ($act) {
            if (($func = $this->actCb) !== null) {
                $func($this);
            }
        }
        return $this;
    }
164480
public function Equals( $obj )
	{
		/**
		 * @var SequenceType $dest
		 */
		$dest = $obj;
		if ( ! is_null( $obj ) )
		{
			return $this->TypeCode == $dest->TypeCode &&
				$this->SchemaElement == $dest->SchemaElement &&
				$this->SchemaAttribute == $dest->SchemaAttribute &&
				$this->SchemaType == $dest->SchemaType &&
				$this->Cardinality == $dest->Cardinality;
		}
		return false;
	}
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;
    }
1193921
public function setObjectId($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }

        if ($this->object_id !== $v) {
            $this->object_id = $v;
            $this->modifiedColumns[SkillTableMap::COL_OBJECT_ID] = true;
        }

        if ($this->aObject !== null && $this->aObject->getId() !== $v) {
            $this->aObject = null;
        }

        return $this;
    }
432918
function toXML(obj) {
  var xml = ''
  for (var prop in obj) {
    xml += `<${prop}>${obj[prop]}</${prop}>`
  }
  return xml
}
953288
protected function objectToArray($obj) : array
    {
        if ($obj instanceof \stdClass) {
            $obj = json_decode(json_encode($obj), true);
        }

        return (array)$obj;
    }