Re: Are we using the slowest PHP framework there is?
We can't forget that even not using $uses, when loading a Model it will construct all its links, and its link will construct all of their links, and so forth... So, anyway, you are most probably going to load each and every model by just loading a single one - even though they might have nothing to do with the request. On Feb 18, 11:15 am, mark_story wrote: > On Feb 17, 8:35 pm, Motin wrote: > > > > > CakePHP does have some issues with aggressive loading, and have > > terrible performance in a lot of areas, but that benchmark, doesn't > > really measure anything regarding to Yii. Because of Yii's lazy > > loading, practically none of the commonly used objects/classes are > > loaded in the test application. This makes it practically the same as > > barebones PHP. However, in a real application, when the helpers and > > models are actually used (and thus loaded), I think the results would > > look much different. > > > Also, CakePHP is meant to be run with a non-file-based cache engine + > > a php accelerator. > > > Still, I believe that Yii is much faster for slimmed down > > applications, and I really hope that CakePHP can learn something from > > the lazy loading parts (why on earth does Cake load _all_ models in > > $uses on each request - instead of when they are actually used? for > > instance). > > Well PHP4 is one reason. Lazy loading doesn't work so well in PHP4, > also using $uses is known to cause performance issues as you end up > loading far too many models. You ask about why cake doesn't lazy > load, but by using $uses you are doing the opposite of lazy loading. > $uses is probably the most aggressive loading strategy you can > implement. Using Controller::loadModel() or ClassRegistry::init() is > a more _lazy_ approach. > > -Mark --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Can a model belong to and habtm one model?
yes you can, just assign different aliases like 'Owner' and 'OwnerFriends' eagerterrier wrote: > I have a facebook type app that I need to build for a client (don't we > all?) and in it I have a model that ideally needs to be owned by one > user, and also habtm other users (the owners friends) > > Before I go too far, I want to know if this approach is possible, or > should I just stick another field in the habtm join table that is > something along the lines of is_owner (boolean) > > Is this crossing the streams in Ghostbusters, or is it something very > run of the mill that I just haven't done yet (8 cake sites under my > belt and counting...) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: REgarding using Mysql functions like NOW(), CURDATE() etc
> Finally if you are hopping that cake allow you to make mysql function calls > inside a query you should read thishttps://trac.cakephp.org/ticket/5345as > stateted that "it would actually > make SQL injection a *feature" > Notice that every user input should be properly sanitized and escaped if you plan to use it as a SQL expression with DboSource::expression (). So, as you can see in my article, you can use SQL functions like this: // inside the model scope $db = $this->getDataSource(); $this->data[$this->alias]['signedup'] = $db->expression('CURDATE()'); but be aware that expressions won't be automatically escaped so you need to it manually with DboSource::value() : $db = $this->getDataSource(); $expression = sprintf("CONCAT('[', %s, ']')", $db->value($userInput)); $this->data[$this->alias]['signedup'] = $db->expression($expression); hope it's somewhat clarifying Rafael Bandeira rafaelbandeira3.wordpress.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: multiple [controllerName].po files + normal core.po?
> PS a controller should itself have very few __ calls (only flash messages) ... And be said that even this can be delegated to the view layer --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: calling exit() after redirect STILL redirects
> Deleting this key solved the problem. instead of deleting the session key, why don't you set the right url on AuthComponent::$loginRedirect? $this->Auth->loginRedirect = array('controller' => 'user', 'action' => 'info'); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: JQuery and AjaxHelper
> I was wondering if there is anyway in order to still use the Ajax > helper (I don't really want to write all the code to implement it > everytime) while using JQuery instead of Prototype and Scriptaculous? No. There's no way of doing this. AjaxHelper only spits code based on Prototype and Scriptaculous, it does nothing more than this. If you want something to spit code based on JQuery, you need either code your own helper or search google for existing ones - there are some. In my opinion: - Javascript should be coded as such, so, why not to write the code on a proper file and load it? - If you still want it to be done on PHP - with a helper - do not go for one. Write your own. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: HABTM pagination
grigri wrote: > @Markus and Rafael Oh come on... I wasn't asking, I was answering... the code supplied by the thread author is invalid, and I pointed it out. Every method presented since then is just fine. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: HABTM pagination
> $this->set('filters',$this->Listing->Cuisine->find('all',array > ('conditions'=>array('Cuisine.id'=>$searchby))), $this->paginate()); what is it supposed to do? I think that what you really want to do is: // in the controller $this->set('filter', $this->paginate()); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: What you people use: Browser based automated tests or Cake's Inbuilt lib?
... forgot the last paragraph: and he is always giving support over cakebaker.42dh.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: What you people use: Browser based automated tests or Cake's Inbuilt lib?
> BTW, I did tested Daniel's code before, It was not of much help, as it > didn't worked out with latest versions. And I think no one is using it > right now. are you sure? He just pushed SeleniumHelper to github --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: What you people use: Browser based automated tests or Cake's Inbuilt lib?
Abhimanyu Grover wrote: > Hey Bakers, > > From quite a few days, Selenium IDE is seducing me as its a huge time > saver in writing tests. Earlier I was using CakeWebTestCase which > fulfilled our team's needs easily. Now I'm stuck in dilemma whether we > should use Cake's Inbuilt CakeWebTestCase or Selenium as PHPUnit > extension. Personally, I always prefer to stick with the core. "4th party" code isn't so good for bug tracking. > In case if we choose Selenium, we'll have to integrate it with Cake as > well, and I'm still very much new to automated testing, I'm not > willing to spend time writing the integration as of now. Daniel Hofstetter has something like this worked out: http://cakebaker.42dh.com/tags/selenium/ http://github.com/cakebaker/selenium-helper/tree/master --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Agregating multiple databases
For sure that's a way to do that. > > Can I create a model that will show me a list of all users in Ohio and > Kentucky? > Are both dbs on same host and can they be accessed by same app's db client and therefore be used in a same sql query? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Multiple views
> On the front-page of my application I want to be able to display > numerous other views. For example I may want to display a view of my > pages controller (for example a welcome message), and a view from my > calendar controller. > > How would I do this? use View::element(), as such: $this->element('../controller_name/view_name'); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Named parameters VS $_GET
Although I think you just specified and went deeper on what I roughly said, I think you said it very well a very elegant explanation. 5 stars for you On 20 nov, 15:29, Smelly_Eddie <[EMAIL PROTECTED]> wrote: > I think there is a little more to it than that. > > Most search engines ignore anything after ? (query string) > > This can be useful or detrimental depending on your situation. > > If you are passing around trivial data like session ids or something > that doesn't physically alter the page, I would stick with query > strings. This prevents engines like Google from seeing 'duplicate' > content which lowers your page rank. > > If you used > /posts/view/trivial:875783 > Google would see each different number as a unique page, but notice > the exact same content. > > If you use > /posts/view/?trivial=894894 > Google will treat all as the base url -> /posts/view/, and only index > it as 1 page. > > So if your passing in a search word, you might want to use named > variables since a search for cats should be very different that a > search for dogs. > > If you passing in encrypted data or something that has no direct > impact on the pages content, you might instead choose query strings. > > Hope that helps, > EW > > On Nov 19, 4:55 am, Rafael Bandeira aka rafaelbandeira3 > > <[EMAIL PROTECTED]> wrote: > > Query strings are evil for seo. That's why. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: cakePHP auth help (for a cake newbir)
>It's important to know what's out there! Totally agreed, I've done it before. The conclusion: almost every other framework is a) ugly and/or b) unlogical and/or c) useless and/ or d) too complex for it's too unsensible featurity. And yes. CI is totally unlogical and bloated with lots of crap features and outstanded comunity members that think they own the php market just because they are "sponsored" by a huge corp. It's not that I'm a cake fan. Ok, I might be, but not for it's name or features. Cake glues all the pieces in a logical, flexible, elegant and tangible way. The code talks by itself. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: cakePHP auth help (for a cake newbir)
the easiest way to get you on the path to the success is: quit CI and all other non-logic based framework out there. you little heretic man... ;-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Mambo on CakePHP brainstorm
What I see a lot is people looking for a admin backend that actually works. A CMS just for the MS. I think that a fashion way of delivering data to views, and a good UI work on admin end is what people really seek. Modularity and extensibility are huge pluses - but not strictly necessary. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Named parameters VS $_GET
Query strings are evil for seo. That's why. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Fatal error: Maximum execution time of 30 seconds exceeded
Tópicos em português devem ser postados no fórum pt-br. ok? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: How to dynamically load controller based on field in database.
On 13 nov, 03:53, Nick <[EMAIL PROTECTED]> wrote: > Basically I am using wildflower cms which is built on cakephp. > It routes are setup so that / goes to the pages controller. > I am building a product catalog and could simply have the urls be / > products/category/product-name > however I do not want to prepend the controller name in this scenario. > Right now I have it so that the product controller from the admin side > will insert rows into the pages table as products are created in the > products table. Also I created a field in the pages table called > "controller". By default it is blank however what I want to do is if > it isn't blank and for example has "Products" in it then I want to > load the Products controller from within the Pages controller so that > it can handle pulling the product images, pricing, etc... > > I want the controller to be dynamically called. That's a terrible idea, would cost you so much in performance, maitainability and logic. I think you should re-think your design principles, trying to keep it a little more simple and tided to a rule. Maybe moving some logic to the model side - Fat Model, Skinny Controller - you could dynamically load a Model class, wich would make much more sense and would be much lighter. You'd only have to create a pattern for your models so that they could be easily used by the same controller - like an interface. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Model Validation -> 'blank' rule triggered without beeing set
> triggered? And how can i avoid it without changing the cakecore? set the 'rule' key on $validate for each field, and specify the rule you want it to follow, when a validation scheme is set on $validate but no rule is specified, the 'blank' rule is assumed. Please refer to the cookbook for more information on validation, we got lots of information there. btw, your TRUE shouldn't be enclosed in an array, it should be " 'required' => true ". > $this->exists(); > What effect does this call have in this context? As far as i see, the > call returns a boolean to the void o_O ? Model::exists() caches the returned value in a private var - Model:: $__exists - and that's the used in the rest of the method to test the record existence. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: HABTM Model::save() or Model::__saveMulti() seems to be broken :-/
> Model.[0].[key]='a' > Model.[0].[key]='b' > Model.[0].[key]='c' what is it? the structure should be like this: $data['HABTMModel']['HABTMModel'] = array( array('HABTMAssociationForeignKey' => 1), array('HABTMAssociationForeignKey' => 2), array('HABTMAssociationForeignKey' => 3) ); and if you need to include more fields, you can then include them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: HABTM Model::save() or Model::__saveMulti() seems to be broken :-/
Forgot to mention, if you just want to keep your tables as they are, refer to #5722¹ to see the correct data set format to use. ¹ - https://trac.cakephp.org/ticket/5722#comment:2 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: HABTM Model::save() or Model::__saveMulti() seems to be broken :-/
Model::__saveMulti() was changed in the last few days due to a bug, new tests were added, and everything seems to be working just as expected. The problem is that the data format you are using is only supported by numeric ids and uuids, being processed only if it's values are 36 char long or numerical. Refer to the api on Model::__saveMulti() to see where it breaks the save process and to test cases to see usage cases, and consider using common data sets, remember that primary keys shouldn't be used as informative fields, so try to stick to auto incremental integers or 36 chars uuids. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Fatal error Call to undefined method Controller Html()
> link('Activate account', > array('controller'=>'users', 'action' => 'activate', $userid); ?> ^ it's missing a close bracket here -^ anyway: > Is there a way the above can be used to print out an absolute url ? $html->link('Activate account', $html- >url(array('controller'=>'users', 'action' => 'activate', $userid), true)); or $html->link('Activate account', Helper::url(array('controller'=>'users', 'action' => 'activate', $userid), true)); or $html->link('Activate account', Router::url(array('controller'=>'users', 'action' => 'activate', $userid), true)); -the boring explanation: you can use Router::url/Helper::url passing true as the second param to get the full route out of the url you passed in the first param. in case you ever extend Helper::url on AppHelper, use $html->url() to use the overrided method. LAST BUT CERTAINLY NOT LEAST, CakePHP has documentation and API specifications that cover this feature, please refer to http://api.cakephp.org and http://manual.cakephp.org as often as possible to get in touch with all the features, power and might and magic of CakePHP. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: class 'Routes' not found
> class 'Routes' not found You are mispelling "Router" somewhere in your application, probably on app/config/routes.php --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: To model or not to model
> > Still thinks that executing queries is needed? > > Yes. Sometimes You have uncommon database design, and You can't > EFFECTIVELY receive data just by using standard, even magic, model Definetly correct, my sentence wasn't much happy. I meant for the cases he presented. Anyway, keep in mind that you should - as a good design principle - encapsulate hand made sql queries in Model methods, so you'll avoid having data fetching logic in your Controller. And take a good look at the built-in query structure, it covers lots of usages I got pretty complex queries for data reporting and they're all using cake's query structure. rafaelbandeira3 http://rafaelbandeira3.wordpress.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Weird behavior with characters
tried to set your source code files encoding to UTF-8? The default of many IDEs is to set them as ISO-8859-1, wich messes up with accented chars, make sure you are rendering your content in UTF-8 too. But anyway, I would like to point that it's not a good idea, accented chars are generally a pain the back to handle in source code, and they are not even allowed in HTML, so your views are probably going to render in quirks mode, or you are just messing with your code validation. You are better off using l10n in views to display them with accented chars. On 24 set, 14:46, "Luiz Poleto" <[EMAIL PROTECTED]> wrote: > Hello guys, > I'm having a strange behavior from cakePHP, which i'll try to explain. I > have the following scenario: > > - I have two environments: one is my local machine (actually, two machines > for developing), where i actually do the development, and the second one is > the server where i send the application. Both are the same, except that the > server i have Linux running, and one development machine runs windows XP and > the other runs Linux; > - My database and all its tables are set up to charset UTF-8. They are the > same in the server and in the development machines; > - I have some table fields filled with accented characters; > > Now, the problem is: > In the development machines, when i try to edit a record in any table, and > this record is accented in any part, it's ok, no big deal. But, in the > server, if i try to edit this same record, the fields which have an accented > character is not filled in the form. It's just blank! > > Things i have checked: > - I already checked the HTML source, and the "value" is empty. > - In the controller, after reading the record to edit, i write the > $this->data to a log file, and the records with accented characters are > there. > - If i set a variable like "$this->set('tmpClient', $this->data);" and echo > the $tmpClient in the view, i can see the fields which have accented > characters. > > Well, i'm still searching for a solution for this problem, but if anybody > have a clue, i would love to hear it!!! > > Let me know if i didn't make myself clear! > > Best regards, > Luiz Poleto --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: bulk load data into CakePHP?
Well, again, it's not a matter of can or can't, the thing is, there's no why... even wanting a full featured view, with whole lots of data of all sorts of associations and purposes, what you have to keep in mind is, "why?" : where does it fits in your app design? and if you ever planned it or just come with a quick answer then you can jump to "how?". Cake is just fine for every kind of app with any amount of data to be pulled out and in the database. Why bother about something that you actually not even figured out? If you want a "profile like" interface, where the user can have access to lots of lists and tables of lessons, events, homeworks, available jobs, or anything else, you should ask, does it has to be loaded all up to the bottom at once? because all-in-one-single-page web apps don't do that, you have to rely on JS/JSON/XML/AJAX to fill some tasks, or else you will end up in a bloody mess with a "could-be-so- light" app turned into a fat old lady that tries to display more than 300 sources of data at once. You have to keep in mind that dynamic apps rely in much more concepts and methods than just in the strong framework it was built on top of, and it's not a matter of knowing framework's features - I could point lots of them wich you are missing (pagination, cache, alt type content delivery...) - it's about having a well planned goal. Must read: http://www.littlehart.net/atthekeyboard/2007/01/02/just-build-it-damnit/ So my tip is: Abuse of JS if you want dynamicity, and pages bundled with lots of data, try to keep things as simple as possible, remember that a view for a "index" action should be an "index" of data, anything extra to show becomes a VIEW feature. On 24 set, 13:47, Mike <[EMAIL PROTECTED]> wrote: > Thanks for the response - the idea of 'minimizing data that PHP > processes' as a design pattern for PHP web apps is an insight that I > had totally missed, and appreciate your pointing it out. It also > helps to explain why there isn't a whole lot on the internet about > perf tuning/profiling CakePHP apps :) > > I think I may have mis-architected my program. What I wanted to do is > have a student visit a single page, where everything is available. > Using the HTML fieldsets as visual panels, I wanted to have a panel > that would let the student upload their homework (which requires a > list of homeworks for the current course), another panel with a set of > links to work that they'd previously uploaded (so they can see that it > was submitted, and so that they can re-download it later), etc, etc. > My hope was that I could ask Cake to get the user information for the > current student, set recursive = 3, and then have Cake prune away any > data that didn't pertain to the current student. After which, it's > quick-and-easy to render all the stuff that I'm looking for :) > > I think that because of the way I've got my tables set up, recursive=3 > and doing a find on the user account didn't quite go deep enough (I'm > not quite sure if this is a bug in PHP, or my code, or what)(almost > certainly my code, but I haven't debugged it enough to get beyond the > initial stage of "This _should_ work" :) ) > > So I'm worried about scalability not because of trying to display 800 > rows at once, but because I think that I'm mis-using Cake to get too > much info & pruning it back once it's all in memory. > > Actually, if you don't mind - what sort of capacity should Cake/PHP > have for pulling stuff into memory? > I assume that anything less than 100 rows of data should be fine - > what about 200? 300? 500? I don't know if anyone's done any sort of > measurements about "CPU X, with memory Y GB, Cake can draw Z records > into memory in A milliseconds", but it would be fascinating to see :) > > Thanks again for the quick, really helpful response! > (And, for what it's worth, I'm loving Cake right back! :) ) > --Mike > > On Sep 24, 8:17 am, Rafael Bandeira aka rafaelbandeira3 > > <[EMAIL PROTECTED]> wrote: > > Mike, I think it's not "how much data is Cake intended to deal with" > > is how much data your app is intended to deal with, > > thousands of records is not something that should be dealed by php, > > the database does it much faster and safer. > > Having lots of data in database doesn't mean you have to deal with > > them always - I would say ever - because you would rarely want users > > stumbling their heads on to a 800+ rows report, I would say that > > using a 30+ limit in a report/index is already annoying. > > Now how do you intend to support tho
Re: To model or not to model
> > Rule of thumb perhaps? :) > If you really mean it: Let's say rule of thumb isn't exactly a rule. Now, if you were being ironic: Yay right, that's the kind of rule that can be applied to a pattern! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: bulk load data into CakePHP?
Mike, I think it's not "how much data is Cake intended to deal with" is how much data your app is intended to deal with, thousands of records is not something that should be dealed by php, the database does it much faster and safer. Having lots of data in database doesn't mean you have to deal with them always - I would say ever - because you would rarely want users stumbling their heads on to a 800+ rows report, I would say that using a 30+ limit in a report/index is already annoying. Now how do you intend to support thousands of records include in the app database if not with a file upload? there's no way to make a user fill more than three forms at once... And as the database can handle files, al you have to do is parse the file if needed. Cake loves you and will do lots of things for you, but it's still php and still uses memory, relies on cpu process and all this stuff. rafaelbandeira3 http://rafaelbandeira3.wordpress.com On 24 set, 03:25, Mike <[EMAIL PROTECTED]> wrote: > Thanks for the tip! In the previous, non-Cake version of the app, I > did that exactly, so it shouldn't be too too tough to get it up and > running again. I was kinda avoiding SQL b/c it seemed like "the Cake > way" should be to push it through the Cake layer & let CakePHP make it > automagically happen. Hearing that raw SQL is actually the right way > is actually really helpful :) > > If you don't mind my asking a couple more questions - how does one > know where the boundary should be? I mean, aside from exceeding > max_execution time and/or running out of memory - how would I know > where to draw the boundary between 'small enough for Cake' vs. 'needs > raw SQL' when designing my app? (And what does a normal app do if a > user happens to show up with an unexpectedly huge data set?) > > Also, what sort of data sets is Cake intended to support? I'm writing > the app to support my teaching, so having 30 people in a class, with > 10-20 homeworks/exercise sets to hand in (each of which might have 2-3 > versions stored), so it's conceivable that Cake might auto-magically > pull 600-1,200 records (even if fairly few / none of them are used in > any given view). One of the things I really liked about Cake was that > I could set recursive = 2 (or 3), and have it magically pull > everything I needed out of the DB (in my raw PHP app, I figured it was > time to look at a framework when I started to move towards an OOP-y > iterator approach for dealing with all my lists of data :) ) > > Thanks again for the quick reply - I appreciate the 'ok' from someone > who knows more about this than I do! :) > --Mike --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: To model or not to model
First of all people: what Rule? It's not made of rules, it's a pattern to follow - but follow as you want. Second, no, it doesn't "break the Rule" it only makes your code uglier and hard to read - see above - but the thing is, why to use a hand made query when you can easily/prettier/"readablier" use Model built-in methods to accomplish the same? About performing custom find methods, with default/mandatory/pre- defined params you should read: > > http://rafaelbandeira3.wordpress.com/2008/08/28/the-new-way-to-define-find-methods/ > > http://cakebaker.42dh.com/2008/09/23/an-alternative-way-to-define-custom-find-types/ About the rules: Even being annoying, executing hand made queries on the controller still leaves all the data transaction and structuration on the Model side, and it lets the pattern intended to be followed intact, but it's not the best practice. If even following the links presented - and links cited inside them, you still not find the solution for a more complex and featured query, try to implement it inside a model method to make your controller cleaner: $this->Model->find("where id=xyz") becomes $this->Model->find('axis', array('id' => 'xyz')); // following those links or $this->Model->getByAxis($axis); But in the specific case you presented, you could easily use Model methods overload by calling $this->Model->findById($id), $this->Model- >findBy($fieldValue); Still thinks that executing queries is needed? rafaelbandeira3 http://rafaelbandeira3.wordpress.com > but i heared if you direct query in controller will violate the MVC > rule > > i.e if you use $this->Model->query("select * from models"); > > the above query will violate the MVC rule. > > i heared the queries shouldnotbe written in controller it should be > inmodeli.e in urmodel.php > > even i am alsonotabsolute on this part > > On Sep 23, 2:33 pm, forrestgump <[EMAIL PROTECTED]> wrote: > > > Hey guys, > > Considering the fact that CakePhp follows the MVC architecture, id > > like to know...y we dont make function calls such as $this->find("where > > id=xyz") from function blocks typed out in Models rather > > > than controllersim sure there is a logical reason to it...but > > someone asked me this question and i couldnotgive her a good enuf > > answerdoes making function calls to queries like find(), save() > > work better in models or controllers?.and is it good practice to > > pass conditions in your function call while using it in a controller? > > eg find("where id=1") ; > > > Does using $this->find() in controller violate the MVC architecture in > > any manner? > > > Can someone please clarify these question for us? > > > Thanks in advance, > > forrestgump --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: bulk load data into CakePHP?
Hey Mike, it's totally not a matter of performance here. First of all, there's no reason on use this approach for a that huge amout of data, you should probably import it to your db. But if you want to do this in the app layer, maybe it's a feature - I don't know, you should definetly build INSERT sql statements and use Model::execute(), because there are lot's of things happening behind the scenes on Model::save() and Model::saveAll(), it's really hard not to run out of mem while executing them thousand times. A step-by-step, merge some and you'll get a prettier code: function saveAllThousands($CSVfile) { $blacklist = array($this->primaryKey); // what columns not to save $columns = array_keys($this->schemaI()); // get table column names $whitelist = array_diff($fields, $blacklist); $fields = join(',', $whitelist); $sql = "INSERT INTO {$this->useTable} ({$fields}) VALUES "; foreach($CSVfile as $line) { // here you can perform any action with the incoming data - escaping, glueing... $vals = join(',', $line); $values[] = "({$vals})"; } $sql .= join(',', $values); return $this->execute($values); // execute in plan old MySQL } Not much different than in plan old php, but I assure it's the safest way -> in php, in the app layer - executing on db is much quicker; Last but not least, comparing raw php access to mysql interaction with cakephp's data source is madness, of course it's much faster. rafaelbandeira3 http://rafaelbandeira3.wordpress.com On 23 set, 22:19, Mike <[EMAIL PROTECTED]> wrote: > Hello! > > I'm trying to load a bunch of rows into a table - on the order of > 1,000 or so. This isn't huge, but I'm having problems when I try to > do it using CakePHP. My basic approach is to upload a .CSV file, > which i then pull apart, and use to repeatedly save() new rows into > the appropriate model. I'm uploading & parsing the .CSV file just > fine (according to the debug output), but the process dies before > completion. > > Initially, PHP timed out (it took more than 30 seconds to process), > and when I reset the max_execution (in PHP.ini) to 300 seconds, it > then ran out of memory. > > My questions: > > 1) Are there any obvious things to look for / avoid in my code? > Adding 1K of new records seems like it ought to be fine (and was fine, > when I used an earlier version of my web app that was written in raw > PHP/MySQL) > > 2) How do I begin trying to solve this problem? How does one identify > what's going wrong here, and then fix it? > > 3) Does anyone have any good suggestions for perf-tuning CakePHP apps? > > Sorry for not doing more digging myself - the first N Google results > weren't promising, so I figured that I'd go for help now, since I'm in > a bit of a rush :( > > Thanks! > --Mike --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Models: Why not more Object Oriented??
I don't really get it... you can easily handle your data in Model side, even more now since [7640] - wich actually encourages you to do so. Ok, but lets focus on the "iterating more than once" problem. After all isn't it what you actually do in every MVC based app? i.e: db (iteration over table data) -> data source (iteration over result set) -> model ([depending on find type]iteration over data structure) - > view (iteration over data structure) only find('all') return data as it comes from the data source, so if you want a find('calculated') you just have to build the iteration you want to deal with it - view links at the bottom. Dealing with objects would turn dynamic iterations heavier, uglier and painfull. The structure you suggest would turn deeper relations much harder to deal with. How would it be more anything than actually having a proper algorithm to deal with the whole data structure - wich is surely pretty logical, maintainable, light...? The whole thing on having related data on the same level, is that it's structure represents the data set and it's properties and related data isn't it's properties, in the case you specified, WebpageType is like a MySQL ENUM field, it only has to display it's own display field, and that's all you want, so why don't you deal with that? Something like a EnumBehavior, or even easier, always deal with it in your afterFind() callback. It wouldn't be very logical to have Profile as a property of a User. Now, I was wondering what is it that Nate suggested devs are planning on... hope that has nothing to do with this http://twitter.com/nateabele/statuses/932176581 Links: http://cakebaker.42dh.com/2008/09/23/an-alternative-way-to-define-custom-find-types/ http://rafaelbandeira3.wordpress.com/2008/08/28/the-new-way-to-define-find-methods/ On 23 set, 20:54, Brenton B <[EMAIL PROTECTED]> wrote: > Sorry, not meaning to be annoying, just grasping for understanding. > > Thanks to all :) > > On Sep 23, 5:42 pm, Nate <[EMAIL PROTECTED]> wrote: > > > Yah. We know. We'll get to it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Simply aligning form->input fields and labels nicely....
You can use an array to specify label's tag attributes: $form->input('Schedule.expected_check_in', array('label' => array('class' => 'input-label', 'text' => 'Expected Arrival', 'title' => 'When are you expecting to arrive at the place?'))); The 'text' key is the one to be used as the text, so the output would be: Expected Arrival [...] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: nested condition
> Only, unfortunately, I found out cake can't yeild expression like: > > sth NOT IN('a','b') Yes it can, use 'not' => array('sth' => array('a', 'b')) And you could write those conditions like this > 'conditions'=>array( > array( 'or' => array( > array('Report.user_id' => $user_id), > array('Report.user_id2' => $user_id) > )), > array('or'=>array( > array('Report.del_flg' => 0), > array('Report.status <>' => array('6s', '6r')) > )) > ) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: method find using regex
> athttp://book.cakephp.org/view/73/retrieving-your-data, is some info > about usind find with regex (at conditions param). I can't find one > example of usage and there is nothing at the docs. Someone can give a > example of usage? I actually didn't understand what you want but if you want to use REGEXP in your query: $this->Project->find('all', array( 'conditions' => array( 'Project.title REGEXP' => '^ui' ) )) Always when using operators in find conditions use them in the field's side, to avoid sql injections --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: cannot get ibm tutorial part 2 var belongto work ! anyone done this tutoral before ??
> class Product extends AppModel > { > var $name = 'Product'; > var $belongsTo = array ( > 'Dealer' => array( > 'className' => 'Dealer', > > 'foreignKey'=>'dealer_id' > ) > );} are you sure your code is just it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: find group parameter problem (GROUP BY problem)
> > Should I open a bug report for this? > If you're sure about it, yes --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Complex ACL & Auth
Paste your code and your approach, a test approach at least. I don't think someone will actually *do* it for you. But many people can point out what you're missing --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Initialization function on the model core
Nah, sorry for being a little rude... Enjoy cake community and don't use me and nate as params - we are a little rude. - Sorry nate but you are... but I know it's your way of doing things, just like me... not everyone has soft lips! andbe sure to check my blog rafaelbandeira3.wordpress.com - and don't forget to catch on my typos! On 28 ago, 16:39, villalvilla <[EMAIL PROTECTED]> wrote: > Sorry, I haven't seen your post clearly! > > I thought you put something like this: > > class xample extends appModel > { > > var $validate = array('name' => array( > > 'regla1_nombre' => array( > > 'rule' => > array('minLength','3'), > > 'message' => __('Minimum > length of 3 characters',true) > > ) > ) > ); > > } > > You can't define things with function in a class... > > Oh man, go read php.net... come on... > > as you can see, i thought you were telling me that it was possible to > call a function in the declaration of a variable in a class > > Sorry for your loosed time, Rafa > > regards > > On 28 ago, 21:18, Rafael Bandeira aka rafaelbandeira3 > > <[EMAIL PROTECTED]> wrote: > > On 28 ago, 15:46, villalvilla <[EMAIL PROTECTED]> wrote:> Wrong! > > > have you tried that? > > > Yes... as with any object in PHP... > > > > I have tried it before posting this, trust me, and due to the Model > > > constructor specifications it fails! > > > that's why i've done this hooking! > > > Are you nuts or something? Have you called parent::__construct()? > > > > Even more, if you go to the documentation page of the validation > > > issue, it says there that you can't do the localization in the Model, > > > it says that you must do it on the form helper! > > > You can't define things with function in a class... > > Oh man, go read php.net... come on... > > > > regards, > > > mike > > > Blah ;-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Initialization function on the model core
Nah, sorry for being a little rude... Enjoy cake community and don't use me and nate as params - we are a little rude. - Sorry nate but you are... but I know it's your way of doing things, just like me... not everyone has soft lips! andbe sure to check my blog rafaelbandeira3.wordpress.com - and don't forget to catch on my typos! On 28 ago, 16:39, villalvilla <[EMAIL PROTECTED]> wrote: > Sorry, I haven't seen your post clearly! > > I thought you put something like this: > > class xample extends appModel > { > > var $validate = array('name' => array( > > 'regla1_nombre' => array( > > 'rule' => > array('minLength','3'), > > 'message' => __('Minimum > length of 3 characters',true) > > ) > ) > ); > > } > > You can't define things with function in a class... > > Oh man, go read php.net... come on... > > as you can see, i thought you were telling me that it was possible to > call a function in the declaration of a variable in a class > > Sorry for your loosed time, Rafa > > regards > > On 28 ago, 21:18, Rafael Bandeira aka rafaelbandeira3 > > <[EMAIL PROTECTED]> wrote: > > On 28 ago, 15:46, villalvilla <[EMAIL PROTECTED]> wrote:> Wrong! > > > have you tried that? > > > Yes... as with any object in PHP... > > > > I have tried it before posting this, trust me, and due to the Model > > > constructor specifications it fails! > > > that's why i've done this hooking! > > > Are you nuts or something? Have you called parent::__construct()? > > > > Even more, if you go to the documentation page of the validation > > > issue, it says there that you can't do the localization in the Model, > > > it says that you must do it on the form helper! > > > You can't define things with function in a class... > > Oh man, go read php.net... come on... > > > > regards, > > > mike > > > Blah ;-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Initialization function on the model core
On 28 ago, 15:46, villalvilla <[EMAIL PROTECTED]> wrote: > Wrong! > have you tried that? Yes... as with any object in PHP... > I have tried it before posting this, trust me, and due to the Model > constructor specifications it fails! > that's why i've done this hooking! Are you nuts or something? Have you called parent::__construct()? > Even more, if you go to the documentation page of the validation > issue, it says there that you can't do the localization in the Model, > it says that you must do it on the form helper! You can't define things with function in a class... Oh man, go read php.net... come on... > regards, > mike Blah ;-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Initialization function on the model core
> > > So i think it would be great for all the cake comunity to have this > > concept implementated on the next release of cake! > > Please open an enhancement ticket for it on trac (https:// > trac.cakephp.org) so the devs can consider to add it. > I don't think it's appliable... use MyModel::__construct() class User extends AppModel { var $name = 'User'; var $validate = NULL; function __construct($id = false, $table = null, $ds = null) { parent::__construct($id, $table, $ds); $this->validate = array( 'nombre' => array( 'regla1_nombre' => array( 'rule' => array('minLength','3'), 'message' => __('Minimum length of 3 characters',true) ), 'regla2_nombre' => array( 'rule' => array('maxLength','50'), 'message' => __('Maximum length of 50 characters',true) ) ) ); } } Why would one have to care about one more method with the same purpose of the another? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Database relationships etc
Oh, I almost slept, you should try to more clear and less verborragic, so many explanation just messed up things more and more... And you should do 2 things when you can't speak a language : 1) look for groups with the same language of yours and 2) say your nacionality, so members from the same country can get sensible with you and try to help you more "stop the bullshit and answer me..." OK, answers : > 1) Do I have to manually set up Foreign keys for tables? it depends, did you sitcked to conventions? Your CarAd Model has the following scheme and linking convention: id - primaryKey car_type_id- className => CarType, uses table - > car_types car_brand_id - className => CarBrand, uses table - > car_brands car_fuel_id - className => CarFuel, uses table -> car_fuels car_transmission_id- className => CarTransmission, uses table -> car_transmissions year ad_county_id - className => AdCountry, uses table -> ad_countries ad_borough_id- className => AdBorough, uses table - > ad_boroughs (?) info price car_ad_type_id - className => CarAdType, uses tabl - > car_ad_types added <- tip : is this field meant to hold the datetime of row creation? if yes, rename it to "created" and cakePHP will handle it for you Said that all this foreign keys says : this CarAd belongs to this CarType, and to this CarBrand, and to that CarFuel... so you should have in your model class: class CarAd extends AppModel { var $belongsTo = array ( 'CarType', 'CarBrand', 'CarFuel', 'CarType', 'CarTransmission', 'AdCountry', 'AdBorough', ) } now CakePHP will map all your model's foreign keys and you will be able to access this relateds models as a property of your CarAd model : // inside your model $this->CarType->find([...]); inside your controller $this->CarAd->CarType->find([...]); answered? moving on... > 2) Do I have to build model for each table I need to get id's > from..even if the table itself will stay static ? (model for > car_transmissions, car_fuels_id... tables) No, actually CakePHP map table names for you too. >> http://www.littlehart.net/atthekeyboard/2008/08/05/dynamic-models-in-cakephp-12/ > By static I mean that I don't need to add or delete data from it > because probably there will not be any new transmission types > coming. I only need to read info from it. > > > I know 100% that I have to build model for tables which will have > dynamic content...like table car_brand. (new car brand comes.. for ex. > "BMW-Jaguar"..and I need to add it to table from site...not manually) you should avoid this kind of thinking... > So my main table at this time is car_ads and I have controller for > it... and it also gives me it's table contents with simple index(): > function index() { > $this->set('carads',$this->CarAd->find('all')); > } > > But I want to see text in the list..not that number which I have on > car_transmission_id field. (Instead of number 1 I would like to see > text: "Automatic") > Currently line looks like this: Brand: 5 Year: 2000 Transmission: 1 > Gas: 2 > But it should look like this: Brand: Chevrolet Astro Year: 2000 > Transmission: Automatic Gas: Benzine No actually it shouldn't, what is happening is the normal and expected behavior. I'll explain what is already in the manual about cakePHP's data scheme, I'll wont reproduce arrays here because it would be very ugly and painfull for me so take this as example : http://book.cakephp.org/view/448/findall -> the grey box at the bottom of the content... that's how your data will return but with the your model names... back to your CarAdsController::index() : > function index() { > $this->set('carads',$this->CarAd->find('all')); > } in your view you will have a var named 'carads', and you'll be able to access data as the array in the link shows : // first entry's CarTransmission.transmission wil be accessed like this echo $carads[0]['CarTransmission']['transmission']; // the nth entry/row CarBrand.name will be accessed like this echo $carads[$num]['CarBrand']['name']; for a dynamic list or table generation, you would do something like this: foreach($carads as $entryNum => $entryData) { echo 'Transmission: ' . $entryData['CarTransmission'] ['transmission']; echo 'Brand : ' . $entryData['CarBrand']['name']; echo 'Country : ' . $entryData['CarCountry']['name'] . ''; } > I'll try to explain it once more..maybe it helps to clear things out: you actually didn't explain anything, just asked more questions ;-) > 1) I have table car_ads which will hold car ads... to that table will > be added all kind of info... car brand, car transmission type, fuel > type.. info, make year. Most things should be choosed from other > tables...so when I'm inserting a new ad,
Re: OrderedBehavior - Order your lists in a TreeBehavior like manner, but only for one level.
> I propose we should think of how we can use the Bakery to become our > ultimate resource for articles. I have a couple of simple ideas and > if anyone is also interested, I'll start a thread about this topic so > we can give positive feedback, ideas and encouragement to the Bakery > developers which they can bear in mind if they plan any future > improvements. Maybe it's not that clear for everyone that things should be done the CakePhp's way. Perhaps a "How To Post To Bakery" would be very usefull! Even to editors so that they wouldn't have to spend time with messed code and crappy tips. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: CakePHP and widgets
> Andy Dawson's mini controllers still work the best for me - despite the name > it really is a combination of Components and Elements Why not to use some model tricks inside a helper? Form helper does it... Grab your model whithin the ClassRegister and serve yourself... I've already done the approach, using a ModelHandlerHelper or DataHelper... it might not be the best- design approach, but it's not too non-Cake design, as core helpers use it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---