> Google won't show you your own posts until someone replies to them.
> It's very irritating.

Yes, that is annoying.

I would make sense if CakePHP was generating a model from just the
database table since
I've followed naming convensions.  I have validation rules in my PHP
model class, and when
I do $this->log(print_r($this->MyModel, true), LOG_DEBUG) in my
controller I essentially see
a stubbed model with the columns derived from the table in the DB.

What would cause CakePHP to ignore my model though?

Here's my setup (using cake_1.2.2.8120):


=== app/models/MyModel.php ===
<?php
class MyModel extends AppModel {
  var $name = 'MyModel';
  var $validate = array(... validation here ...);
}
?>
=========================

=== app/controllers/my_controller.php ===
<?php
class MyController extends AppController {
  var $uses = array('MyModel');
  var $helpers = array('Html', 'Javascript');
  var $components = array('Session');

  function index() {
        // this is what logs the empty stubbed model CakePHP appears
to have generated
        $this->log("\$this->MyModel: ".print_r($this->MyModel, true),
LOG_DEBUG);
        $result = $this->MyModel->save($this->data);
        if ($result) {
            $this->log("valid result");

            $this->Session->setFlash("Sucess",
                                         'default',
                                         array('class' => 'success'));
        }
        else {
            $this->log("invalid result");

            $this->Session->setFlash("Error",
                                         'default',
                                         array('class' => 'error'));
       }
    }
}
?>
==============================

On Apr 21, 9:28 am, brian <[email protected]> wrote:
> On Tue, Apr 21, 2009 at 10:06 AM, Temujin <[email protected]> wrote:
>
> > I tried posting this yesterday, but since I can't seem to see it
> > anywhere, I'm reposting (sorry for any duplication).
>
> Google won't show you your own posts until someone replies to them.
> It's very irritating.
>
>
>
> > I am at my wits end here. CakePHP appears to have somehow cached my
> > model class. Not the data in the database that corresponds to this
> > model, but the actual model class itself. Any change I make in the
> > model class simply gets ignored.
>
> > I have done the following to try to make sure nothing is cached:
>
> >    * Turn off caching in config/core.php (Configure::write
> > ('Cache.disable', true))
> >    * completely removed anything in app/tmp
> >    * set cacheQueries and cacheSources to false in the model
> >    * restart apache (this shouldn't do anything, but what the hay)
>
> > I've tried putting syntax errors in my model class, a divide by zero,
> > an exit command before the class definition, and even removed the
> > model file, but every time the controller somehow happily loads a
> > valid model up and moves on.
>
> > What is going on here? Is there some hidden cache somewhere that I
> > need to delete?
>
> > I've developed other CakePHP apps, but I've never encountered this
> > before.
>
> Weird. Are you sure you're hitting the correct app?
>
> I know that Cake can create a model strictly from a DB table if it
> sees an association from some other model. I'm really not sure about
> exactly what's going on with that, but I know that, a couple of times,
> I've created associations to models which didn't exist except as
> tables. Maybe that's what's going on here.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"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/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to