Re: HABTM with additional data scaffold update problem.

2009-08-28 Thread Defranco

Hi Fabio,

I've tried your link, but it is invalid.

Could you please try to posting it again?

thanks

On 28 ago, 08:51, fabiox <3bi...@gmail.com> wrote:
> Hi DeFranco, i'm a CakePHP newbie and i'm handling on a quite similar topic
> for
> which i've opened a specific thread 
> here:http://groups.google.it/group/cake-php/browse_thread/thread/405946857...
> Could you maybe have a quick look on it a give me some little suggestion ?
>
> thanks a lot in advance
>
> fabio
>
>
>
>
>
> Defranco wrote:
>
> > Hi,
>
> > My join table additional data get lost when I update any of the 2
> > models that has HABTM relation:
>
> > I have 2 models that has HABTM relation and the join table between
> > these has additional data.
>
> > The problem is that when I edit and update any record on first model,
> > it will delete and insert join table records and I loose my additional
> > data on join table.
>
> > How I solve it? I alread tried the HABTM 'with' tag and changed the
> > 'unique' tag too, but no success.
>
> > Kind regards,
>
> > Franco
>
> --
> View this message in 
> context:http://n2.nabble.com/HABTM-with-additional-data-scaffold-update-probl...
> Sent from the CakePHP mailing list archive at Nabble.com.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HABTM with additional data scaffold update problem.

2009-07-21 Thread Defranco

Here follows my dirty solution I've created:


app_controller.php:
function _beforeScaffold($method) {
$this->_HABTM_scaffold_preserve($method);
return parent::_beforeScaffold($method);
}

