Yes it was that podcast, and it was just a brief question about how to build a Model without a table. I tried to listen again to find it, but it's a long podcast, so I wasn't successful in finding the answer for you.
I'd suggest going to the #cakephp channel and asking the question again. On Dec 23, 8:28 am, George <[email protected]> wrote: > Hmm...are you sure you linked the right podcast? That seemed to be > only about formHelper. I listened to the whole thing and didn't hear > anything related to setting up models without tables. > > Does anyone know how to check some sort of diagnostics on a model at > runtime to see if the parameters are even being loaded correctly? I > tried for instance, making a simple controller/model combination and > then using Debugger:dump(); However, the output doesn't seem to show > that the table name was changed at runtime. Here's the code for the > controller, model, and the output of the dump: > > <?php > class PostsController extends AppController { > function index() { > $this->set('posts', 'test'); > Debugger::dump($this->Post); > }} > > ?> > > <?php > class Post extends AppModel > { > var $useTable = 'reports';} > > ?> > > OUTPUT: > AppModel > AppModel::$useDbConfig = "default" > AppModel::$useTable = "posts" > AppModel::$displayField = "title" > AppModel::$id = false > AppModel::$data = array > AppModel::$table = "posts" > AppModel::$primaryKey = "id" > AppModel::$_schema = array > AppModel::$validate = array > AppModel::$validationErrors = array > AppModel::$tablePrefix = "" > AppModel::$name = "Post" > AppModel::$alias = "Post" > AppModel::$tableToModel = array > AppModel::$logTransactions = false > AppModel::$transactional = false > AppModel::$cacheQueries = false > AppModel::$belongsTo = array > AppModel::$hasOne = array > AppModel::$hasMany = array > AppModel::$hasAndBelongsToMany = array > AppModel::$actsAs = NULL > AppModel::$Behaviors = BehaviorCollection object > AppModel::$whitelist = array > AppModel::$cacheSources = true > AppModel::$findQueryType = NULL > AppModel::$recursive = 1 > AppModel::$order = NULL > AppModel::$__exists = NULL > AppModel::$__associationKeys = array > AppModel::$__associations = array > AppModel::$__backAssociation = array > AppModel::$__insertID = NULL > AppModel::$__numRows = NULL > AppModel::$__affectedRows = NULL > AppModel::$_findMethods = array > AppModel::$_log = NULL > > To me, it seems like my model isn't even being loaded at all. The dump > just seems to show the AppModel parameters, and not anything of my > actual extended model Post. (note that $useTable is 'posts' and not > 'reports', as I clearly set it in the model code) I must be doing > something wrong here. > > On Dec 22, 8:50 pm, Webweave <[email protected]> wrote: > > > This podcasthttp://live.cakephp.org/shows/view/4hassome info on > > what you need to do for this. There's a method you have to implement > > (sorry I didn't write it down). > > > On Dec 22, 11:26 am, George <[email protected]> wrote: > > > > Thanks for the suggestion, but unfortunately it didn't seem to do > > > anything, and I still am getting a complaint that the reports table > > > for the Report model was not found. Here is the exact code in the > > > model: > > > > <?php > > > class Report extends AppModel { > > > var $useTable = false; > > > > public function getYearlySalesStats($year) { > > > return $this->query("EXECUTE report_SalesStats $year, > > > NULL"); > > > }} > > > > ?> > > > > Annoying. The manual seems to say pretty cut and dry that by setting > > > the $useTable member equal to false, cake will ignore the table > > > requirement. > > > > For more info, I'm running cake on fedora/apache, and using MSSQL > > > Server as my database. > > > > On Dec 19, 12:59 am, Kappa <[email protected]> wrote: > > > > > Have you tried to reset the cache? Sometimes i have the same > > > > problem, and i solve it deleting the cache in /app/tmp/cache > > > > > bye, > > > > Andrea > > > > > On Dec 18, 6:55 pm,George<[email protected]> wrote: > > > > > > Hello. > > > > > > I'm pretty new to cake and am working on creating a reporting intranet > > > > > application. Basically I aggregate a bunch of data through views and > > > > > stored procedures on the database, and would like to build a "Report" > > > > > model that will just have a bunch of custom functions to run the > > > > > various stored procedures. As the functions would be returning > > > > > datasets in different forms (based on the various reports), I wouldn't > > > > > want this to actually be associated with any one table (the data is > > > > > aggregated from many tables). > > > > > > I've read here that you can set the $useTable attribute in a model to > > > > > false and then cake won't try to locate the model in the database. > > > > > After setting $useTable to both false and null, I still have cake > > > > > complaining that it can't find the table reports in the database when > > > > > I call any action on the ReportsController. > > > > > > Is there something else I need to set/do? Or should I not be even > > > > > using a model at all in this case, and query directly from the > > > > > controller? To me, it seemed like encapsulating all database calls in > > > > > models would be the best solution, but does anyone else with more cake > > > > > experience have an opinion? > > > > > > Thanks. > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
