PHP 클래스 Prado\Util\TDataFieldAccessor

TDataFieldAccessor is a utility class that provides access to a field of some data. The accessor attempts to obtain the field value in the following order: - If the data is an array, then the field is treated as an array index and the corresponding element value is returned; - If the data is a TMap or TList object, then the field is treated as a key into the map or list, and the corresponding value is returned. - If the data is an object, the field is treated as a property or sub-property defined with getter methods. For example, if the object has a method called getMyValue(), then field 'MyValue' will retrieve the result of this method call. If getMyValue() returns an object which contains a method getMySubValue(), then field 'MyValue.MySubValue' will return that method call result.
부터: 3.0
저자: Qiang Xue ([email protected])
파일 보기 프로젝트 열기: pradosoft/prado 1 사용 예제들

공개 메소드들

메소드 설명
getDataFieldValue ( $data, $field ) : mixed Evaluates the data value at the specified field.

메소드 상세

getDataFieldValue() 공개 정적인 메소드

- If the data is an array, then the field is treated as an array index and the corresponding element value is returned; the field name can also include dots to access subarrays. For example a field named 'MyField.MySubField' will first try to access $data['MyField.MySubField'], then try $data['MyField']['MySubField']. - If the data is a TMap or TList object, then the field is treated as a key into the map or list, and the corresponding value is returned. - If the data is an object, the field is treated as a property or sub-property defined with getter methods. For example, if the object has a method called getMyValue(), then field 'MyValue' will retrieve the result of this method call. If getMyValue() returns an object which contains a method getMySubValue(), then field 'MyValue.MySubValue' will return that method call result.
public static getDataFieldValue ( $data, $field ) : mixed
리턴 mixed value at the specified field