function _HABTM_scaffold_preserve($method){
$model = $this->uses['0'];
if ($method == 'edit' && !empty($this->data ) &&  $model && 
!empty
($this->{$model}->hasAndBelongsToMany)){
foreach ($this->{$model}->hasAndBelongsToMany as 
$HABTM_model =>
$dummy){
if 
(isset($this->{$model}->hasAndBelongsToMany[$HABTM_model]
['with']) && $this->{$model}->hasAndBelongsToMany[$HABTM_model]
['with']){
$model_id_text = 
$this->{$model}->hasAndBelongsToMany
[$HABTM_model]['foreignKey'];
$habtm_id_text = 
$this->{$model}->hasAndBelongsToMany
[$HABTM_model]['associationForeignKey'];
$with_model = 
$this->{$model}->hasAndBelongsToMany[$HABTM_model]
['with'];
if 
(!empty($this->data[$HABTM_model][$HABTM_model])){

$this->log("app_controller.php/_HABTM_scaffold_preserve:
Preserving $model => $with_model", LOG_DEBUG);
$model_id = 
$this->data[$model]['id'];
foreach 
($this->data[$HABTM_model][$HABTM_model] as $k =>
$habtm_id){
$data = 
$this->{$model}->{$with_model}->find(   'first',

array(  'conditions' => 
array($model_id_text=>
$model_id,


  $habtm_id_text=> $habtm_id


),

'contain'   => 
array()

));
if ($data && 
isset($data[$with_model][$habtm_id_text]))

$this->data[$HABTM_model][$HABTM_model][$k] = $data
[$with_model];
}//foreach
}//if
}//if
}//foreach
}//if
}//_HABTM_scaffold_preserve
--~--~-~--~~~---~--~~
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: HABTM with additional data scaffold update problem.

2009-07-18 Thread Defranco

no ideas? :(
--~--~-~--~~~---~--~~
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: HABTM with additional data scaffold update problem.

2009-07-17 Thread Defranco

More details about the tables:


columns
--
id
name


columns_panels
--
id
column_id
panel_id
width <-- This is the additional join table data, that get lost
when I edit any columns fields.


panels
--
id
name


The problem is that when I update column using scaffold (edit), as
soon I save the edit any previous 'width' associated data on
columns_panels get lost (set to null) :(

Any ideas on how to edit column scaffold data without loosing 'width'
field data?

kind regards
--~--~-~--~~~---~--~~
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: HABTM with additional data scaffold update problem.

2009-07-16 Thread Defranco

no ideas?
--~--~-~--~~~---~--~~
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 with additional data scaffold update problem.

2009-07-15 Thread Defranco

Hi,

My join table additional data get lost when I update any of the 2
models that has HABTM relation:

I have 2 models that has HABTM relation and the join table between
these has additional data.

The problem is that when I edit and update any record on first model,
it will delete and insert join table records and I loose my additional
data on join table.

How I solve it? I alread tried the HABTM 'with' tag and changed the
'unique' tag too, but no success.

Kind regards,

Franco
--~--~-~--~~~---~--~~
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: Console not reporting E_NOTICE?

2008-12-03 Thread Defranco

On Nov 20, 11:33 am, "Renan Gonçalves" <[EMAIL PROTECTED]> wrote:
> Defranco,
>
> Should report if you are in development mode (debug more than 0).
> That is what that condition does.
>
> So, just increase the debug level and the E_NOTICE's will be showed.
>
> Regards,

Olá Renan,

Thanks for the reply,

As I told, I've tried debug=3 and it is still not reporting any
E_NOTICE in console test suites.

any idea?

regards

Erico Franco
SP/Brazil
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Fixtures not working on last nightly builds?

2008-12-03 Thread Defranco

Hi,

I've tried several different nightly build versions (November/2008
versions) after RC3 and were unable to run test suites for my
project.

Looks like fixtures are not working properly and several tests drops
due missing table issues.

Have you experienced these problems with fixtures for the last month
nightly build? It looks pretty stable except in this issue.

Any idea in how to get a test suite working version beyond RC3?

Kind regards
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to get code coverage analysis working?

2008-11-25 Thread Defranco

On Nov 19, 10:12 pm, mark_story <[EMAIL PROTECTED]> wrote:
> To resurrect this threadcodecoveragewas broken for me on my new
> computer.  But by changing line 115 of /cake/tests/lib/
> code_coverage_manager.php to
>
> xdebug_start_code_coverage(XDEBUG_CC_UNUSED);
>
> it started to work!  Hope it solves someone else's issues too

is working here too!

Thank you Mark!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Console not reporting E_NOTICE?

2008-11-19 Thread Defranco

Hi,

I'm running console for test suites & custom shells and just noticed
that it will not report any E_NOTICE (like for example 'undefined
index') in console output or log files even debug is set to 3.

Shouldn't console report E_NOTICE? at least while running test suite?

I've changed /cake/libs/configure.php, commenting out error_reporting
(0)  in order to make it output E_NOTICE:

/cake/libs/configure.php (Line  271):

if (isset($config['debug'])) {
if ($_this->debug) {
error_reporting(E_ALL);

if (function_exists('ini_set')) {
ini_set('display_errors', 1);
}

if (!class_exists('Debugger')) {
require LIBS . 'debugger.php';
}
if (!class_exists('CakeLog')) {
require LIBS . 'cake_log.php';
}
Configure::write('log', LOG_NOTICE);
} else {
// removed by defranco: error_reporting(0);
Configure::write('log', LOG_NOTICE);
}
}


Now it is outputting E_NOTICE on console.

But is there any cleaner solution for this?

Should I report it as a bug?

Kind Regards

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



controller fixturize drops table in end, how to test data?

2008-10-22 Thread Defranco

Hi,

Regarding controller testing using Test Suite on 1.2.RC3:

How do I test resulting data after I run testAction and
fixturize=true? The problem is that all all tables are dropped after
testAction routine.

For example if I run a simple testAction:

$this->testAction(  "/mycontroller/index",
array(  'fixturize' => true));


fixturize=true will make it to create all tables before running
index(), but it will drop all tables after testAction... how do I test
resulting data if the tables are all dropped?

Is possible to make testAction to fixturize data but do not drop it so
I can test resulting data saved on tables?

kind regards


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: how to debug console execution?

2008-10-09 Thread Defranco

no one?
--~--~-~--~~~---~--~~
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: more problems with RC3 and tests

2008-10-07 Thread Defranco

Same problem here.

The problem is that not only the documentation is suggesting this test
case layout, but also bake when generating test case files (I think).

rgds
--~--~-~--~~~---~--~~
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: fixture var $import not working on 1.2.RC3 anymore.

2008-10-06 Thread Defranco

On Oct 6, 5:38 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> I had that. Thought the problem was all me. I am still a bit fuzzy on
> a lot of the testing stuff.
> Try this:
> var $import = array('model' => 'Foo', 'connection' => 'default');
>
> I noticed that one of the examples in the Cookbook had a 'connection'
> property set. I have had to add this to each of my fixtures to make
> them work again.
>
> /Martin

Hi Martin,

It worked!

Thanks for your help!

kind regards


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



fixture var $import not working on 1.2.RC3 anymore.

2008-10-06 Thread Defranco

Hi,

I just downloaded 1.2.RC3 and noticed that $import is not working on
RC3 as it was on RC2:

Foo_fixture.php:

 'Foo', 'records' => false);

}
?>

It should import the existing table foos from model Foo, but it is not
working on RC3 and was working on RC2.

I get an error:

Missing database table 'foos' for model 'Foo'

When I try to run a basic foo.test.php for model foo.php (both created
by bake and not modified).

Anyone there getting the same problem on RC3?

Any ideas?

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



how to debug console execution?

2008-09-09 Thread Defranco

Hi,

Is possible to debug console shell execution using xDebug or Zend
Debugger?

I managed to debug any standard cake execution except console commands
due looks like my eclipse IDE only allow debug using browser not by
using CLI - but I'm not sure.

kind regards

Erico


--~--~-~--~~~---~--~~
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: assertEqual() Memory Leak?

2008-09-09 Thread Defranco

On Sep 3, 6:06 pm, mark_story <[EMAIL PROTECTED]> wrote:
> Erico,
>
> I will look into this tonight, and get it fixed.  I'm not sure why the
> buffering is there, perhaps someone else on the team knows why it is
> there.  But as far as I can see there is no need for it to be there.

Thank you!!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



assertEqual() Memory Leak?

2008-09-02 Thread Defranco

Hi,

I just noticed that assertEqual() function (test suite) in cakephp 1.2
RC2 is consuming some memory inside test cases.

I noticed that 300 assertEqual() executions, gets about 20 MB of PHP
free mem usage.

It sounds a Memory Leak isn't it?

I'm using cakephp 1.2.0.7296 RC2, and debug set to 1

kind regards

defranco
--~--~-~--~~~---~--~~
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: Test Suite 1.2: Importing joining table problem on HABTM fixture.

2008-04-27 Thread Defranco

no ideas?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Test Suite 1.2: Importing joining table problem on HABTM fixture.

2008-04-24 Thread Defranco

Hi,

I'm trying to import a Joining table on a fixture:

  var $import = array('model' => 'Model1Model2', 'records' => true);


But when importing the table to test_suite database it is creating a
table with  just 1 primary key instead of 2 primary keys as original
table has (model1_id or model2_id will be a primary key, never both)

This is obviously creating a set of problems, look like it is a bug.

Any ideas? I'm using 1.2.0.6311, I tried to use nightly version, but
is generating too many errors here, I would only try it here if I'm
sure that this is a bug and already solved there.

regards

Erico
--~--~-~--~~~---~--~~
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: Custom SQL call problem (Solved! => My mistake)

2008-04-18 Thread Defranco

Solved!

It was my mistake, not a bug: I had a user permission problem so it
returned null for [Create Procedure]

Thanks for your help Clark

/defranco
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Custom SQL call problem

2008-04-18 Thread Defranco

On 17 abr, 17:26, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> is it returning something that cake should be able to understand? try
> debugging out the data in your *sql_dbo file before it gets put into
> an array

Its a nice idea, but what is sql_dbo file? I tried to Google it but it
just pointed to this post.

thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Custom SQL call problem

2008-04-17 Thread Defranco

no ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Test Suite v1.2: $useDbConfig problem in model association.

2008-04-17 Thread Defranco

Should I report the fact that $model->setDataSource($dbConfig) do not
affect related models as a bug or as an enhancement?

Actually, if I set

$model->setDataSource('test_suite');

Related model like $model->Model2 will still have  $dbConfig='default'
not $dbConfig='test_suite' as the main model - what looks don't make
sense.

Maybe it should instantiate a new Model2 with $dbConfig='test_suite'
instead of keeping relations of models between databases.

Is it a bug or should report only as an enhancement?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: id = 0 or id ='0' not allowed in cakephp?

2008-04-15 Thread Defranco

Bug reported:

https://trac.cakephp.org/ticket/4488
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Test Suite using a console or shell script

2008-04-15 Thread Defranco

On Mar 31, 8:48 am, Defranco <[EMAIL PROTECTED]> wrote:
> On 27 mar, 16:16, Sliv <[EMAIL PROTECTED]> wrote:
>
> > I haven't tried this, but you may want to check it out:
>
> >http://lemoncake.wordpress.com/2007/06/24/cakephp-test-suite-shell/

looks like it do not works very well - apparently has a lot of bugs.

:-(

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: cake via console not logging php errors

2008-04-15 Thread Defranco

no ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: id = 0 or id ='0' not allowed in cakephp?

2008-04-15 Thread Defranco

On 14 abr, 19:24, Sam DeVore <[EMAIL PROTECTED]> wrote:
> My guess is that it is related to the fact that php is loosely typed
> and the ambiguity in something like '0'

It looks like that cakephp is checking if $model->id is false to check
if it has an id or not during save operation (if it do not has an id
set, it is a new db item)

The problem is that it has an id: '0' that is an string, so if you
check something like

if ($model->id){
  // It has an id
} else {
  // It don't has an id
}

it will do like it do not has an id and would assume that is a new
item, when it try to insert a new item, it will fail as id = '0'
already exists there.

So this probably is a cake php bug correct?

/Erico


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: id = 0 or id ='0' not allowed in cakephp?

2008-04-14 Thread Defranco

On 14 abr, 18:48, Stephen Orr <[EMAIL PROTECTED]> wrote:
> MySQL specifically disallows an ID of 0. I've tested this manually by
> inserting a test row with an ID of 0 into an auto_incremented column.
> It ignores it, and gives it an ID of 1 instead.

Ok,

I agree with you regarding numeric PKs.

But what about non numeric primary keys like I told?

>Cake will allow id = '00' and will allow id = '000' but will not allow update 
>on id = '0'

I know that most people here don't use non numeric keys and may not
agree with it use, but as I know cakephp supports non numeric primary
key, but do not support id='0' and MySQL does.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: id = 0 or id ='0' not allowed in cakephp?

2008-04-14 Thread Defranco

nobody?

/erico
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



id = 0 or id ='0' not allowed in cakephp?

2008-04-11 Thread Defranco

Hi,

I noticed that cakephp will not allow to update registers with primary
key with 0 or '0' :

for example:

$this->data->id = '0';  //   or ->id = 0
$this->save($this->data);

Will not work if a register with id=0 already exists due it will
understand it as id = false (new register) and will produce a
duplicated id MySQL error.

Why using a register with id = 0? : Maybe it will not make sense with
a numeric primary key (but MySQL allows it), but when thinking in a
non numeric primary key (like id = 'product-1234',), it makes sense:

cake will allow id = '00' and will allow id = '000' but will not allow
update on id = '0'

My question is: is this a cakephp bug?

I'm using cakephp 1.2.6311

thanks



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Limiting the number of results in HABTM association

2008-04-10 Thread Defranco

Hi all,

Is possible to limit the number of results in a habtm association
query?

I have a model1 that has a habtm with model2 - when i query $model1-
>find(),  an item of model1 has 50,000 model2 items and is crashing
php

Is possible to limit the number of items of model2 when I query for
model1 or use a paging-like solution for model2 when querying model1?

thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



cake via console not logging php errors

2008-04-10 Thread Defranco

Hi,

I'm running some routines on my applications via custom console
scripts (shell);

It is working fine, but when a php errors occurs, it is not generating
any kind of message (it do not prints the error on console screen nor
generate error on logs files like web interface does).

So I checked and figured out that php error_reporting is being set to
zero (it was E_ALL) on core configure.php (write function)

Is this a bug? any idea on how to avoid it being set to 0 there while
using console?

I'm using cake 1.2.6311

thanks

/Erico



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Custom SQL call problem

2008-04-09 Thread Defranco

Hi,

I'm attempting to read a stored procedure contents (its code) by
issuing the following sql command:

SHOW CREATE PROCEDURE my_stored_procedure

That would return a table like:

procedure  |   sql_mode  |  Create Procedure
---
my_stored_procedure  |  |  CREATE [EMAIL PROTECTED] PROCEDURE
`my_stored_procedure`() BEGIN /*My procedure*/ End

On 'Create Procedure' Column, I get the stored procedure content.

So I'm trying to get stored procedure contents inside cakephp 1.2.6311
using the $model->query(), but I'm getting a null value for 'Create
Procedure' column:

$result = $model->query('SHOW CREATE PROCEDURE my_stored_procedure');
print_r($result);

will result:

Array ( [0] =>
  Array ( [0] => Array (
  [Procedure] => my_stored_procedure
  [sql_mode] =>
  [Create Procedure] =>
) ) )

Why it is returning a null value for [Create Procedure]?

it should return the stored procedure code

Any ideas?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Test Suite using a console or shell script

2008-03-31 Thread Defranco

On 27 mar, 16:16, Sliv <[EMAIL PROTECTED]> wrote:
> I haven't tried this, but you may want to check it out:
>
> http://lemoncake.wordpress.com/2007/06/24/cakephp-test-suite-shell/

Hi Sliv,

Thank you very much,

This is exactly what I'm looking for - I'll give a try and provide a
feedback here,

kind Regards

Erico
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Test Suite using a console or shell script

2008-03-27 Thread Defranco

Is there a standard way to run Test Suite 1.2 cases using a script
(like console) or the only way is via web interface?

I'm running it trying to run unix commands like:

php webroot/test.php | lynx -stdin -dump

but I want to know if there is a better way to do it.

thanks

Erico


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Test suite 1.2: Is there a report for the Core Test Cases fails?

2008-03-27 Thread Defranco

Hi all,

I'm running test suite 1.2 and I'm getting some core test cases fails
on 1.2 beta.

Is there a standard test report for the core test cases that core
people got while released cake 1.2 beta so I could compare fails
results to check if cake is working fine on my system.

regards

Erico
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Non Numeric index issues.

2008-03-27 Thread Defranco

No ideas?

Also I found this bug on Trac that I think that is related with my
issue:

https://trac.cakephp.org/ticket/4224

/Erico
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Non Numeric index issues.

2008-03-26 Thread Defranco

Hi all,

I'm having multiple problems using non numeric index with Mysql and
CakePHP 1.2, specifically when it reaches a index that is a pure
number -- AFAIK, cakephp supports non numeric index.

Example: I have this table using a non numeric index:

id* (varchar) |  foo (varchar)

xpto  | null
9abc | null
9 | null

It works perfectly while making operations for the items with
id='xpto' and id='9abc', but it will not work while dealing with the
id='9' item due cakephp will use 9 instead of '9' in Mysql queries
that will take item id='9abc' too.

Here are the problems that I'm facing:

1) If I try to count the elements with id='9' it will tell me 2
instead of 1:
$id = '9';
$conditions = array('id' => $id);
$count = $this->NonNumericIndexTest->find('count',
array('conditions' => $conditions));
//it will produce a $count = 2 instead of 1  due it will consider
id='9abc'  item too.

2) if I try to update item with id='9', it will update id='9abc' data
too
$id = '9';
$fields = array('foo'=>"'this should be for id=9 only'");
$conditions = array('id' => $id);
$this->NonNumericIndexTest->updateAll($fields, $conditions);
//it will update id='9abc' data too.


