src/App.php
public function __async_quantityFieldsRow($structureId, $entityID)
    {
        $structureFields = null;

        // Get all fields of table structure
        if ($this->query->className('field')
            ->join('structurefield')
            ->cond('StructureID', $structureId)
            ->exec($structureFields)
        ) {

            $fields = array();

            /** @var \samson\cms\CMSField $field Field object */
            foreach ($structureFields as $field) {
                // Add field to fields collection
                $fields[$field->id] = $field;
            }

            $countOfFields = $this->query->className('material')
                ->cond('parent_id', $entityID)
                ->cond('type', 3)
                ->cond('materialfield.FieldID', array_keys($fields))
                ->cond('Active', 1)
                ->join('materialfield')
                ->group_by('MaterialID')
                ->count();

            return array('status' => 1, 'countOfFields' => $countOfFields);
        } else {
            return array('status' => 0);
        }
    }
public function __async_quantityFieldsRow($structureId, $entityID)
    {
        $structureFields = null;

        // Get all fields of table structure
        if ($this->query->className('field')
            ->join('structurefield')
            ->cond('StructureID', $structureId)
            ->exec($structureFields)
        ) {

            $fields = array();

            /** @var \samson\cms\CMSField $field Field object */
            foreach ($structureFields as $field) {
                // Add field to fields collection
                $fields[$field->id] = $field;
            }

            $countOfFields = $this->query->className('material')
                ->cond('parent_id', $entityID)
                ->cond('type', 3)
                ->cond('materialfield.FieldID', array_keys($fields))
                ->cond('Active', 1)
                ->join('materialfield')
                ->group_by('MaterialID')
                ->count();

            return array('status' => 1, 'countOfFields' => $countOfFields);
        } else {
            return array('status' => 0);
        }
    }
public function __async_quantityFieldsRow ( $ structureId , $ entityID ) { $ structureFields = null ; // Get all fields of table structure if ( $ this -> query -> className ( 'field' ) -> join ( 'structurefield' ) -> cond ( 'StructureID' , $ structureId ) -> exec ( $ structureFields ) ) { $ fields = array ( ) ; /** @var \samson\cms\CMSField $field Field object */ foreach ( $ structureFields as $ field ) { // Add field to fields collection $ fields [ $ field -> id ] = $ field ; } $ countOfFields = $ this -> query -> className ( 'material' ) -> cond ( 'parent_id' , $ entityID ) -> cond ( 'type' , 3 ) -> cond ( 'materialfield.FieldID' , array_keys ( $ fields ) ) -> cond ( 'Active' , 1 ) -> join ( 'materialfield' ) -> group_by ( 'MaterialID' ) -> count ( ) ; return array ( 'status' => 1 , 'countOfFields' => $ countOfFields ) ; } else { return array ( 'status' => 0 ) ; } }
Update quantity fields table row
@param int $structureId Current table structure identifier
@param int $entityID Current table entity identifier
@return array AJAX response
Update quantity fields table row