#5918: Custom CakeSchema::before and CakeSchema::after not called from
SchemaShell
---------------------------------------------------+------------------------
Reporter: joaquin_win | Type: Bug
Status: new | Priority: Medium
Milestone: 1.2.x.x | Component: Shells
Version: RC4 | Severity: Major
Keywords: schema shell joaquin_win markstory | Php_version: n/a
Cake_version: |
---------------------------------------------------+------------------------
For example this schema:
{{{
<?php
/* SVN FILE: $Id$ */
/* Junk schema generated on: 2008-12-23 15:12:49 : 1230061129*/
class JunkSchema extends CakeSchema {
var $name = 'Junk';
function before($event = array()) {
echo 'This is a call to JunkSchema::before(...)';
return true;
}
function after($event = array()) {
echo 'This is a call to JunkSchema::after(...)';
}
var $foobars = array(
'id' => array('type' => 'integer', 'null' =>
false, 'default' => NULL, 'key' => 'primary'),
'indexes' => array('PRIMARY' => array('column' =>
'id', 'unique' => 1))
);
}
?>
}}}
Should print to the console those messages but they aren't. The problem is
produced because SchemaShell has two Schema objects ($this->Schema and a
$Schema object that is created in SchemaShell::run and is passed as a
param to other functions).
[[BR]][[BR]]
SchemaShell::!__run uses $this->Schema instead of receiving as a parameter
the correct one return by the call to CakeSchema::load in SchemaShell::run
[[BR]][[BR]]
I'm not sending a patch since I'm not sure which solution is the correct
one:
* To do $this->Schema = $this->Schema->load() in SchemaShell::run (and
remove the first parameter of !__create and !__update), or
* Add a new $Schema parameter to !__run so that it uses the right one.
--
Ticket URL: <https://trac.cakephp.org/ticket/5918>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---