3) It will not allow to update id='9' data using save() due exists a
id='9abc':
$data = array();
$data['NonNumericIndex'] = array ('id' => '9',
'foo' => "'This will never be 
saved due already exists a id=9abc
and id=9'");
$result = $this->NonNumericIndexTest->save($data, false);
// This will produce a $result=false and no data will be updated

4) If I try to delete id='9' item, id='9abc' will be gone too.
  $this->NonNumericIndexTest->delete('9');
// items id='9' and id='9abc' are gone.

There is workarounds for item (1) for example using literal conditions
like: "`id` =  '$id'"  but I don't know how to make item (3) work.

I tested it on cake 1.2 beta (6311) and svn (6609) but for both
versions  all 4 cases  failed.

Am I doing something very wrong or this is really a bug? I prepared
some test cases and I'm thinking in issue a bug on trac for this.

...please so not suggest to use numerical index - this is not an
option for me right now.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: turn off certain associations for a model

2008-02-06 Thread Defranco

Hi Dardo,

Very interesting this article.

Thanks for the reply.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: sql view table vs controller logic

2008-02-05 Thread Defranco

Hi

thank you for the clarification and for the nice tips!

regards

Erico


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



turn off certain associations for a model

2008-02-05 Thread Defranco

Hi,

What is the best method on turning off temporally associations for a
model on determined operations?

