ElggObject::create PHP Method

create() protected method

protected create ( )
    protected function create()
    {
        $guid = parent::create();
        if (!$guid) {
            // @todo this probably means permission to create entity was denied
            // Is returning false the correct thing to do
            return false;
        }
        $dbprefix = elgg_get_config('dbprefix');
        $query = "INSERT INTO {$dbprefix}objects_entity\n\t\t\t(guid, title, description)\n\t\t\tVALUES\n\t\t\t(:guid, :title, :description)";
        $params = [':guid' => (int) $guid, ':title' => (string) $this->title, ':description' => (string) $this->description];
        $result = $this->getDatabase()->insertData($query, $params);
        if ($result === false) {
            // TODO(evan): Throw an exception here?
            return false;
        }
        return $guid;
    }