/**
  * Save the schema into lock file.
  *
  * @param array $options Set connection name and path to save the schema.lock file.
  * @return void
  */
 public function save($options = [])
 {
     $this->_config = array_merge($this->_config, $this->params, $options);
     if ($this->_config['no-interaction']) {
         $this->interactive = false;
     }
     parent::bake('schema');
 }
Esempio n. 2
0
 /**
  * Test baking within a plugin.
  *
  * @return void
  */
 public function testBakePlugin()
 {
     $this->_loadTestPlugin('TestBake');
     $path = Plugin::path('TestBake');
     $this->Task->plugin = 'TestBake';
     $this->Task->expects($this->once())->method('createFile')->with($this->_normalizePath($path . 'src/Model/Behavior/ExampleBehavior.php'), $this->stringContains('class ExampleBehavior extends Behavior'));
     $result = $this->Task->bake('Example');
     $this->assertSameAsFile(__FUNCTION__ . '.php', $result);
 }
 /**
  * main() method.
  *
  * @return bool|int Success or error code.
  */
 public function generate(array $options = [])
 {
     // Hook into the bake process to load our SchemaHelper
     EventManager::instance()->on('Bake.initialize', function (Event $event) {
         $view = $event->subject;
         $view->loadHelper('Schema.Schema');
     });
     $this->_config = array_merge($this->_config, $this->params, $options);
     if ($this->_config['no-interaction']) {
         $this->interactive = false;
     }
     if (!file_exists($this->_config['path'])) {
         throw new Exception(sprintf('Schema file "%s" does not exist.', $this->_config['path']));
     }
     parent::bake('seed');
 }
Esempio n. 4
0
 /**
  * {@inheritDoc}
  */
 public function bake($name)
 {
     $this->params['no-test'] = true;
     return parent::bake($name);
 }
Esempio n. 5
0
 /**
  * Bake the Mailer class and html/text layout files.
  *
  * @param string $name The name of the mailer to make.
  * @return string
  */
 public function bake($name)
 {
     $this->bakeLayouts($name);
     return parent::bake($name);
 }