public function setSchema($schema)
    {
        if (is_array($schema)) {
            $constraints = [];

            if (isset($schema['_constraints'])) {
                $constraints = $schema['_constraints'];
                unset($schema['_constraints']);
            }

            $schema = new TableSchema($this->getTable(), $schema);

            foreach ($constraints as $name => $value) {
                $schema->addConstraint($name, $value);
            }
        }

        $this->_schema = $schema;

        return $this;
    }
public function setSchema($schema)
    {
        if (is_array($schema)) {
            $constraints = [];

            if (isset($schema['_constraints'])) {
                $constraints = $schema['_constraints'];
                unset($schema['_constraints']);
            }

            $schema = new TableSchema($this->getTable(), $schema);

            foreach ($constraints as $name => $value) {
                $schema->addConstraint($name, $value);
            }
        }

        $this->_schema = $schema;

        return $this;
    }
public function setSchema ( $ schema ) { if ( is_array ( $ schema ) ) { $ constraints = [ ] ; if ( isset ( $ schema [ '_constraints' ] ) ) { $ constraints = $ schema [ '_constraints' ] ; unset ( $ schema [ '_constraints' ] ) ; } $ schema = new TableSchema ( $ this -> getTable ( ) , $ schema ) ; foreach ( $ constraints as $ name => $ value ) { $ schema -> addConstraint ( $ name , $ value ) ; } } $ this -> _schema = $ schema ; return $ this ; }
Sets the schema table object describing this table's properties.

If an array is passed, a new TableSchema will be constructed
out of it and used as the schema for this table.

@param array|\Cake\Database\Schema\TableSchema $schema Schema to be used for this table
@return $this
Sets the schema table object describing this table s properties .