I have a model that has too many associations and this is causing
performance issues.

If I could turn off certain associations for this model for specific
finds cases that some association is not needed - it would be great.

What is the best method to do that? using bindmodel() before find
operation? or there is a more cleaner way to solve this?

regards

Erico


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



sql view table vs controller logic

2008-02-04 Thread Defranco

Hi all,

Is acceptable to use a sql view table (a virtual sql table based on
predefined permanent queries) instead a using a controller logic for a
specific case?

I have a complex query between several tables and looks like that
would be too hard to do it using models relations and controller logic
and looks easy to just create  a sql view and attach it a model like
it is a table.

is just for one specific  case - is this a dirty solution? Should I
try to do it using model relations plus controller logic instead? Is
there a disadvantage of doing this?

thanks

/Erico

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Is possible to return variables from a element?

2007-11-01 Thread Defranco

On Nov 1, 6:33 pm, dardosordi <[EMAIL PROTECTED]> wrote:
> I think you can do this in the element:
>
>  'vars')); ?>
>
> and this in the view:
>
> 
> $vars = unserialize($this->renderElement(stuff...));
>
> export($vars)
>
> echo $many ;
>
> ?>

Hi dardosordi,

This is exactly what I'm looking for!

thanks for your help

/defranco


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Is possible to return variables from a element?

