Re: Can I get smart objects from model::find() instead of array?
On Oct 13, 12:21 am, "nate" <[EMAIL PROTECTED]> wrote: > The short answer is no. Allowing the view to query model objects > directly violates the basic tenents of MVC separation, so although Cake > 2.0 will support a fully object-based ActiveRecord implementation, this > will likely never be supported. Thanks for the reasonable answer, this makes much sense for shure. Maybe I'm really misunderstanding some basics of MVC, so I'd like to clear things up. Model object (that acts more like a DAO in case of Cake) returns raw data which is handled by controller to the view. So it's completely legal to access the data in this style: $model_object['NAME']. But in OO code this would be done by using an accessor like $model_object->get_name(). I wonder if it would be legal (if it was possible) according to MVC, as the last thing does exactly the same - it provides access to data. And even in more structured way, because it gives only read access to it. And to make things even worse, let us assume that view accesses the data by call $model->get_attribute('NAME'). Does this violates MVC? I'm sad to think that answer is yes. Because upfront planning of data a view needs leads to hard coupling of C-V, breaks model incapsulation and creates redundant model data. By hard coupling I mean strictly knowing in controller what part of the model and in what perspective the view renders, instead of just giving model object to any view that needs it never caring of which particular data it would render. The approach to solve this problems in rails, as I know, is providing convinient data access methods in model that "talk" on problem domain language. That keeps logic close with data that it works with, and looks like a good incapsulation, I think. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Mutually exclusive associations
On 10/13/06, gremlin <[EMAIL PROTECTED]> wrote: > Keep addresses in an address table. > A join table could connect contacts to addresses - likewise for > companies and addresses. > Disallowing a company to have the same address as a contact is going to > eventually bite you in the ass. I for one do private contract work from > my home. My own companies address is my home address. I could be a > contact REQIURING a company address identical to my personal one. Sure, but I don't rule out the possibility of two contacts/organizations having an identical address. But if they do, I want those addresses to be separate tuples in the addresses relation. Suppose your business grows and gets too big for your home. You want to update your companies address, but not your home address. That's not possible if both tuples point to the same address tuple. Regards, Martin -- Martin Schapendonk, [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: common ajax actions in app_controller
You can set the directory from which the view is loaded by using $this->viewPath = 'directory_with_view_templates'; --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Can I get smart objects from model::find() instead of array?
Yes, that's correct. The model represents the data, which is accessed by the controller. The controller then passes raw data to the view, where the view itself (or a helper) can manipulate the data for display purposes. Maybe I'm misunderstanding what you mean by accessing attribute values. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Mutually exclusive associations
Martin Schapendonk wrote: > On 10/11/06, AD7six <[EMAIL PROTECTED]> wrote: > > >However, strictly speaking it does not provide any way to prevent an > > Address to belong to a Person and an Organization at the same time. > > > > ? > > > > If on the address table there are 2 fields 'class' and 'foreign_id' > > which are used to define to which class and object the address relates > > it is not possible for the same address to point to more than one > > person/org. If you are defining in the person/org class which is their > > address by setting a field named address_id the foreign key is in the > > wrong table. > > In that case, you're right. > > I was thinking about an addresses table with two columns "person_id" > and "organization_id". This does not prevent an address from belonging > to an organization and a person at the same time. > > I think the "foreign_id" column pointing to either persons or > organizations is not such a nice solution, since it removes the > possibility of having a foreign key relation in the database. > > In the database (in my case, usually Oracle) I would implement things > with an optional foreign key relation and a check constraint that > specifies that only one of the two columns may be filled. I was > looking for some similar functionality in CakePHP. > > Regards, > > Martin > > -- > Martin Schapendonk, [EMAIL PROTECTED] Just my 2 cents. Keep addresses in an address table. A join table could connect contacts to addresses - likewise for companies and addresses. Disallowing a company to have the same address as a contact is going to eventually bite you in the ass. I for one do private contract work from my home. My own companies address is my home address. I could be a contact REQIURING a company address identical to my personal one. Abba Bryant --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Cake PHP Zend Studio Templates
Looks very nice... I've been looking for a CakePHP snippets set for Eclipse. Probably only take a little search and replace action. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
common ajax actions in app_controller
Hi all, I have searched for similar queries and found many different answers but nothing that quite suits my needs. We have a group of ajax actions that apply to the majority of the models that make up the backbone of a CMS that we are writing. I have placed these actions and there related methods into the app_controller and app_model. So far, so good. When these actions are called the headers are switched to text/xml and the layout switched to ajax but I can't find a way to have a generic view file that is used to send the responses back to client. So, I would like to use a "reorder" view for all my ajax "reorder" requests but currently I need to place a copy of the "reorder" view in each controllers views directory. Is there a simple way around this? Many thanks for your thoughts, Nick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Can I get smart objects from model::find() instead of array?
nate wrote: > The short answer is no. Allowing the view to query model objects > directly violates the basic tenents of MVC separation, so although Cake > 2.0 will support a fully object-based ActiveRecord implementation, this > will likely never be supported. > > You should plan up-front the data that the view needs, and request it > in the controller and pass it on to the view. Nate: I'm sure I'm just misunderstanding something here so I wanted to get this straight. Do helpers fall under the purview of views? If this is the case I assume that nothing other than the model & controller are going to have access to the data. Am I correct in this assumption? Thanks! Matt -- BASIC: A programming language. Related to certain social diseases in that those who have it will not admit it in polite company. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: radio button inbetween param
Hello, I wrote a small article in my blog. http://cakephp.seesaa.net/article/24687605.html You can change style sheet, Try this: