Re: Single query at bootstrap: how to

2011-07-06 Thread ark0n3
After some tests it seems like the connection is reset after this
first query (I had to use $this-query in place of $this-execute), so
all the dates are visualized as in the old timezone. I already tried
with a simple set timezone etc; SELECT date; from console/phpmyadmin
and it works so it surely is a problem with cakephp that reset the
connection, thus resetting the new timezone setting too.. Any advice??

thanks

On Jul 4, 6:00 pm, majna majna...@gmail.com wrote:
 Using AppModel constructor works for me:

 function __construct($id = null, $table = null, $ds = null)
     {
         parent::__construct($id, $table, $ds);
         if (!defined('GLOBAL_ZONE_SET')  $this-useTable !== false)
         {
             $this-execute(SET GLOBAL time_zone = ‘+2:00′');
             define('GLOBAL_ZONE_SET', true);
         }
     }

 On Jul 4, 4:31 pm, ark0n3 nicolabeg...@gmail.com wrote:







  Hi everyone
  I'm going crazy for such a trivial matter. I need to run a one-time
 queryat the beginning of the connection to the mysql server (SET
  GLOBAL time_zone = ‘+2:00′) but can't figure out where I need to put
  the code in the cake codebase.

  Many thanks in advance to whoever will help me fix this.

  ps i already tried in the contructor of app_model.php but got not luck
  with cake 1.2.10

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Single query at bootstrap: how to

2011-07-05 Thread ark0n3
THANK you so much! I tried that approach before but got some weird
errors so dismissed it without trying any further.. this way it works
perfectly!

thanks again

On Jul 4, 6:00 pm, majna majna...@gmail.com wrote:
 Using AppModel constructor works for me:

 function __construct($id = null, $table = null, $ds = null)
     {
         parent::__construct($id, $table, $ds);
         if (!defined('GLOBAL_ZONE_SET')  $this-useTable !== false)
         {
             $this-execute(SET GLOBAL time_zone = ‘+2:00′');
             define('GLOBAL_ZONE_SET', true);
         }
     }

 On Jul 4, 4:31 pm, ark0n3 nicolabeg...@gmail.com wrote:







  Hi everyone
  I'm going crazy for such a trivial matter. I need to run a one-time
  query at the beginning of the connection to the mysql server (SET
  GLOBAL time_zone = ‘+2:00′) but can't figure out where I need to put
  the code in the cake codebase.

  Many thanks in advance to whoever will help me fix this.

  ps i already tried in the contructor of app_model.php but got not luck
  with cake 1.2.10

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Single query at bootstrap: how to

2011-07-04 Thread ark0n3
Hi everyone
I'm going crazy for such a trivial matter. I need to run a one-time
query at the beginning of the connection to the mysql server (SET
GLOBAL time_zone = ‘+2:00′) but can't figure out where I need to put
the code in the cake codebase.

Many thanks in advance to whoever will help me fix this.

ps i already tried in the contructor of app_model.php but got not luck
with cake 1.2.10

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


parseExtension question allows just a subset of extensions??

2009-11-11 Thread ark0n3
Hi
I'm banging my head against the wall trying to figure out why CakePHP
does not parse the .rtf extension, after that I added the extension in
Router::parseExtensions('json', 'xml', 'rtf', 'pdf'), /app/views/
layouts/rtf/default.ctp and /app/views/controllername/rtf/
action_name.ctp


Please let me know if you know how CakePHP reacts to unknown
extension.

Any help is appreciated.

Thanks

--

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-...@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=.




Re: parseExtension question allows just a subset of extensions??

2009-11-11 Thread ark0n3
Figured out by myself.. You just have to add
$this-RequestHandler-setContent('rtf', 'application/rtf');
in app_controller.php beforeFilter()



On 11 Nov, 11:45, ark0n3 nicolabeg...@gmail.com wrote:
 Hi
 I'm banging my head against the wall trying to figure out why CakePHP
 does not parse the .rtf extension, after that I added the extension in
 Router::parseExtensions('json', 'xml', 'rtf', 'pdf'), /app/views/
 layouts/rtf/default.ctp and /app/views/controllername/rtf/
 action_name.ctp

 Please let me know if you know how CakePHP reacts to unknown
 extension.

 Any help is appreciated.

 Thanks

--

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-...@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=.




Re: Order by Contain field

2009-10-24 Thread ark0n3

Yes I tried but CakePHP signaled wrong query.. In the end I managed to
move Person datas in the User table so that I removed a level of
relations and was able to order by User.surname.
I think it's a more reasonable DB model.

Thanks for your attention!

On 23 Ott, 19:11, jacmoe jac...@mail.dk wrote:
 Did you try with 'order' = array('Person.surname' = 'ASC') ?
 ((I'm away from any code, so I can't check atm))

 On Oct 23, 6:38 pm, ark0n3 nicolabeg...@gmail.com wrote:

  Yes, a related model but in the form

  Teacher - belongsTo User - hasOne Person

  so that I need to order by Person.surname,Person.name..

  I tried 'order' = array('Person.surname ASC') but got no results..

  On 23 Ott, 01:04, jacmoe jac...@mail.dk wrote:

   What do you mean?
   A totally unrelated model, or ?

       var $paginate = array(
       'fields' = array(all_fields_here),
       'limit' = 15,
       'order' = array(
       'SomeModel.someField' = 'desc')
       );

   Works with whatever your model $belongsTo.

   If that's not what you mean, explain some more. :)

   On Oct 22, 7:49 pm, ark0n3 nicolabeg...@gmail.com wrote:

Hi Melanie
thanks for your kind reply.
I meant general sorting, not necessarily in the view, something like
SELECT * FROM User inner join Group order by Group.name

I think it's quite amazing such a basic feature could not be achieved
with CakePHP, a workaround has to exist (different from manually
sorting pagination results).

On 22 Ott, 16:33, Melanie Sommer melanie-som...@mailinator.com
wrote:

  Hi
  does anyone know if it's possible to order by a contained fields? It
  seems to me like a simple task but I'm unable to manage it.. I have 
  a
  User model associated with a Group field and I'd like to order User 
  by
  Group.name.

 Do you mean paginator function sort() ? There you simpy need to type
 $paginator-sort('Group','Group.name');

 This only works if Group is directly related to your user, by
 belongsTo for example. I did not manage to get it work with any models
 that are not directly related with the current model and noone was
 able to answer me this question by now.

 Here:http://bakery.cakephp.org/articles/view/advanced-pagination-1-2
 is written:
 Cake 1.2 is still in development. I feel obligated to inform the
 reader of known weaknesses in pagination, before they dive in and
 start using it. There are only two things I know of which have been
 any hinderance to anybody.
 1. Sorting by another model - Perhaps your model you want to paginate
 with has a belongsTo relationship to another model. You may want to
 sort by that other model. Currently this is not possible for security
 reasons. I'm told it will be done before Cake 1.2 becomes official.
 For now though, I am sorry you can only sort by the Model you are
 paginating with.

 So sorting by directly related models seems to be a rather new
 feature, so I fear it is generally not possible (without a lot of own
 code) to sort by models not directly related.


--~--~-~--~~~---~--~~
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: Order by Contain field

2009-10-23 Thread ark0n3

Yes, a related model but in the form

Teacher - belongsTo User - hasOne Person

so that I need to order by Person.surname,Person.name..

I tried 'order' = array('Person.surname ASC') but got no results..

On 23 Ott, 01:04, jacmoe jac...@mail.dk wrote:
 What do you mean?
 A totally unrelated model, or ?

     var $paginate = array(
     'fields' = array(all_fields_here),
     'limit' = 15,
     'order' = array(
     'SomeModel.someField' = 'desc')
     );

 Works with whatever your model $belongsTo.

 If that's not what you mean, explain some more. :)

 On Oct 22, 7:49 pm, ark0n3 nicolabeg...@gmail.com wrote:

  Hi Melanie
  thanks for your kind reply.
  I meant general sorting, not necessarily in the view, something like
  SELECT * FROM User inner join Group order by Group.name

  I think it's quite amazing such a basic feature could not be achieved
  with CakePHP, a workaround has to exist (different from manually
  sorting pagination results).

  On 22 Ott, 16:33, Melanie Sommer melanie-som...@mailinator.com
  wrote:

Hi
does anyone know if it's possible to order by a contained fields? It
seems to me like a simple task but I'm unable to manage it.. I have a
User model associated with a Group field and I'd like to order User by
Group.name.

   Do you mean paginator function sort() ? There you simpy need to type
   $paginator-sort('Group','Group.name');

   This only works if Group is directly related to your user, by
   belongsTo for example. I did not manage to get it work with any models
   that are not directly related with the current model and noone was
   able to answer me this question by now.

   Here:http://bakery.cakephp.org/articles/view/advanced-pagination-1-2
   is written:
   Cake 1.2 is still in development. I feel obligated to inform the
   reader of known weaknesses in pagination, before they dive in and
   start using it. There are only two things I know of which have been
   any hinderance to anybody.
   1. Sorting by another model - Perhaps your model you want to paginate
   with has a belongsTo relationship to another model. You may want to
   sort by that other model. Currently this is not possible for security
   reasons. I'm told it will be done before Cake 1.2 becomes official.
   For now though, I am sorry you can only sort by the Model you are
   paginating with.

   So sorting by directly related models seems to be a rather new
   feature, so I fear it is generally not possible (without a lot of own
   code) to sort by models not directly related.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Order by Contain field

2009-10-22 Thread ark0n3

Hi
does anyone know if it's possible to order by a contained fields? It
seems to me like a simple task but I'm unable to manage it.. I have a
User model associated with a Group field and I'd like to order User by
Group.name.

Thanks
Nicola
--~--~-~--~~~---~--~~
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: Order by Contain field

2009-10-22 Thread ark0n3

Hi Melanie
thanks for your kind reply.
I meant general sorting, not necessarily in the view, something like
SELECT * FROM User inner join Group order by Group.name

I think it's quite amazing such a basic feature could not be achieved
with CakePHP, a workaround has to exist (different from manually
sorting pagination results).



On 22 Ott, 16:33, Melanie Sommer melanie-som...@mailinator.com
wrote:
  Hi
  does anyone know if it's possible to order by a contained fields? It
  seems to me like a simple task but I'm unable to manage it.. I have a
  User model associated with a Group field and I'd like to order User by
  Group.name.

 Do you mean paginator function sort() ? There you simpy need to type
 $paginator-sort('Group','Group.name');

 This only works if Group is directly related to your user, by
 belongsTo for example. I did not manage to get it work with any models
 that are not directly related with the current model and noone was
 able to answer me this question by now.

 Here:http://bakery.cakephp.org/articles/view/advanced-pagination-1-2
 is written:
 Cake 1.2 is still in development. I feel obligated to inform the
 reader of known weaknesses in pagination, before they dive in and
 start using it. There are only two things I know of which have been
 any hinderance to anybody.
 1. Sorting by another model - Perhaps your model you want to paginate
 with has a belongsTo relationship to another model. You may want to
 sort by that other model. Currently this is not possible for security
 reasons. I'm told it will be done before Cake 1.2 becomes official.
 For now though, I am sorry you can only sort by the Model you are
 paginating with.

 So sorting by directly related models seems to be a rather new
 feature, so I fear it is generally not possible (without a lot of own
 code) to sort by models not directly related.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



HABTM single row

2009-10-20 Thread ark0n3

Hi
many thanks to all members, you represent an invaluable support for
worldwide CakePHP developers!

This is my problem:
i'm trying to create a new HABTM row, in a Course view I coded

echo $form-create('Course', array('url' = 
array('action' =
'view', $course['Course']['id'])));
echo $form-input('id');
echo $form-input('CoursesTeaching.0.course_id', 
array('type' =
'hidden', 'value' = $course['Course']['id']));
echo $form-input('CoursesTeaching.0.teaching_id');
echo $form-input('CoursesTeaching.0.typology_id');
echo $form-input('CoursesTeaching.0.obbligatorio');
echo $form-end('Submit');

but I get no new row created. I've already used this way to obtain the
creation of hasMany models but seems that with SaveAll you have to
explicit the HABTM model and the new record creation.

Any help is appreciated.

Thanks
Nicola
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Pagination + cache: they can't be together?

2009-09-08 Thread ark0n3

Hi
I'm using native CakePHP cache methods and got excellent results in a
very little time.
I had just an annoying problem: I'm unable to cache pagination results
because I get Undefined variable: paginator in the views.

function index() {
$cachename='home_'.$this-getCurrentPage();
Cache::set(array('duration' = Configure::read('Cache.home')));
$videos=Cache::read($cachename);;
if ($videos===false) {
$this-paginate['contain']=array(
'Tag' = array('fields' = array('Tag.id', 
'Tag.name')),
false
);
$videos=$this-paginate(null, array('Site.enabled' = 
1));
Cache::set(array('duration' = 
Configure::read('Cache.home')));
Cache::write($cachename, $videos);
}
$this-set('videos', $videos);
}

This is the code I'm using.. Cache works everywhere, this is the only
place it doesn't.

Thanks for your help
--~--~-~--~~~---~--~~
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: Pagination + cache: they can't be together?

2009-09-08 Thread ark0n3

Thank you Jon, this is the second time I get replied from you and
you've always been extremely kind!
I understood your code but it does not seems to me like the righteous
MVC way, so I think I'll be using a different approach. I had to code
a pagination method to work with HABTM relationships and I'm gonna use
it to replace CakePHP native pagination. This could seems like killing
flies with a bazooka but I prefer this way than messing up the code.

Thanks again Jon


On 8 Set, 16:01, Jon Bennett jmbenn...@gmail.com wrote:
  Here's a bit of code, had to strip out of a project, so it won't work
  out-of-the-box,http://pastie.org/609566

 I should point out that the pagination is being outputted as JSON,
 hence why I caching the paginator data as an array and not html.

 jb

 --

 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
-~--~~~~--~~--~--~---



MVC-way to obtain common data formatting

2009-08-26 Thread ark0n3

Hi
I'm trying to understand if and in which way could be possible to
achieve such a result. Maybe I've explained the wrong way: I need to
format some common fields like boolean value and achieve this adding
an afterFind(results) callback in the app_model.php. I'd like to know
if this is the best way to accomplish this 'cause I noticed that (of
course) it causes problems when trying to edit something: the datas
are formatted as I requested in the app_model but this causes
validation problems (super simple example: boolean humanized as Yes/
No and no more as 1/0).

Thanks
ark0n3
--~--~-~--~~~---~--~~
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-26 Thread ark0n3

Hi Jon
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..



On 26 Ago, 11:23, Jon Bennett jmbenn...@gmail.com wrote:
 Hi Nicola.

  I'm trying to understand if and in which way could be possible to
  achieve such a result. Maybe I've explained the wrong way: I need to
  format some common fields like boolean value and achieve this adding
  an afterFind(results) callback in the app_model.php. I'd like to know
  if this is the best way to accomplish this 'cause I noticed that (of
  course) it causes problems when trying to edit something: the datas
  are formatted as I requested in the app_model but this causes
  validation problems (super simple example: boolean humanized as Yes/
  No and no more as 1/0).

 I would have thought the only time you need to display 1 or 0 as yes
 or no is in the view. You're quite right that if you adjust the data
 in app_model, it will break your DB.

 I have a Config value set in my bootstrap, and output that. eg:

 // bootstrap.php
 Configure::write('yesno', array(0='No', 1='Yes');

 // View
 Configure::read('yesno.'.$row[$modelClass]['field']); // outputs 'Yes'
 for 1, and 'No' for 0.

 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
-~--~~~~--~~--~--~---



Re: MVC-way to obtain common data formatting

2009-08-26 Thread ark0n3

@ Bert: yes that's the problem, I'm looking for a way to accomplish in
an automatic way and not only for boolean fields (which aren't
difficult to implement with an ad-hoc behavior)

On 26 Ago, 15:46, Bert Van den Brande cyr...@gmail.com wrote:
 I don't really understand the problem you present.

 Either you display a model field as a read-only piece of information
 in the view, and then there is no problem with data being updated.

 Or you display model data in a form that can be edited, and in case of
 for example the boolean you provide a dropdown list or use a radio
 button that displays a readable string to the user but holds the raw
 data as the value.

 On Wed, Aug 26, 2009 at 2:46 PM, ark0n3nicolabeg...@gmail.com wrote:

  Hi Jon
  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..

  On 26 Ago, 11:23, Jon Bennett jmbenn...@gmail.com wrote:
  Hi Nicola.

   I'm trying to understand if and in which way could be possible to
   achieve such a result. Maybe I've explained the wrong way: I need to
   format some common fields like boolean value and achieve this adding
   an afterFind(results) callback in the app_model.php. I'd like to know
   if this is the best way to accomplish this 'cause I noticed that (of
   course) it causes problems when trying to edit something: the datas
   are formatted as I requested in the app_model but this causes
   validation problems (super simple example: boolean humanized as Yes/
   No and no more as 1/0).

  I would have thought the only time you need to display 1 or 0 as yes
  or no is in the view. You're quite right that if you adjust the data
  in app_model, it will break your DB.

  I have a Config value set in my bootstrap, and output that. eg:

  // bootstrap.php
  Configure::write('yesno', array(0='No', 1='Yes');

  // View
  Configure::read('yesno.'.$row[$modelClass]['field']); // outputs 'Yes'
  for 1, and 'No' for 0.

  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
-~--~~~~--~~--~--~---



Re: MVC-way to obtain common data formatting

2009-08-26 Thread ark0n3

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 jmbenn...@gmail.com 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
-~--~~~~--~~--~--~---



GROUP BY bug?

2008-12-21 Thread ark0n3

Hi
I'm porting some apps to CakePHP and experimenting with the GROUP BY
used by this framework.
Having a find('all', $c) with
$c=array(
array(
'Client.id',
'Client.name',
'Transaction.data',
'Transaction.conteggiato',
'Transaction.riscosso',
'Transaction.id',
'Type.id',
'Type.title',
'Currency.symbol',
'SUM(Transaction.import) as 
importo'
),
'group' = array('MONTH(Transaction.data)');

This code block returns an array that's (imho) wrongly indexed. It
returns something like
$results =
'Transaction' = array('id', 'title')
'Type' = array('id', 'title')
'0' = array('import')

This means it puts the fields affected by the SUM() function in a
different array indexed as 0 (zero) and not in the right one
(Transaction).

Is this a normal behaviour of Cakephp or not? I've fixed the thing
with this code inside afterFind($results) {
foreach($results as $k = $r) {
if (isset($r[0])) { foreach($r[0] as $k2 = $v2) 
$results[$k]
['Transaction'][$k2]=$v2; unset($results[$k][0]); }
}

Thanks
ark0n3
--~--~-~--~~~---~--~~
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: A newbie question (I'm unable to find it answered)

2008-12-20 Thread ark0n3

Yes I've already accomplished it that way but it seems to me like a
too low-level solution: CakePHP let us centralize models so I hope I
could achieve the same result in the whole app.
Is there no way to access the Helper classes?


On 19 Dic, 23:01, teknoid teknoid.cake...@gmail.com wrote:
 Just do that in the view...

 echo $booleanField ? 'Yes' : 'No';

 On Dec 18, 6:27 pm, ark0n3 nicolabeg...@gmail.com wrote:

  Is there absolutely no way to accomplish that? It seems to me like an
  obvious way to centralize some model-view i.e. if a Model is flagged
  notvisibile it seems natural to me to define afterFind() to make
  sure the boolean flag is always printed out like Yes and not 1.

  Thanks

  On 19 Dic, 00:18, teknoid teknoid.cake...@gmail.com wrote:

   helpers are not meant to be used in the models, they are only to be
   used in views.

   if you need something similar to what a helper method does, you could
   just take a look at the code and re-create a method to be used in your
   model or app model.

   On Dec 18, 5:05 pm, ark0n3 nicolabeg...@gmail.com wrote:

I'm experimenting with the method you suggested and it's great.. today
I had only great problem: how to use an helper in the model? If I
define the $helpers array I'm unable to use i.e. Number $number-

currency($number, $currency)...

Thanks for your HUGE help!!!

On 12 Dic, 23:20, mark_story mark.st...@gmail.com wrote:

 Perhaps try editing the model data in afterFind().  Or changing it
 before its saved in beforeSave().  Both of these methods would be in
 your models.

 -Mark

 On Dec 12, 2:52 pm, ark0n3 nicolabeg...@gmail.com wrote:

  Hi
  I'm sorry to bother you with some newbye question, but I'm really
  unable to find it answered on the newsgroup (it's difficult to 
  explain
  and it's difficult to google it..)

  I'm trying to improve my PHP skills using the powerful CakePHP
  framework: at the moment I'm porting an old movie-catalog 
  application
  to the framework, and everything is becoming more clear as soon as 
  I'm
  re-engineering every part of the old application. Also the shell 
  part
  didn't was so hard, instead Cake let me do the same work with less
  code and more structural design.

  Here's the question:
  I want to add a piece of string all the times I output a Model: i.e.
  have a Movie having two fields, 'disc' and 'comedy'. The 'comedy'
  field is boolean, and I want that every time a Movie is sent to view
  the 'disc' field is changed to C-'disc'. (I want to add a prefix to
  the disc). Is that possible? I've tried editing $this-data with
  beforeFilter and beforeRender but with no luck..

  Hope someone will help me!

  Thanks
  ark0n3
--~--~-~--~~~---~--~~
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: A newbie question (I'm unable to find it answered)

2008-12-18 Thread ark0n3

I'm experimenting with the method you suggested and it's great.. today
I had only great problem: how to use an helper in the model? If I
define the $helpers array I'm unable to use i.e. Number $number-
currency($number, $currency)...


Thanks for your HUGE help!!!

On 12 Dic, 23:20, mark_story mark.st...@gmail.com wrote:
 Perhaps try editing the model data in afterFind().  Or changing it
 before its saved in beforeSave().  Both of these methods would be in
 your models.

 -Mark

 On Dec 12, 2:52 pm, ark0n3 nicolabeg...@gmail.com wrote:

  Hi
  I'm sorry to bother you with some newbye question, but I'm really
  unable to find it answered on the newsgroup (it's difficult to explain
  and it's difficult to google it..)

  I'm trying to improve my PHP skills using the powerful CakePHP
  framework: at the moment I'm porting an old movie-catalog application
  to the framework, and everything is becoming more clear as soon as I'm
  re-engineering every part of the old application. Also the shell part
  didn't was so hard, instead Cake let me do the same work with less
  code and more structural design.

  Here's the question:
  I want to add a piece of string all the times I output a Model: i.e.
  have a Movie having two fields, 'disc' and 'comedy'. The 'comedy'
  field is boolean, and I want that every time a Movie is sent to view
  the 'disc' field is changed to C-'disc'. (I want to add a prefix to
  the disc). Is that possible? I've tried editing $this-data with
  beforeFilter and beforeRender but with no luck..

  Hope someone will help me!

  Thanks
  ark0n3
--~--~-~--~~~---~--~~
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: A newbie question (I'm unable to find it answered)

2008-12-18 Thread ark0n3

Is there absolutely no way to accomplish that? It seems to me like an
obvious way to centralize some model-view i.e. if a Model is flagged
notvisibile it seems natural to me to define afterFind() to make
sure the boolean flag is always printed out like Yes and not 1.

Thanks

On 19 Dic, 00:18, teknoid teknoid.cake...@gmail.com wrote:
 helpers are not meant to be used in the models, they are only to be
 used in views.

 if you need something similar to what a helper method does, you could
 just take a look at the code and re-create a method to be used in your
 model or app model.

 On Dec 18, 5:05 pm, ark0n3 nicolabeg...@gmail.com wrote:

  I'm experimenting with the method you suggested and it's great.. today
  I had only great problem: how to use an helper in the model? If I
  define the $helpers array I'm unable to use i.e. Number $number-

  currency($number, $currency)...

  Thanks for your HUGE help!!!

  On 12 Dic, 23:20, mark_story mark.st...@gmail.com wrote:

   Perhaps try editing the model data in afterFind().  Or changing it
   before its saved in beforeSave().  Both of these methods would be in
   your models.

   -Mark

   On Dec 12, 2:52 pm, ark0n3 nicolabeg...@gmail.com wrote:

Hi
I'm sorry to bother you with some newbye question, but I'm really
unable to find it answered on the newsgroup (it's difficult to explain
and it's difficult to google it..)

I'm trying to improve my PHP skills using the powerful CakePHP
framework: at the moment I'm porting an old movie-catalog application
to the framework, and everything is becoming more clear as soon as I'm
re-engineering every part of the old application. Also the shell part
didn't was so hard, instead Cake let me do the same work with less
code and more structural design.

Here's the question:
I want to add a piece of string all the times I output a Model: i.e.
have a Movie having two fields, 'disc' and 'comedy'. The 'comedy'
field is boolean, and I want that every time a Movie is sent to view
the 'disc' field is changed to C-'disc'. (I want to add a prefix to
the disc). Is that possible? I've tried editing $this-data with
beforeFilter and beforeRender but with no luck..

Hope someone will help me!

Thanks
ark0n3
--~--~-~--~~~---~--~~
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: A newbie question (I'm unable to find it answered)

2008-12-14 Thread ark0n3

You're the best, that's just the exact thing I need!

Really, really thanks!
ark0n3

On 12 Dic, 23:20, mark_story mark.st...@gmail.com wrote:
 Perhaps try editing the model data in afterFind().  Or changing it
 before its saved in beforeSave().  Both of these methods would be in
 your models.

 -Mark

 On Dec 12, 2:52 pm, ark0n3 nicolabeg...@gmail.com wrote:

  Hi
  I'm sorry to bother you with some newbye question, but I'm really
  unable to find it answered on the newsgroup (it's difficult to explain
  and it's difficult to google it..)

  I'm trying to improve my PHP skills using the powerful CakePHP
  framework: at the moment I'm porting an old movie-catalog application
  to the framework, and everything is becoming more clear as soon as I'm
  re-engineering every part of the old application. Also the shell part
  didn't was so hard, instead Cake let me do the same work with less
  code and more structural design.

  Here's the question:
  I want to add a piece of string all the times I output a Model: i.e.
  have a Movie having two fields, 'disc' and 'comedy'. The 'comedy'
  field is boolean, and I want that every time a Movie is sent to view
  the 'disc' field is changed to C-'disc'. (I want to add a prefix to
  the disc). Is that possible? I've tried editing $this-data with
  beforeFilter and beforeRender but with no luck..

  Hope someone will help me!

  Thanks
  ark0n3

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



A newbie question (I'm unable to find it answered)

2008-12-12 Thread ark0n3

Hi
I'm sorry to bother you with some newbye question, but I'm really
unable to find it answered on the newsgroup (it's difficult to explain
and it's difficult to google it..)

I'm trying to improve my PHP skills using the powerful CakePHP
framework: at the moment I'm porting an old movie-catalog application
to the framework, and everything is becoming more clear as soon as I'm
re-engineering every part of the old application. Also the shell part
didn't was so hard, instead Cake let me do the same work with less
code and more structural design.

Here's the question:
I want to add a piece of string all the times I output a Model: i.e.
have a Movie having two fields, 'disc' and 'comedy'. The 'comedy'
field is boolean, and I want that every time a Movie is sent to view
the 'disc' field is changed to C-'disc'. (I want to add a prefix to
the disc). Is that possible? I've tried editing $this-data with
beforeFilter and beforeRender but with no luck..

Hope someone will help me!

Thanks
ark0n3

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---