Re: ACO node being overridden by a node with the same name further down the tree

2009-09-09 Thread benjamwelker

I tried to submit this bug, but apparently my trac account doesn't
have the proper permissions to submit a ticket.

If someone in charge of trac.cakephp.org could remedy this for me, I'd
be happy to file a ticket.

Thanks.

On Aug 18, 8:04 pm, benjam  wrote:
> I have encountered what might be a bug in Cake.
>
> I have an ACO tree that looks like the following:
> controllers
> - Events
> -- admin_index
> - Newsletters
> -- events
>
> When I try to access the admin index page for the Events controller, I
> get an error stating that the ACL check failed.
>
> After digging a bit into the ACO node function, I came up with the
> following scenario:
> on line 129 of cake/cake/libs/model/db_acl.php, the $result[0][$type]
> ['alias'] is returning 'Newsletter' (because it's lower in the tree),
> and $path[count($path) - 1] is 'Events' (passed in)
>
> This causes the whole thing to fail.
>
> Basically, my question is this... is this a bug?  Or am I doing
> something wrong?
>
> And if it's a bug, can somebody who is/might be having the same issue
> who can write test cases write one up so that a ticket can be
> submitted (if it's not in there already)?
>
> I am not sure of a fix, as I have not looked into that deeply, and I
> can't write any test cases to submit a bug as I don't know how.
--~--~-~--~~~---~--~~
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: MVC-way to obtain common data formatting

2009-08-27 Thread benjamwelker

You can try creating a couple of methods in your model.
One afterFind, and another beforeSave.

You can convert the data however you want in the afterFind, and then
convert it back in the beforeSave so that it doesn't mess up your
validation and save methods.

But you're going to run into other problems with this method as well.
The form helper might;' have some issues with the newly formatted
data, and not knowing exactly what to do with it.

Your best bet is to convert the data how you want right before
viewing.  It's not the easiest to edit a lot of files, but it will
save you headache in the long run.

Also...  to convert a 0/1 to a No/Yes, you can use the built in
Set::enum($select, $list = null) method, leaving the $list var empty
will auto populate it with a yes/no array.

echo Set::enum($data['boolean_field']) will output "yes" or "no"
depending on value. Wrap that in a ucfirst or ucwords to get "Yes"
"No", done.

On Aug 26, 3:52 pm, ark0n3  wrote:
> That's a good starting point but there's need to change every
> interested line in the views, while I'd like to obtain an automatic
> and centralized solution i.e. if I write a new page there should be no
> need to remember that "work-around"
>
> On 26 Ago, 15:42, Jon Bennett  wrote:
>
>
>
> > Hi Nicola,
>
> > > thanks for your kind reply but that's just what I'd avoid: I'm trying
> > > to accomplish an automatic way to achieve that result, I know it's not
> > > right to use a model function and I asked for an MVC and non-
> > > validation-breaking way..
>
> > Another way would be to create a helper.
>
> > How about this helper:http://pastie.org/595351
>
> > // use it like so
> > $data = array('Model'=>array('status'=>1));
> > echo $dataConverter->nice('Model.status', 'onoff', $data);
>
> > IMHO the thing to remember is that you only adjust the data for
> > presentation only, hence it's done in either the view or the
> > controller.
>
> > hth
>
> > jon
>
> > --
>
> > jon bennett
> > w:http://www.jben.net/
> > iChat (AIM): jbendotnet Skype: jon-bennett
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---