Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CakePHP adding columns to a table

I have a Profile model/controller in my cake app as well as an index.ctp view in /views/profiles. Now, when I go to add a column to my table that is already filled with data, and then add the corresponding code to the view to pick up this column's data, it just gives me an empty result.

My model:

<?php
        class Profile extends AppModel
        {
                var $name = 'Profile';
        }

?>

My controller:

<?php
        class ProfilesController extends AppController
        {
                var $name = 'Profiles';
                function index()
                {
                        $this->set('profiles', $this->Profile->find('all'));
                }
        }
?>

My views printing (stripped down):

<?php foreach ($profiles as $profile): ?>

<?php echo $profile['Profile']['id']; ?>
<?php echo $profile['Profile']['username']; ?>
<?php echo $profile['Profile']['created']; ?>
<?php echo $profile['Profile']['thumbnail'];?>
<?php echo $profile['Profile']['account'];?>

<?php endforeach; ?>

Basically, the columns id, username, column, thumbnail always have been printing fine, but when I add a column called accountit returns no information (nothing prints, but no errors). Any suggestions?

like image 281
vette982 Avatar asked Dec 29 '22 14:12

vette982


1 Answers

I would delete the files in app/tmp/cache (but keep the directories).

like image 128
dhofstet Avatar answered Jan 07 '23 16:01

dhofstet