Cake\Database\Query::selectTypeMap PHP Метод

selectTypeMap() публичный Метод

When called with no arguments, the current TypeMap object is returned.
public selectTypeMap ( Cake\Database\TypeMap $typeMap = null )
$typeMap Cake\Database\TypeMap The map object to use
    public function selectTypeMap(TypeMap $typeMap = null)
    {
        if ($typeMap === null && $this->_selectTypeMap === null) {
            $this->_selectTypeMap = new TypeMap();
        }
        if ($typeMap === null) {
            return $this->_selectTypeMap;
        }
        $this->_selectTypeMap = $typeMap;
        return $this;
    }

Usage Example

Пример #1
0
 /**
  * Tests the selectTypeMap method
  *
  * @return void
  */
 public function testSelectTypeMap()
 {
     $query = new Query($this->connection);
     $typeMap = $query->selectTypeMap();
     $this->assertInstanceOf(TypeMap::class, $typeMap);
     $another = clone $typeMap;
     $query->selectTypeMap($another);
     $this->assertSame($another, $query->selectTypeMap());
 }