src/CMSField.php
public function update($structureID = 0)
    {
        // Fill the fields from $_POST array
        foreach ($_POST as $key => $val) {
            $this[$key]=$val;
        }

        $this->save();
        /** @var \samson\cms\web\navigation\CMSNav $cmsnav */

        // If isset current structure
        if (dbQuery('\samson\cms\web\navigation\CMSNav')->id($structureID)->first($cmsnav)) {

            // If structure has not relation with current field
            if (!dbQuery('structurefield')->StructureID($cmsnav->id)->FieldID($this->id)->first()) {

                // Create new relation between structure and field
                $strField = new \samson\activerecord\structurefield(false);
                $strField->FieldID = $this->id;
                $strField->StructureID = $cmsnav->id;
                $strField->Active = 1;

                // Save relation
                $strField->save();
            }
        }
    }
public function update($structureID = 0)
    {
        // Fill the fields from $_POST array
        foreach ($_POST as $key => $val) {
            $this[$key]=$val;
        }

        $this->save();
        /** @var \samson\cms\web\navigation\CMSNav $cmsnav */

        // If isset current structure
        if (dbQuery('\samson\cms\web\navigation\CMSNav')->id($structureID)->first($cmsnav)) {

            // If structure has not relation with current field
            if (!dbQuery('structurefield')->StructureID($cmsnav->id)->FieldID($this->id)->first()) {

                // Create new relation between structure and field
                $strField = new \samson\activerecord\structurefield(false);
                $strField->FieldID = $this->id;
                $strField->StructureID = $cmsnav->id;
                $strField->Active = 1;

                // Save relation
                $strField->save();
            }
        }
    }
public function update ( $ structureID = 0 ) { // Fill the fields from $_POST array foreach ( $ _POST as $ key => $ val ) { $ this [ $ key ] = $ val ; } $ this -> save ( ) ; /** @var \samson\cms\web\navigation\CMSNav $cmsnav */ // If isset current structure if ( dbQuery ( '\samson\cms\web\navigation\CMSNav' ) -> id ( $ structureID ) -> first ( $ cmsnav ) ) { // If structure has not relation with current field if ( ! dbQuery ( 'structurefield' ) -> StructureID ( $ cmsnav -> id ) -> FieldID ( $ this -> id ) -> first ( ) ) { // Create new relation between structure and field $ strField = new \ samson \ activerecord \ structurefield ( false ) ; $ strField -> FieldID = $ this -> id ; $ strField -> StructureID = $ cmsnav -> id ; $ strField -> Active = 1 ; // Save relation $ strField -> save ( ) ; } } }
Updating field and creating relation with structure
@param int $structureID
Updating field and creating relation with structure