Model/CommonDetailModel.php
public function getSection($id, $section = null, $schema = false, $format = true) {
    $foreignKey = $this->belongsTo[$this->parentModel]['foreignKey'];
    $conditions = array("{$this->alias}.{$foreignKey}" => $id);
    if (!is_null($section)) {
      $conditions["{$this->alias}.field LIKE"] = "$section.%";
    }

    $fields = array("{$this->alias}.field", "{$this->alias}.value");
    if (true === $schema) {
      $fields = array("{$this->alias}.field", "{$this->alias}.input", "{$this->alias}.data_type", "{$this->alias}.label");
    }

    $results = $this->find(
        'all', array(
          'conditions' => $conditions,
          'fields' => $fields,
          'order' => array("{$this->alias}.position ASC"),
          'recursive' => -1
        )
    );

    return $this->extractSection($results, $section, $schema, $format);
  }
public function getSection($id, $section = null, $schema = false, $format = true) {
    $foreignKey = $this->belongsTo[$this->parentModel]['foreignKey'];
    $conditions = array("{$this->alias}.{$foreignKey}" => $id);
    if (!is_null($section)) {
      $conditions["{$this->alias}.field LIKE"] = "$section.%";
    }

    $fields = array("{$this->alias}.field", "{$this->alias}.value");
    if (true === $schema) {
      $fields = array("{$this->alias}.field", "{$this->alias}.input", "{$this->alias}.data_type", "{$this->alias}.label");
    }

    $results = $this->find(
        'all', array(
          'conditions' => $conditions,
          'fields' => $fields,
          'order' => array("{$this->alias}.position ASC"),
          'recursive' => -1
        )
    );

    return $this->extractSection($results, $section, $schema, $format);
  }
public function getSection ( $ id , $ section = null , $ schema = false , $ format = true ) { $ foreignKey = $ this -> belongsTo [ $ this -> parentModel ] [ 'foreignKey' ] ; $ conditions = array ( "{$this->alias}.{$foreignKey}" => $ id ) ; if ( ! is_null ( $ section ) ) { $ conditions [ "{$this->alias}.field LIKE" ] = "$section.%" ; } $ fields = array ( "{$this->alias}.field" , "{$this->alias}.value" ) ; if ( true === $ schema ) { $ fields = array ( "{$this->alias}.field" , "{$this->alias}.input" , "{$this->alias}.data_type" , "{$this->alias}.label" ) ; } $ results = $ this -> find ( 'all' , array ( 'conditions' => $ conditions , 'fields' => $ fields , 'order' => array ( "{$this->alias}.position ASC" ) , 'recursive' => - 1 ) ) ; return $ this -> extractSection ( $ results , $ section , $ schema , $ format ) ; }
Gets detailed model record's associated details by section.

Example:

$result = array(
'address' => array('street-number' => '4820', 'street-name' => 'St Marc')
'interior' => array('bathroom' => 3, 'bedroom' => 5, 'kitchen' => 1, 'other' => '')
);

@param integer|string $id Associated record ID.
@param string $section Name of section.
@param boolean $schema TRUE to return the section's schema.
@param boolean $format FALSE if you don't want to format the resultset.
@return array
Gets detailed model record s associated details by section .