cacheMetadata() public method

Changing this setting will not modify existing schema collections objects.
public cacheMetadata ( boolean | string $cache ) : void
$cache boolean | string Either boolean false to disable meta dataing caching, or true to use `_cake_model_` or the name of the cache config to use.
return void
Example #1
2
 /**
  * Constructor
  *
  * @param \Phinx\Db\Adapter\AdapterInterface $adapter The original adapter to decorate.
  * @param \Cake\Database\Connection $connection The connection to actually use.
  */
 public function __construct(AdapterInterface $adapter, Connection $connection)
 {
     $this->adapter = $adapter;
     $this->connection = $connection;
     $pdo = $adapter->getConnection();
     if ($pdo->getAttribute(PDO::ATTR_ERRMODE) !== PDO::ERRMODE_EXCEPTION) {
         $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     }
     $connection->cacheMetadata(false);
     $connection->driver()->connection($pdo);
 }
 /**
  * @inheritDoc
  */
 public function cacheMetadata($cache)
 {
     $this->_schemaMethodsCollection = null;
     parent::cacheMetadata($cache);
 }
Example #3
-3
 /**
  * Constructor
  *
  * @param \Phinx\Db\Adapter\AdapterInterface $adapter The original adapter to decorate.
  * @param \Cake\Database\Connection $connection The connection to actually use.
  */
 public function __construct(AdapterInterface $adapter, Connection $connection)
 {
     $this->adapter = $adapter;
     $this->connection = $connection;
     $pdo = $adapter->getConnection();
     if ($pdo->getAttribute(PDO::ATTR_ERRMODE) !== PDO::ERRMODE_EXCEPTION) {
         $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     }
     $connection->cacheMetadata(false);
     if ($connection->driver() instanceof Postgres) {
         $config = $connection->config();
         $schema = empty($config['schema']) ? 'public' : $config['schema'];
         $pdo->exec('SET search_path TO ' . $schema);
     }
     $connection->driver()->connection($pdo);
 }