2007-10-31 Thread Defranco

Hi,

Besides the standard html returned from a element while using
renderElement - is possible to return variables from a view like when
you pass an argument as reference to a function?

I'm rendering a element and it is returning an html (string) but I
would like to get a collection of variables from it instead of just a
string that it normally returns -- is it possible?  -- is there some
workaround that I can use to return a collection of variables (array
for example) from a single render element?

thanks

DeFranco


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Accessing controller function from routes.php

2007-04-30 Thread Defranco

On Apr 25, 10:09 pm, Defranco <[EMAIL PROTECTED]> wrote:

> include("../../cake/libs/model/model.php");
> include("../../cake/app_model.php");
> include("../models/MyModel.php"); //my model php file

Latter I discovered that these includes on routes.php was a bad idea
as the redeclaration of model.php caused an error white I tried to use
requestAction on a total different controller:

"Fatal error: Cannot redeclare class Model in ...\cake\libs\model
\model_php5.php on line 1662:

any idea to avoid this? I think that I need to change the cake's files
to avoid redeclarations issues;

/defranco


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Pagination default order for each column

2007-04-30 Thread Defranco

no ideas?

defranco


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Accessing controller function from routes.php

2007-04-25 Thread Defranco

On Apr 25, 6:01 am, AD7six <[EMAIL PROTECTED]> wrote:
>just the model.

