generateAllFor<FieldName>

conflicts with CAKE/Model/Model::_call() so no findBy<FieldName>.
(and various very minor other things.)
pull/63/head
Charlie Root 2012-12-19 10:30:10 +00:00
parent b78251d5f0
commit e474b8e189
5 changed files with 31 additions and 5 deletions

View File

@ -450,7 +450,7 @@ class AppController extends Controller {
if (!self::_isAdmin()) throw new NotFoundException();
$this->loadModel('Attribute');
$attributes = $this->Attribute->find('all',array('recursive' => 0));
$attributes = $this->Attribute->find('all', array('recursive' => 0));
foreach ($attributes as $attribute) {
if ($attribute['Attribute']['private']) {
$attribute['Attribute']['private'] = true;
@ -465,7 +465,7 @@ class AppController extends Controller {
if (!self::_isAdmin()) throw new NotFoundException();
$this->loadModel('Event');
$events = $this->Event->find('all',array('recursive' => 0));
$events = $this->Event->find('all', array('recursive' => 0));
foreach ($events as $event) {
if ($event['Event']['private']) {
$attribute['Event']['private'] = true;
@ -558,6 +558,10 @@ class AppController extends Controller {
// do the actual call
return call_user_func_array(array($this, 'generateAllFor'), $methodArgs);
}
//if (strpos($method, 'findBy') === 0) {
// //debug(true);debug(tru);
//}
return false;
}
}

View File

@ -15,6 +15,7 @@ class RegexController extends AppController {
'Regex.id' => 'ASC'
)
);
public $helpers = array('Js' => array('Jquery'));
public function beforeFilter() {

View File

@ -67,15 +67,26 @@ class AppModel extends Model {
return $result;
}
public function __call($method, $args) {
public function XXXX__call($method, $params) {
// Notice (8): Undefined index: Id [CORE/Cake/Model/Model.php, line 2673]
// Notice (8): Undefined index: Id [CORE/Cake/Model/Model.php, line 2650]
if (strpos($method, 'findBy') === 0) {
debug($method);
parent::__call($method, $params);
debug($methodArgs);
}
if (strpos ($method, 'generateAllFor') === 0) {
// massage the args
$methodArgs = $args;
$methodArgs = $params;
$methodArgs[0] = str_replace('generateAllFor', '', $method); // TODO
//array_unshift($methodArgs, str_replace('generateAllFor', '', $method));
// do the actual call
return call_user_func_array(array($this, 'generateAllFor'), $methodArgs);
}
return false;
}
}

View File

@ -1,4 +1,4 @@
<li><?php
<li><?php
if ($isAclAdd) echo $this->Html->link(__('New Event', true), array('controller' => 'events', 'action' => 'add')); ?></li>
<li><?php echo $this->Html->link(__('List Events', true), array('controller' => 'events', 'action' => 'index')); ?></li>
<li><?php echo $this->Html->link(__('List Attributes', true), array('controller' => 'attributes', 'action' => 'index')); ?> </li>

View File

@ -0,0 +1,10 @@
PDO error
<h2><?php echo $name; ?></h2>
<p class="error">
<strong><?php echo __d('cake', 'Error'); ?>: </strong>
<?php echo __d('cake', 'An Internal Error Has Occurred.'); ?>
</p>
<?php
if (Configure::read('debug') > 0 ):
echo $this->element('exception_stack_trace');
endif;