Testing AppModel by core Cake tests

2015-03-12 Thread Dmitry Romanov
Hello Everyone, 

I have changed standart behaviour for models in my AppModel, and i'm 
running core CakePHP tests (testsuite core Model/Model), but models in 
tests not uses my AppModel.

How can I test my AppModel with tests from cake?

Thank you.

-- 
Dmitry Romanov

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


ajax validation with rules from model

2013-09-11 Thread Dmitry Romanov
I'm looking some CakePHP plugin for ajax validation. 

Requirements:
1. Gets validate rules from Model
2. Validates after edit of input field

Thanks.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: RequestHandler::isAjax() buggy?

2010-11-29 Thread Dmitry Shevchenko
Hi, maytbe this will halp you to find your bug.

I have add into app_controller before_filter() this lines

$this-disableCache();
I've found this solution in http://osdir.com/ml/CakePHP/2010-01/msg00629.html
(for view this link content - look into google cache, now it forbidden
for me :( )


On Nov 29, 5:57 am, Dr. Loboto drlob...@gmail.com wrote:
 Check that request is really done. I never saw this in anything except
 IE, but in IE it is always aggressive caching when browser do not
 repeat request to the same URL in the short period of time at all. If
 you see same (no real request) in other browsers it is definitely
 aggressive caching by headers of your app or your web server.

 On 29 ноя, 02:34, cricket zijn.digi...@gmail.com wrote:

  On Sun, Nov 28, 2010 at 2:56 PM, cricket zijn.digi...@gmail.com wrote:
   I'm seeing some strange behavior on a site. I haven't been able to
   reproduce it locally, just on the server, and it's also only showing
   up just once in a while. What's happening is, occasionally, isAjax()
   is incorrectly returning true, and so just the element is rendered.

   public function index()
   {
          $this-Session-write('path_back', $this-here);

          $this-set('data', $this-paginate());

          if ($this-RequestHandler-isAjax())
          {
                  $this-viewPath = 'elements'.DS.'books';
                  $this-render('pagination');
          }
   }

   So, I've got  a paginated list of books, and I'm loading further pages
   using AJAX. The session business allows me to get back to the correct
   index page from a view view. I can't think of any reason why that
   would be involved, though.

   I can't remember seeing anyone else report this sort of thing. Has
   anyone run into it? Or have any suggestions for why this might be
   occurring? Or how to go about debugging this?

  Sorry for the noise. This fell into my lap while I was busily trying
  to get something else to deadline and I wasn't thinking things through
  very well. It's not a Cake issue, although I'll continue here as it
  might be of help to someone someday.

  The obvious first step is to log the request headers before rendering
  just the element. I did that and see:

  [X-Requested-With] = XMLHttpRequest

  So Cake is doing the right thing. Next step: check the browser. I was
  using FF 3.6.12. I could see that the page is being refreshed but
  tried disabling JS anyway. Sure enough, I was able to eventually
  repeat it. I then opened the site in Chrome (7.0.517.44) and clicked
  away for a while (remember, this bug only shows up occasionally). I
  was literally just about to give up on Chrome when the bug showed
  itself. I then was able to get Opera (10.10) to do it.

  I disabled caching, on the principle that it couldn't hurt, so why
  not? No difference.

  Speaking of caching: Firefox is showing this un-styled rendered
  element, and I try shift-refresh. After four or five tries, the page
  finally loads correctly. WTF? This makes no sense at all.

  Maybe an Apache bug? That's beginning to seem like the only
  explanation. Especially as everything's fine locally. Will update that
  and post results.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 url options

2010-11-24 Thread Dmitry Shevchenko
Thank you Dr. Loboto
This is really great fix. - all works perfectly.

p.s. it is really sad that this feature not described in the docs

On Nov 24, 5:54 am, Dr. Loboto drlob...@gmail.com wrote:
 $paginator-options(array('url' = array('?' = $this-

 data['Search']));

 On 24 ноя, 09:31, Dmitry Shevchenko dmitr...@gmail.com wrote:

  I found a very bad solution
  1. make convert from array to url manually
  2. add this to parameters array
  3. unset not flat array's in param

  f.e.
  $seeking_url = '';
              if (!empty($this-data['Search']['seeking']))
              {
                  $seeking_url .= seeking=; //make url to string

                  foreach ($this-data['Search']['seeking'] as $field=
  $value)
                  {
                      $seeking_url .= seeking[]=.$value; //make url
  to string
                  }
                  $this-data['Search']['see'] = $seeking_url; //add to
  params

                 unset($this-data['Search']['seeking']); // unset real
  array

      }

  but this is VERY UGLY solution. Maybe someone knew better ??

  On Nov 23, 3:55 pm, Dmitry Shevchenko dmitr...@gmail.com wrote:

   Hi.
   I found a some error when using paginator- options ( .. url ..)

   for example this is my call for paginator in view.
   $paginator-options  (array('url' = $this-data['Search'] ..

   and if data['Search'] is flat array - all is good - it will create a
   correct url
   but if it contain a sub arrays like:
   $url    =       array(
           controller = profiles,
           plugin = null,
           page = 1,
           search_type = advanced,
           age_from = 0,
           age_to = 0,
           with_photo = 0,
           is_online = 0,
           seeking = array(
           5,
           7
   ),

   I'm getting a Array to string conversion [ROOT\cake\cake\libs
   \router.php, line 952]

   It seems cake doesn't convert sub arrays like
   seeking=seeking[]=1seeking[]=2seeking[]=4seeking[]=7

   Do anyone knew some workaround for this?

   p.s. I'm using cake 1.2.6 and possibly found a bug

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 url options

2010-11-23 Thread Dmitry Shevchenko
Hi.
I found a some error when using paginator- options ( .. url ..)

for example this is my call for paginator in view.
$paginator-options  (array('url' = $this-data['Search'] ..

and if data['Search'] is flat array - all is good - it will create a
correct url
but if it contain a sub arrays like:
$url=   array(
controller = profiles,
plugin = null,
page = 1,
search_type = advanced,
age_from = 0,
age_to = 0,
with_photo = 0,
is_online = 0,
seeking = array(
5,
7
),

I'm getting a Array to string conversion [ROOT\cake\cake\libs
\router.php, line 952]

It seems cake doesn't convert sub arrays like
seeking=seeking[]=1seeking[]=2seeking[]=4seeking[]=7


Do anyone knew some workaround for this?


p.s. I'm using cake 1.2.6 and possibly found a bug

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 url options

2010-11-23 Thread Dmitry Shevchenko
I found a very bad solution
1. make convert from array to url manually
2. add this to parameters array
3. unset not flat array's in param

f.e.
$seeking_url = '';
if (!empty($this-data['Search']['seeking']))
{
$seeking_url .= seeking=; //make url to string

foreach ($this-data['Search']['seeking'] as $field=
$value)
{
$seeking_url .= seeking[]=.$value; //make url
to string
}
$this-data['Search']['see'] = $seeking_url; //add to
params

   unset($this-data['Search']['seeking']); // unset real
array

}


but this is VERY UGLY solution. Maybe someone knew better ??


On Nov 23, 3:55 pm, Dmitry Shevchenko dmitr...@gmail.com wrote:
 Hi.
 I found a some error when using paginator- options ( .. url ..)

 for example this is my call for paginator in view.
 $paginator-options  (array('url' = $this-data['Search'] ..

 and if data['Search'] is flat array - all is good - it will create a
 correct url
 but if it contain a sub arrays like:
 $url    =       array(
         controller = profiles,
         plugin = null,
         page = 1,
         search_type = advanced,
         age_from = 0,
         age_to = 0,
         with_photo = 0,
         is_online = 0,
         seeking = array(
         5,
         7
 ),

 I'm getting a Array to string conversion [ROOT\cake\cake\libs
 \router.php, line 952]

 It seems cake doesn't convert sub arrays like
 seeking=seeking[]=1seeking[]=2seeking[]=4seeking[]=7

 Do anyone knew some workaround for this?

 p.s. I'm using cake 1.2.6 and possibly found a bug

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


2 database, 1 models and controllers, many views

2010-10-28 Thread Dmitry Shevchenko
Hi.
Is it possibly for cake to have 2 different database, which is use
same models and controllers and different views.

I need this to create a almost copy of website, so system logic will
be the same, I will only have separated DB and views.

Seems this could be done by switching config on config.php and maybe
dispatcher.php... but I'm not sure.

Is someone do something similar ?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: 2 database, 1 models and controllers, many views

2010-10-28 Thread Dmitry Shevchenko
I wanted to create 2 separated web site which will use same models and
controllers.

main aim - run 2 sites which will use almost the same logic but it
will be build with different design.
I wanted to use same models and controllers, because I want to support
only one version.

so database structure, models, controllers will be the same
differents - views (design) and domains.




On Oct 28, 2:54 pm, Zaky Katalan-Ezra procsh...@gmail.com wrote:
 What is your goal?

 On Thu, Oct 28, 2010 at 12:31 PM, Dmitry Shevchenko dmitr...@gmail.comwrote:



  Hi.
  Is it possibly for cake to have 2 different database, which is use
  same models and controllers and different views.

  I need this to create a almost copy of website, so system logic will
  be the same, I will only have separated DB and views.

  Seems this could be done by switching config on config.php and maybe
  dispatcher.php... but I'm not sure.

  Is someone do something similar ?

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
  with their CakePHP related questions.

  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.comcake-php%2bunsubscr...@googlegroups.comFor
   more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en

 --
 Regards,
 Zaky Katalan-Ezra
 QA Administratorwww.IGeneriX.com
 Sites.IGeneriX.com
 054-7762312

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: cakePHP + openID component (cakebaker) + google

2010-10-22 Thread Dmitry Shevchenko
Thank you Dr. Loboto:
I'm using a https link for test - like https://www.google.com/accounts/o8/id
and still has a invalid openID

I have made some additional research ..
my test server don't bind on 80 port, it use  port, so l have to
change
$returnTo
from = 'http://'.$_SERVER['SERVER_NAME'].$this-webroot;

to = 'http://'.$_SERVER['HTTP_HOST'].$this-webroot;

but when I'm test it with myopenid I'm getting: The request was not a
valid OpenID request. While processing the request, the following
error occurred: return_to not under trust_root u'X'

look like openID response couldn't be send to not standard port?

Am I right? Does someone seen this error?
Please help me.


On Oct 22, 7:20 am, Dr. Loboto drlob...@gmail.com wrote:
 Google needs HTTPS instead of HTTP as MyOpenId.

 On Oct 22, 1:32 am, Dmitry Shevchenko dmitr...@gmail.com wrote:

  Hi.
  I'm trying to run example fromhttp://code.42dh.com/openid/. For
  regular openID provider like MyOpenid it works fine, but when I'm
  trying to use it for google (https://www.google.com/accounts/o8/id)
  it show me Invalid OpenID .

  but when I use demo:  http://openid-example.42dh.com/allworks
  perfectly. Maybe someone has the same??

  Please help me..

  p.s. Maybe someone knew other openid component for cake ?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


cakePHP + openID component (cakebaker) + google

2010-10-21 Thread Dmitry Shevchenko
Hi.
I'm trying to run example from http://code.42dh.com/openid/. For
regular openID provider like MyOpenid it works fine, but when I'm
trying to use it for google ( https://www.google.com/accounts/o8/id )
it show me Invalid OpenID .

but when I use demo:  http://openid-example.42dh.com/ all works
perfectly. Maybe someone has the same??

Please help me..

p.s. Maybe someone knew other openid component for cake ?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Validation translations

2010-09-10 Thread Dmitry Shevchenko
Thank you Sanza and Dr. Loboto
I've tried  Sanza's example and it works.
I will try a Dr. Loboto example lately.
Thank you!!!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: ajax helper for updating a div

2010-09-09 Thread Dmitry Shevchenko
Hi,
1.
place $this-render('your ajax view'); into controller
deleteattachment() function

2. you can add your variables to url
will look like
array('controller' = 'linkables', 'action' = 'deleteattachment',
param1,param2

and it will be available in the controller as $this-params.

try to pr($this); to see all available data;

On Sep 9, 3:01 pm, Tomfox Wiranata tomfox.wiran...@gmail.com wrote:
 hi,

 again, ajax is driving me nuts. shocker! :)

 I have a certain DIV that echoes data from a table. with each data row
 comes an ajax link to delete it. when a user clicks that link, a
 delete() function in my controller deletes that certain data and this
 DIV is supposed to update. I found some code for orientation, but it
 wont work.

 the View render_attachment.ctp echoes the data from my table and has
 the ajax link:

 ?php

     echo $javascript-link('prototype');
     echo $javascript-link('scriptaculous');

 ?

         ?php

                 foreach ($attachments as $attachment):

                 echo $attachment['LinkTmp']['name'];
                 echo $ajax-link('x', array('controller' =
 'linkables', 'action' = 'deleteattachment'), array('update' =
 'attachment_div'));

         ?

                 ?php endforeach; ?

         div id=attachment_div/div

 the render_attachment.ctp View is called after a file-upload-process
 to show the user what files he uploaded:

     function __renderattachment()
     {
         $this-set('attachments', $this-Link-LinkTmp-find('all',
 array('conditions' = array('LinkTmp.ed =' = $this - Session -
 read('Link.eyed'), 'LinkTmp.attachment' = '1';
         $this-render('render_attachment','ajax');
     }

 Now with the ajax link I try to call the deleteattachment() fnction
 in my controller, that acutally deletes that data from the table:

         function deleteattachment($name)
         {
                 $this-Link-LinkTmp-deleteAll(array('LinkTmp.eyed' = $this 
 -
 Session - read('Link.eyed'), 'LinkTmp.name'  = $name));

         }

 so, how do I

 a) tell cake to render my view render_attachment.ctp in the DIV that
 i defined in the link, after i called deleteattachment() ?

 b) how can i pass variables to deleteattachment() with my ajax link?
  echo $ajax-link('x', array('controller' = 'linkables', 'action' =
 'deleteattachment'), array('update' = 'attachment_div'));

 thx :)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Validation translations

2010-09-09 Thread Dmitry Shevchenko
Hi.
I have a problem with translation validation messages. seems it didn't
takes from view.


I have a validation rules for field, it looks like:

'looking_agegroup_to' = array(
'checkRange'=array (
'rule'   =
array('range', 16, 100),
'message'=
'Please enter a number between 16 and 100',
'allowEmpty' =
true
),
'checkAgeGroup' = array(
'rule'   =
array('_checklookingAgeGroup'),
'message'=
'Please check age in the from and to checkboxes',
)
),

on my view I have displayed this field like this
echo $form-input('ProfileExtend.looking_agegroup_to',
array('label'= __('to:',true),
  'div' = array('class' =
'shortselect2'),
  'empty' = '',
  'options' = $age_range,
  'error' = array(
  'checkRange'
= __('Please enter a number between 120 and 210', true),
  'checkAgeGroup' =
__('Please verify data in the age fields', true)
  ),
)
);

When error happened I see a message which is set in the validation
rule, not what I set in the view.

If someone knew a solution - please help me. This bug is killing me.
Thanks a lot.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


cakePHP + openid on windows XP

2010-09-03 Thread Dmitry Shevchenko
Hi
I have use openId component from cakebaker (http://code.42dh.com/
openid/) and when I'm trying to authentificate fom google I'm getting
an errors:

handleOpenIDResponse

Notice (8): Undefined variable: sregContents [APP\controllers
\users_controller.php, line 229]

Auth_OpenID_FailureResponse Object
(
[status] = failure
[endpoint] =
[identity_url] =
[message] = Server denied check_authentication
[contact] =
[reference] =
)

my config is
OS Win XP
PHP 5.2.12
cakePHP 1.2.6



I have double check is openSSL and curl enabled, also I have added a
patch from  http://www.pixelastic.com/blog/171:adding-openid-support
for windows

Maybe someone stuck in the same trouble?
I really appreciate any help.

Thank you.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Controller::render not running actions?

2010-08-26 Thread Dmitry Shevchenko
Hi.
You should use a requestAction()
http://book.cakephp.org/view/434/requestAction

On 26 авг, 18:49, jostster josts...@gmail.com wrote:
 Well I would expect Controller::render(); to run the controller action
  the view and only View::render() to render the view.

 On Aug 26, 7:31 am, Jeremy Burns | Class Outfit

 jeremybu...@classoutfit.com wrote:
  Render just does what it says it will; render a view. It does not run the 
  controller action with the same name. You can try $this-index(); which 
  will run the action, but I'm not sure if the values you have set will be 
  available. You could drop them into a keyed array (instead of loads of 
  variable) and pass them into the index action as an optional variable.

  Jeremy Burns
  Class Outfit

  jeremybu...@classoutfit.comhttp://www.classoutfit.com

  On 26 Aug 2010, at 00:49, jostster wrote:

   Is it just me misunderstanding what this is supposed to do or is it a
   bug?

   I have an Upload controller with 2 actions.

   index():
   This is where the database query is done to retrieve dropdown list
   values and send them to the index.ctp where the form is created.

   upload():
   This is where the validating is done and the uploading to the system
   is done.

   Problem:
   In upload() I have it do validation and if validation fails then it
   will do Controller::render('index'); so that it will display the form
   again with the error messages.  Even though the index view is
   displayed the UploadController::Index is not run so that the values
   from the database can be retrived.

   Temp solution:
   What I have to do right now is before I call
   Controller::render('index'); I have to call $this-index(); so that
   the database query will be ran and the $this-set() values are created
   for the index.ctp file.

   My understanding of how this SHOULD work is if
   Controller::render('index') is ran then it will run the action for
   index() and then run the index view.  Is this not the case?

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
   with their CakePHP related questions.

   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 
   athttp://groups.google.com/group/cake-php?hl=en



Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


How to use $session in the helpers

2010-08-26 Thread Dmitry Shevchenko
Hi.
I use $session in my views like $session-read('some_var') and it have
same values as on controller (I mean $this-Session-read('some_var'))

But when I tried to use it on helper I get error that session are not
defined.

Is there any way to use $session inside the helper?

Thank you for you help

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


get result in the $options['complete'] callback

2010-08-25 Thread Dmitry Shevchenko
Hi
I have used ajax for submitting form. And I wanted to know - is there
any way to get status of submitting in the $options['complete']
callback

for example, I submit  a form and get a validation error, code in the
$options['complete'] will run, but I need to execute it only if form
submit successfully.

Maybe someone knew any other way to execute different code depending
on submitting result.

Many thanks.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


translate emails in cron run

2010-07-19 Thread Dmitry Shevchenko
Hi.
I have used a cron job to send emails to user, and I have a issue with
translations.

If I use translation in http call all is fine - pages translated
correctly (I set Configure::write('Config.language', 'en'); in my
app_controller)/

But when I'm trying to set language in cron - it sets, but without any
translations. seems that it didn't include any .po data.


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: translate emails in cron run

2010-07-19 Thread Dmitry Shevchenko
as I understand it use getText, but why it works on http, and
completely break when I tried ti run it from console
like php cron_dispatcher.php /CronJobs/send

does anyone knew something about it

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: cron dispatcher and route

2010-07-03 Thread Dmitry Shevchenko
Hi seems that the fastest solution - is set FULL_BASE_URL in the cron
dispatcher
if (!defined('FULL_BASE_URL')) {
define('FULL_BASE_URL', 'http://www.mydomain.com');
}

if someone knew better way - please tell me.
Thank you.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


cron dispatcher and route

2010-06-30 Thread Dmitry Shevchenko
Hi
I have created a cron job which is send emails.
On email template I use route to create correct links.

When I send email from normal environment all links created correct,
but when I'm trying to send it by cron I have get a links without
domain, it looks like (/user/login  I wanted domain.com/user/login)

I have tried to import route and config in the cron action
App::import('Core', array('Router','Controller'));
include CONFIGS . 'routes.php';

but this is didn't help.

Does someone know any workaround for this?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: how to disable query caching?

2010-06-23 Thread Dmitry Shevchenko
Thank you AD7six and alagar

I will try your solutions

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


how to disable query caching?

2010-06-22 Thread Dmitry Shevchenko
Hi !
Is there any way to disable caching for $this-model-query()
I have used
$this-MyModel-cacheQueries = false;  and same setting in model   var
$cacheQueries = false;
but seems that this isn't work

Does anyone knew some workaround for this?
p.s. I use CakePHP 1.2.5

Thanks for your help.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: how to disable query caching?

2010-06-22 Thread Dmitry Shevchenko
Hi
I have turned on debug and saw that query is called only one time.
So  when I have tried to call it many times in a loop - it was run
only in a first call, and for other calls it returned a cached values.

Thank you.

On 22 Чер, 20:22, Miles J mileswjohn...@gmail.com wrote:
 What do you mean its cached? What is it doing exactly.

 On Jun 22, 7:21 am, Dmitry Shevchenko dmitr...@gmail.com wrote:



  Hi !
  Is there any way to disable caching for $this-model-query()
  I have used
  $this-MyModel-cacheQueries = false;  and same setting in model   var
  $cacheQueries = false;
  but seems that this isn't work

  Does anyone knew some workaround for this?
  p.s. I use CakePHP 1.2.5

  Thanks for your help.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: cakePHP emai component

2010-06-14 Thread Dmitry Shevchenko
Thank you Sergei, but ptoblem didn't fixed yetl.

I have changed structure in my aoo. now I use email comoinent in
controller, but variables didn't set also. And warnings stiil
aprear. ... I haven't any Idea why this happen
I have tried to use component by var $component, and by app::
import ...


On Jun 14, 5:35 am, Sergei yatse...@gmail.com wrote:
 Because $this-set in model != $this-set in controller. You should
 set() varibales for template from controller. set() from model sets
 data for DB.

 Use it from controller.

 On Jun 14, 10:00 am, Dmitry Shevchenko dmitr...@gmail.com wrote:

  I have tried to import email component in my model, and seems all is
  ok, except I CAN'T send data to template,
  but sender addr, subject and other looks ok. I do this like:

             App::import('Component', 'Email');
              $this-Email = new EmailComponent();
              $this-Email-to = $to;
              $this-Email-subject = $emailSubject;
              $this-Email-replyTo = $replyToEmail;
              $this-Email-from = $from;
              $this-Email-template = $templateName;
              $this-Email-sendAs = $sendAs;
              $this-set('data', $data);

              $this-Email-send();

  Wnen I'm do a debug I'm getting :

  View Object
  (
      [base] =
      [here] =
      [plugin] =
      [name] =
      [action] =
      [params] = Array
          (
          )

      [passedArgs] = Array
          (
          )

      [data] = Array
          (
          )

      [helpers] = Array
          (
              [0] = Html
          )

      [viewPath] =  ...
   

  with the warnings
  Notice (8): Trying to get property of non-object [ROOT\cake\cake\libs
  \controller\components\email.php, line 363]
  Notice (8): Trying to get property of non-object [ROOT\cake\cake\libs
  \controller\components\email.php, line 370]
  Notice (8): Undefined property: View::$webroot [ROOT\cake\cake\libs
  \view\view.php, line 755]

  Could someone help me.

  Also, When I'm try to send email from other controller = all works
  perfectly

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


cakePHP emai component

2010-06-13 Thread Dmitry Shevchenko
I have tried to import email component in my model, and seems all is
ok, except I CAN'T send data to template,
but sender addr, subject and other looks ok. I do this like:

   App::import('Component', 'Email');
$this-Email = new EmailComponent();
$this-Email-to = $to;
$this-Email-subject = $emailSubject;
$this-Email-replyTo = $replyToEmail;
$this-Email-from = $from;
$this-Email-template = $templateName;
$this-Email-sendAs = $sendAs;
$this-set('data', $data);

$this-Email-send();

Wnen I'm do a debug I'm getting :

View Object
(
[base] =
[here] =
[plugin] =
[name] =
[action] =
[params] = Array
(
)

[passedArgs] = Array
(
)

[data] = Array
(
)

[helpers] = Array
(
[0] = Html
)

[viewPath] =  ...
 

with the warnings
Notice (8): Trying to get property of non-object [ROOT\cake\cake\libs
\controller\components\email.php, line 363]
Notice (8): Trying to get property of non-object [ROOT\cake\cake\libs
\controller\components\email.php, line 370]
Notice (8): Undefined property: View::$webroot [ROOT\cake\cake\libs
\view\view.php, line 755]


Could someone help me.

Also, When I'm try to send email from other controller = all works
perfectly

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: validation rules

2010-06-11 Thread Dmitry Shevchenko
Thank you for the answers.
Could you show me any example please.

On Jun 11, 2:02 pm, euromark dereurom...@googlemail.com wrote:
 yeah
 thats actually one of the downsites of cake's validation rule settings
 at least in the default way

 using __construct() you can achieve more dynamically created rules

 On 11 Jun., 05:35, Dr. Loboto drlob...@gmail.com wrote:

  Of course you get syntax error. Only constants can be used in class
  definition.

  You can overload model constructor and setup $validate there.

  On Jun 11, 8:22 am, Dmitry Shevchenko dmitr...@gmail.com wrote:

   Hi
   Did someone tried to create a array for the inList validation and
   then use it?
   for example
    var $test = array('one_day', 'five_days','never');

           var $validate = array(
                   'ty_id' = array('numeric'),
                   'date_arr' = array('allowed_data' = array(
                               'rule' = array('inList',  $test),
                               'message'    = 'Wrong data',
                               'allowEmpty' = false)
                             ),
                   );

   When I'm try to use this construction . I'm getting a syntax error

   Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


validation rules

2010-06-10 Thread Dmitry Shevchenko
Hi
Did someone tried to create a array for the inList validation and
then use it?
for example
 var $test = array('one_day', 'five_days','never');

var $validate = array(
'ty_id' = array('numeric'),
'date_arr' = array('allowed_data' = array(
'rule' = array('inList',  $test),
'message'= 'Wrong data',
'allowEmpty' = false)
  ),
);


When I'm try to use this construction . I'm getting a syntax error

Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Bookmarkable AJAX URLs

2010-04-19 Thread Dmitry Shevchenko
Hi!
Thank you Bert Van den Brande for answer.

I have added a js script for modify browser address string:
echo location.hash=\$this-here\;;

What do you mean - I don't need to modify any Cake's urls?
if I didn't modify it - I will get a very funny urls - like:
domain.com/profiles/view/48229#/profiles/view/31460

to solve this problem I have create a url like:

domain.com/#/controller/action/..
for that I have modified a ajax helper

function link ($title, $link, $options = array(), $confirm = null,
$escapeTitle = true)
   {
  $options = $this-_addOptions($options);
   return parent::link($title,#.$link,$options,$confirm,
$escapeTitle);
   }

BUT how to write a correct route, to explain cake to ignore # and use
all what goes after  # in url.

please help




On 16 апр, 19:14, Bert Van den Brande cyr...@gmail.com wrote:
 Afaik using # is the way to go.

 Changing any other aspect of the url besides what comes after the # will
 result in a load of the changed url by the browser.

 You don't need Cake to change the url's, just some javascript code that you
 execute every time the user navigates using your ajax links.

 On Fri, Apr 16, 2010 at 5:41 PM, Dmitry Shevchenko dmitr...@gmail.comwrote:



  Hi!
  I use ajax link (by ajax helper) in my current app almost everywhere.
  I
  now, when user navigate throw the site, URLs in the browser address
  line didn't changed.
  That's why user can't create bookmarks.
  Does anyone knew, how to push browser change address line, or some
  other workaround.

  p.s. I knew one way - add # to each url. Browser will automatically
  add  this parameter to address line. But seems that this is too ugly
  workaround. (And I don't know how to implement it by using Cake)

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
  with their CakePHP related questions.

  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.comcake-php%2bunsubscr...@googlegroups.comFor
   more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Bookmarkable AJAX URLs

2010-04-19 Thread Dmitry Shevchenko
Thank you for you advices, but I can't stop using ajax on my site, I
have a chat window on my pages, so if page will reloaded - I have to
relogin user to chat - this will overload chat server.
I knew about SEO problems, but I think we could fix it by sitemap and
robots.txt

So I needed a solution, how to wrote correct route with using # ,
like- domain.com/#/controller/action/params
I need  to explaine route ignor first #

Something simmilar to facebook urls - where most of all urls have a #!/
url

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Cake Ajax+prototype file upload

2010-04-18 Thread Dmitry Shevchenko
Hi!
Does anyone found some component/helper which get ability to Ajax file
upload?

I have tried to use solution described here:
http://bakery.cakephp.org/articles/view/comfortable-ajaxuploads-with-cakephp

But seems that it didn't work now.

Also, I have read 
http://bakery.cakephp.org/articles/view/swfupload-and-multipurpose-uploader,
but it looks a too old solution.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Bookmarkable AJAX URLs

2010-04-16 Thread Dmitry Shevchenko
Hi!
I use ajax link (by ajax helper) in my current app almost everywhere.
I
now, when user navigate throw the site, URLs in the browser address
line didn't changed.
That's why user can't create bookmarks.
Does anyone knew, how to push browser change address line, or some
other workaround.

p.s. I knew one way - add # to each url. Browser will automatically
add  this parameter to address line. But seems that this is too ugly
workaround. (And I don't know how to implement it by using Cake)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: SQL injection protect

2010-04-14 Thread Dmitry Shevchenko
Thank you for your help Sergei. It really helpfull.

I use this validation in many controllers, thats why I wrote component
for it.
I have too much urls in my project, where last parameter is  a digit -
unsigned int. And I need to validate it and show error message to user
if parameter is wrong.

I don't know better way to validate it :(

On Apr 14, 4:01 am, Sergei yatse...@gmail.com wrote:
 Dmitry,

 don't think, look at the source :)

 updateAll is exactly the answer. Your validation routine seems too
 heavy for one number. And you don't have to create a component to
 validate some data manually. You can always validate in controller.

 On Apr 14, 12:15 am, Dmitry Shevchenko dmitr...@gmail.com wrote:

  Sergei
  I think updateAll didn't sanitize data 
  -http://book.cakephp.org/view/75/Saving-Your-Data

  or I'm wrong?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using remove me as the subject.


Re: SQL injection protect

2010-04-13 Thread Dmitry Shevchenko
Thank you Sergei.



Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using remove me as the subject.


Re: SQL injection protect

2010-04-13 Thread Dmitry Shevchenko
Sergei
I think updateAll didn't sanitize data - 
http://book.cakephp.org/view/75/Saving-Your-Data

or I'm wrong?

mayde it's better to set id and then save data
//Update: id is set to a numerical value
# $this-Recipe-id = 2;
# $this-Recipe-save($this-data);


but the questions is still open.

Seems that solution -is create a new component and validate data
manually.
For example
function checkIntUnsigned($var, $withZero = false)
{
//forse type set
if (is_numeric($var))
settype($var, 'int');
else
  return false;

//var_dump(is_int($var));

if (is_int($var) == true)
{
if ($withZero == false)
{
if ($var  0 )
return true;
else
return false;
}
else // with_zero = true
{
if ($var = 0)
{
 //   echo ok =0 ;
return true;
}
}
}

return false;
}

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using remove me as the subject.


SQL injection protect

2010-04-12 Thread Dmitry Shevchenko
Hi everyone!

As I read documentation Cake automatically clean user input and we can
use save() and find() with aprameters without any worries.

But, what if we need to use sometning like this
$this-MyController-query(UPDATE photos SET profile_pic='1', status
= 'public' WHERE id=.$id. AND profile_id=.$this-Session-
read('Profile.id'));

where $id is taking from $this-data...

Do we need to call saitize-clean() or mysql_real_escape_string() each
time to clean param, or someone knew correct way to use this globally.

Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using remove me as the subject.


Re: Saving related table data

2010-02-24 Thread Dmitry
I am in the process of acquainting myself with Cake and have come
across a question related to `koala kid`'s. Namely, to explore the
$hasOne relationship:

-- I baked two models, Parental and Dependent, where parental_id is a
foreign key in `dependents` that references `parentals`.`id`.
-- Apart from `id`s, each model only has a `name` field.
--When I set the Parental model to $hasOne Dependent, I able to use
the standard baked controllers to add more than one Dependent to a
Parental. The Dependent model is associated by $belongsTo. Why is this
the standard behavior for this association?

On Feb 12, 11:04 am, koala kid alexhob...@gmail.com wrote:
 Hi John,

 thanks for your fix, its now working. I had assumed that as I was
 defining the relationship as ahasOneand belongsTo Cake would
 automatically know to Update rather than Insert as it was a 1 - 1
 relationship, using the Rental.id.

 This is where I am really struggling with Cake, so much is taken care
 for you that you don't know where it stops, and the documentation,
 although much improved, still makes it hard on occasion to find out.

 Anyway thanks again.

 On Feb 11, 3:02 am, John Andersen j.andersen...@gmail.com wrote:



  Your problem lies in this part:

      [Rate] = Array
          (
              [s1_title] = title 1
              [s1_day] = day 1
              [s1_week] =
              [s1_month] =
              [extra_info] =
          )

  I assume that this information was at first retrieved from the
  database and presented to the user. The user then changed something
  and saved.

  The above information lacks the Rate.id information - without which
  CakePHP assumes that you are saving a new record in the Rate model.

  You have to add the Rate.id as a hidden field in the view (worst
  solution) or get it from somewhere else.
  Hope this will help you on the way,
     John

  On Feb 10, 8:09 pm, koala kid alexhob...@gmail.com wrote:

   Hi, I'm still struggling with saving information to related tables. I
   have a form which updates info about a rental property and I have an
   associated Rates table which holds data about the rental rates for the
   property.

   I've defined my relationship as :

   Rental -hasOne
   Rate - belongsTo

   My save action looks like this:

   $this-Rental-saveAll($this-data);

   However this save action is creating a new entry in the Rates table
   rather than updating the existing one. I'm pretty sure my form data is
   in the correct format:

   Array
   (
       [Rental] = Array
           (
               [id] = 45
               [rental_code] = PDSSerena
               [location_id] = 19
               [rental_agent] =
               [rental_meta_url] =
               [rental_meta_title] =
               [rental_meta_desc] =
               [rental_meta_tags] =
           )

       [Rate] = Array
           (
               [s1_title] = title 1
               [s1_day] = day 1
               [s1_week] =
               [s1_month] =
               [extra_info] =
           )

   )

   Do I need to explicitly set the rental_id in my Rate form data, such
   as:

   [Rate] = Array
           (
               [rental_id] = 45
           )

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Saving related table data

2010-02-24 Thread Dmitry
I am in the process of acquainting myself with Cake and have come
across a question related to `koala kid`'s. Namely, to explore the
$hasOne relationship:

-- I baked two models, Parental and Dependent, where parental_id is a
foreign key in `dependents` that references `parentals`.`id`.
-- Apart from `id`s (one in Parental, two in Dependent), each model
has a `name` field. There are no other fields.

Here's the part I find strange:
-- When I set the Parental model to $hasOne = 'Dependent', I am still
able to use the standard baked controllers to add more than one
Dependent to a Parental.
   To be specific, assuming I've created a Parental with 'id'='1',
then I can use http://example/app/dependents/add repeatedly to add
many dependents with 'id' = 1. With the pre-baked controller and view,
I am asked to enter the parental_id manually in an input box, and
every time I set the id to 1 it makes a new dependent record,
_despite_ the $has*One* association. Which is strange to me, because I
supply the parental_id explicitly, and it adds it nonetheless. I
understand that the pre-baked controller uses Model-create() for the
add action, but still... In a $hasOne situation, shouldn't create() or
the subsequent save() logically throw some sort of error or boolean
false if there already exists a dependent with the same parental_id?


That said, the $hasOne behavior is even more unintuitive (from this
newbie perspective) when the situation in the underlying model tables
is more accurately reflect by $hasMany, for example as a result of the
process above. Assuming you set the association to $hasOne, but
actually haveMany in the associated table, you get results like
this:

[1] = Array
(
[Parental] = Array
(
[id] = 2
[name] = foster_parent
)
[Dependent] = Array
(
[id] = 8
[parental_id] = 2
[name] = test.a
)
)

[2] = Array
(
[Parental] = Array
(
[id] = 2
[name] = foster_parent
)
[Dependent] = Array
(
[id] = 9
[parental_id] = 2
[name] = test.b
)
)

This seems to be the result of some combinatoric/iterative process
that binds the parent to it's multiple dependents one at a time, each
time in a new array, and produces all possible combinations. Setting
the association to $hasMany, of course, returns the proper, as-
documented form of the $hasMany model output you'd expect:

[1] = Array
(
[Parental] = Array
(
[id] = 2
[name] = foster_parent
)
[Dependent] = Array
(
[0] = Array
(
[id] = 8
[parental_id] = 2
[name] = test.a
)
[1] = Array
(
[id] = 9
[parental_id] = 2
[name] = test.b
)
)
)

It's so strange to me that (a) the model lets you even add multiple
dependents to one parent in $hasOne mode, and then (b) then
combinatorially returns all possible associations with its all of its
dependents as shown above. I understand this allows the controller
which expects one result to get that one result (some result, who
knows which), and if programmed a certain way, not fault in the
process, but that just seems a bit odd to me.


I am ever mindful of my newness to Cake, and any insights are
appreciated!


Thanks,
Dmitry

P.S. I may have submitted an early version of this by clicking Send
accidentally. Apologies if I did.



On Feb 12, 11:04 am, koala kid alexhob...@gmail.com wrote:
 Hi John,

 thanks for your fix, its now working. I had assumed that as I was
 defining the relationship as ahasOneand belongsTo Cake would
 automatically know to Update rather than Insert as it was a 1 - 1
 relationship, using the Rental.id.

 This is where I am really struggling with Cake, so much is taken care
 for you that you don't know where it stops, and the documentation,
 although much improved, still makes it hard on occasion to find out.

 Anyway thanks again.

 On Feb 11, 3:02 am, John Andersen j.andersen...@gmail.com wrote:



  Your problem lies in this part:

      [Rate] = Array
          (
              [s1_title] = title 1
              [s1_day] = day 1
              [s1_week] =
              [s1_month] =
              [extra_info] =
          )

  I assume that this information was at first retrieved from the
  database and presented to the user. The user then changed something
  and saved

Re: Vendor [aurigma image uploader] not displaying

2009-11-17 Thread Dmitry
Please, post support case regarding this issue: 
http://aurigma.com/MyAurigma/CreateCase.aspx

On Nov 16, 8:48 pm, Octavian octaviansus...@gmail.com wrote:
 Anyone? Or does my code seem OK?

--

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: russian characters in MySQL table

2008-05-19 Thread Dmitry

Sorry, Piotr, it is not. UTF8 (without -) does not solve the
problem.

3lancer.eu:
 Hi,
 Should be rather 'encoding' = 'utf8'.
 Does this solve the problem?

 All the best,
 Piotr

--~--~-~--~~~---~--~~
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: russian characters in MySQL table

2008-05-19 Thread Dmitry

Sorry,  Piotr, it is not. Both utf8 and utf-8 have no effect

On 18 май, 03:26, 3lancer.eu [EMAIL PROTECTED] wrote:
 Hi,

 Should be rather 'encoding' = 'utf8'.
 Does this solve the problem?

 All the best,
 Piotr

--~--~-~--~~~---~--~~
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: russian characters in MySQL table

2008-05-18 Thread Dmitry

I think, yes. I hame more than 1 database on my local MySQL server and
some of them are utf-8 too. There are no such thingth with them, all
of them displayed Ok everywhere - in PHPMyAdmin and client app. For
example, I have some deal with Joomla! - it's PHP+MySQL -based CMS.
For it everything work fine. That's why I decided that the matter is
Cake.

[EMAIL PROTECTED]:
 are you sure its not a problem with phpmyadmin/mysql cli ?
 --
 Marcin Domanski
 http://kabturek.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
-~--~~~~--~~--~--~---



russian characters in MySQL table

2008-05-17 Thread Dmitry

I cannot find the solution for my trouble: MySQL incorrect stores
russian characters. I use utf-8 enconing in CakePHP app, MySQL
database also is utf-8. When I view my data thru my app in browser,
it's Ok, but when I look into the database directly (using PHPMyAdmin,
MySQL qurey browser, etc.), russian values are displayed as unreadable
symbols. What should I do? My database.php contains encoding' =
'utf-8'  entry. :(

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