This was the tip that I was looking for.

I also needed to add in routes.php the following includes to
instantiate my model

include("../../cake/libs/model/model.php");
include("../../cake/app_model.php");
include("../models/MyModel.php"); //my model php file

thank you

/defranco


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Accessing controller function from routes.php

2007-04-25 Thread Defranco

no answers? its so difficulty like that?

/defranco


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Pagination default order for each column

2007-04-24 Thread Defranco

Hi,

I'm using Pagination to display a table with several columns.

My question is if is possible to setup a default order (DESC or ASC)
independently for each column, to be used on the first time that any
column header is clicked.

For example:

If I have the following table:

Rank  |   Price  |Points
  1  |   $5  |   9.5
  2  |   $8  |   9.7
  3  |   $3  |   9.2
  4  |   $1  |   8.3
  5  |   $10|   8.5

If I click the "Price" column header for first time, I would like that
table would be sorted by Price *Ascending* order ($1, $3, $5 ...)

But If I click the "Points" column for the first time, I would like
that the table would be sorted by Points *Descending* order (9.7, 9.5,
9,2 ...) that makes more sense (no need to click it twice)

Is it possible in configure it in Pagination?

Sorry if it is a basic question - I'm new in Pagination.

regards

Defranco


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Accessing controller function from routes.php

2007-04-20 Thread Defranco

Hi,

Is possible to call a specific controller function from Routes.php to
retrieve data?

I want to do this due I would like to retrieve Database data to use on
route configuration. How would I do this?

regards

/defranco


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---