Re: How to set Cake 3.0 to save with different date format ?

2015-05-11 Thread Joe T.
Here's a pastebin <http://pastebin.com/E65nFXKx> (paid for it, might as 
well use it).

It occurred to me there was something i hadn't tried. i've been using an 
accessor function in the Entity to format the field to m/d/Y for screen. 
Without it, i get the time (12:00 AM), and the date digits don't have 
leading 0's. So the accessor was helping solve that. i commented that 
function and the setter works. The date goes into the SQL statement the way 
it's expected to (also without the extra format() call, just a Time object).

i've also tried commenting the setter, but end up with the original POST 
string in my UPDATE statement. So i need the setter. 

But i feel i need a getter to format it the way i want for output. i've 
been using getters to provide the individual formats i need, which feels 
like function pollution. i guess i could just use the setter to make a Time 
object & when i access the field, call ->format() on it with the format i 
need...

Suggestions for a more clever/elegant approach?

Thanks for the help.
-joe


On Monday, 11 May 2015 03:42:42 UTC-4, José Lorenzo wrote:
>
> This line means that you are storing in the entity an string, why do you 
> that? Also, how are you saving the data, can you use gist to show all your 
> code?
>
> return $this->_properties['ready_date']->format('Y-m-d');
>
> On Monday, May 11, 2015 at 7:18:50 AM UTC+2, Joe T. wrote:
>>
>> i found this topic here and on Stack Overflow: 
>> https://stackoverflow.com/questions/29336852/how-to-format-date-fields-before-save-in-cakephp-3
>> The hash on the linked Doc page is no longer valid.
>>
>> Like the original post, i don't want to use the default select-based date 
>> inputs. i'm formatting my date in US format for output ('m/d/Y') and using 
>> the 'mdy' Validator. i've also written a mutator in the Entity to convert 
>> the date string to a Time object:
>> protected function _setReadyDate($readyDate)
>> {
>> $this->_properties['ready_date'] = new Time($readyDate);
>> return $this->_properties['ready_date']->format('Y-m-d');
>> }
>>
>> i added the lines from the Stack answer to my bootstrap.php, but that 
>> didn't work either:
>> I18n::locale('en-US');
>> Type::build('datetime')->useLocaleParser();
>>
>> No matter what i do, the MySql UPDATE uses the 'm/d/Y' string instead of 
>> the date object:
>> UPDATE listings SET ready_date = '06/01/2015' , modified = '2015-05-11 
>> 05:00:54' WHERE id = 20
>>
>> What do i try next?
>>
>> Thanks,
>> joe t.
>>
>>
>>
>>
>>
>>
>> On Thursday, 2 April 2015 14:56:29 UTC-4, José Lorenzo wrote:
>>>
>>> Read this:
>>>
>>>
>>> http://book.cakephp.org/3.0/en/orm/database-basics.html#parsing-localized-datetime-data
>>>
>>> On Thursday, April 2, 2015 at 6:10:58 PM UTC+2, Celso wrote:
>>>>
>>>> Hi guys I have a table in Mysql with a date field,  and I need to allow 
>>>> my user writes something like *31/12/2015*.
>>>>
>>>>
>>>> echo $this->Form->input('data_nascimento', ['type' => 'text', 
>>>> 'maxlength'=> '10']);
>>>>
>>>> I've tried 
>>>> Time::$defaultLocale = 'pt-BR';
>>>>
>>>> in *AppController* but the problem persists... and 
>>>> 'timezone' => 'BRT'
>>>> in *app.php* does not works
>>>>
>>>> If I update the value directly in MySQL and use the 
>>>> Time::setToStringFormat('dd/MM/'); 
>>>> in AppController the date is showed in a nice format however my real 
>>>> problem is how to save() because I don't know how change the locale of 
>>>> Cake 
>>>> 3.0.
>>>>
>>>>
>>>>

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


Re: How to set Cake 3.0 to save with different date format ?

2015-05-10 Thread Joe T.
i found this topic here and on Stack Overflow: 
https://stackoverflow.com/questions/29336852/how-to-format-date-fields-before-save-in-cakephp-3
The hash on the linked Doc page is no longer valid.

Like the original post, i don't want to use the default select-based date 
inputs. i'm formatting my date in US format for output ('m/d/Y') and using 
the 'mdy' Validator. i've also written a mutator in the Entity to convert 
the date string to a Time object:
protected function _setReadyDate($readyDate)
{
$this->_properties['ready_date'] = new Time($readyDate);
return $this->_properties['ready_date']->format('Y-m-d');
}

i added the lines from the Stack answer to my bootstrap.php, but that 
didn't work either:
I18n::locale('en-US');
Type::build('datetime')->useLocaleParser();

No matter what i do, the MySql UPDATE uses the 'm/d/Y' string instead of 
the date object:
UPDATE listings SET ready_date = '06/01/2015' , modified = '2015-05-11 
05:00:54' WHERE id = 20

What do i try next?

Thanks,
joe t.






On Thursday, 2 April 2015 14:56:29 UTC-4, José Lorenzo wrote:
>
> Read this:
>
>
> http://book.cakephp.org/3.0/en/orm/database-basics.html#parsing-localized-datetime-data
>
> On Thursday, April 2, 2015 at 6:10:58 PM UTC+2, Celso wrote:
>>
>> Hi guys I have a table in Mysql with a date field,  and I need to allow 
>> my user writes something like *31/12/2015*.
>>
>>
>> echo $this->Form->input('data_nascimento', ['type' => 'text', 'maxlength'
>> => '10']);
>>
>> I've tried 
>> Time::$defaultLocale = 'pt-BR';
>>
>> in *AppController* but the problem persists... and 
>> 'timezone' => 'BRT'
>> in *app.php* does not works
>>
>> If I update the value directly in MySQL and use the 
>> Time::setToStringFormat('dd/MM/'); 
>> in AppController the date is showed in a nice format however my real 
>> problem is how to save() because I don't know how change the locale of Cake 
>> 3.0.
>>
>>
>>

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


Cake 3: Map Entity mutators/virtuals with a database type

2015-04-25 Thread Joe T.
i'd like to use the database type of an Entity's field as a HTML class to 
provide CSS formatting for the cell. 

i know i can do this in the Controller via 

*$this->SomeTable->schema()->columnType('some_column');*
which leads to




*foreach ($this->SomeTable->schema()->columns() as $column) {
$columnTypeMap[$column] = 
$this->SomeTable->schema()->columnType($column);}// etc.*
i can then use this mapping to set the cell class with the value (see first 
4 cells in screenshot).
i'd also like to do this for some mutators & virtual properties. However, 
since the mutators aren't columns directly from a table, there appears to 
be no way to do it for them. For instance:

<https://lh3.googleusercontent.com/-sh-MN75GNaY/VTyDk872bgI/4oo/RbvgsQGRYv0/s1600/2015-04-26_0201.png>

The last 3 columns above don't provide database types.

Is there any clean/clever/elegant way to do this? i realize some virtuals 
probably can't realistically do this (such as concatenating several fields 
together), but two of those are "date-ish", and based on actual DATE-type 
columns.

Any ideas? Perhaps alternatives to this approach?

Thanks.

-joe t.

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


Re: 3.x: SessionHelper deprecated, what's the new version of this?

2015-04-23 Thread Joe Theuerkauf
Thanks guys. Looks like that did the trick. Guess i expected it to be more
complicated, since before it mixed Session & Flash.

On Wed, 22 Apr 2015 at 00:34 Anthony GRASSIOT 
wrote:

> http://book.cakephp.org/3.0/en/views/helpers/flash.html
> Le 22 avr. 2015 06:17, "Andras Kende"  a écrit :
>
>> Try:
>> Flash->render(); ?>
>>
>> https://github.com/cakephp/app/blob/master/src/Template/Layout/default.ctp#L49
>>
>> Andras Kende
>>
>>
>> On Apr 21, 2015, at 8:56 PM, Joe T.  wrote:
>>
>> Looks like SessionHelper is/will be deprecated for 3.1 and
>> request->session() is recommended... i have this chunk of code found in
>> my Layout/default.ctp:
>>
>> 
>> Session->flash(); ?>
>>
>> fetch('content'); ?>
>> 
>>
>> i tried $this->request->session()->flash() but get a fatal error:
>>
>> *Error: * Call to undefined method Cake\Network\Session::flash()
>>
>> Okay, so not that. i'm sure this code came from early development phases,
>> but it never caused a problem until now (admittedly, i've been away from
>> this project for several weeks).
>>
>> What's the new equivalent to that line?
>>
>> 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/d/optout.
>>
>>
>>  --
>> 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.
>>
>  --
> 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 a topic in the
> Google Groups "CakePHP" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/cake-php/w9fqchhcO7U/unsubscribe.
> To unsubscribe from this group and all its topics, 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.
>

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


3.x: SessionHelper deprecated, what's the new version of this?

2015-04-21 Thread Joe T.
Looks like SessionHelper is/will be deprecated for 3.1 and 
request->session() is recommended... i have this chunk of code found in my 
Layout/default.ctp:


Session->flash(); ?>

fetch('content'); ?>


i tried $this->request->session()->flash() but get a fatal error:

*Error: * Call to undefined method Cake\Network\Session::flash()

Okay, so not that. i'm sure this code came from early development phases, 
but it never caused a problem until now (admittedly, i've been away from 
this project for several weeks).

What's the new equivalent to that line?

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/d/optout.


Re: Still having trouble with saving BelongsToMany data

2015-03-21 Thread Joe T.
José, Kevin,

Breakthrough at last!
https://github.com/cakephp/cakephp/issues/6100

Fixed validation & other minor discrepancies in Table/Entity classes that 
may not have even affected things much, but didn't get any better results.

Finally i had nothing left, so tried resetting indexes on the associated 
data - it was the only difference left i could see:
$this->request->data['attributes'] = array_values($this->request->data[
'attributes']);

Before doing this, patchEntity() was losing the _joinData. After adding 
that reset, it works!

Mark is going to research it further, but for now at least i have a 
relatively low-impact workaround.

Thanks for all your help.

On Friday, 13 March 2015 13:13:30 UTC-4, heavyKevy wrote:
>
> I believe that is your answer you were looking for... 
> I missed it too. 
>
> Thanks Jose for pointing that one out.

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


Re: Still having trouble with saving BelongsToMany data

2015-03-13 Thread Joe T.
UPDATE

i worked with my form inputs and the Controller a bit, and i DO have 
functioning saves working again (for the next ten minutes until it breaks 
again). i'll describe what i had to do, and why i don't like it.

Form inputs:
Basically, i have to scrap the idea of the ORM carrying data to the pivot 
table. i have my main inputs all named according to their Listings column. 
For the data that will go to ListingsAttributes, i prefix the input with 
'attributes.column':




In the Controller:
$listing = $this->Listings->newEntity();
if ($this->request->is('post')) {
// Grab the 'attributes' data - arrays of attribute_id / value pairs
$attributeData = $this->request->data['attributes'];
// Can't leave the 'attributes' in the request data for the entity 
patch, Listings save fails.
unset($this->request->data['attributes']);
// NOTE: NO 'association' key. Just a single save action.
$listing = $this->Listings->patchEntity($listing, $this->request->data);
// Save the link records one-by-one
foreach ($attributeData as $attrData) {
$attribute = $this->Listings->Attributes->get($attrData[
'attribute_id']);
$attribute->_joinData = new Entity(['value' => $attrData['value']]);
$this->Listings->Attributes->link($listing, [$attribute]);
}
}

Of course there's the redirect after everything succeeds & so on.

Why this is awful:

   1. Absolutely NOT what's documented for this approach OR for the 
   supposedly easier ['associated' => ['Attributes._joinData']] i was 
   struggling with.
   2. Cramming inputs into the form only to extract them to a separate data 
   set, unset them from the original, then loop through them for individual 
   save actions. This is not what i envisioned ORM sweetness to be.
   3. Non-transactional - at any point, a save can fail and i get PART of 
   the data, and can't roll back to make the user try the entire transaction 
   over again. Instead, i'd have to have cleanup code in my *add* action to 
   sweep up behind a failed save.
   4. i suppose i *could* do it in a manually-set transaction, but that 
   goes right back to defeating the purpose of the ORM.

Since there was someone on IRC also experiencing the same struggle i'm 
having, i'll hang out there a while to see if markstory comes back around 
to address it. It just baffles me that this particular data scenario does 
NOT work.

He even seemed to concede that the task we are trying to accomplish isn't 
directly accounted for in the test cases. One of the tests is for a 
Create/Update on both sides of the association, which i think is clear by 
now i'm NOT trying to do. The other test case he showed us retrieves an 
existing Entity and does an Update with a Create/Update on the other end 
and _joinData in between. When we explained we want to save only on ONE 
side & the pivot, and leave the other end untouched, he agreed the tests 
don't specifically account for that. So if i can catch him online, 
hopefully we can sort out whether it's something i'm still doing wrong, or 
the ORM, the Marshaler, or whatever.

Thanks again for the help. i'll follow up if i learn anything more.


On Friday, 13 March 2015 13:13:30 UTC-4, heavyKevy wrote:
>
> I believe that is your answer you were looking for... 
> I missed it too. 
>
> Thanks Jose for pointing that one out.

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


Re: Still having trouble with saving BelongsToMany data

2015-03-13 Thread Joe T.
i tinkered with ->link() a bit last night, but must have set up something 
wrong, as it tried to insert more than 1 link record for the same Listing 
ID / Attribute ID pair, violating the unique key.

There was a guy on #cakephp IRC last night having the exact same problem 
i'm having, and markstory happened to come online & we discussed it with 
him. He *seems* to be getting what we're after. He showed us the existing 
test cases, but none match exactly what i'm trying to accomplish. 
Everything is tuned to assume there's an update on *both* ends of the 
association and the pivot, where i only want to update one end, and the 
pivot table.

So, i'll monkey around with ->link() some more tonight & see if there's any 
more progress discussing it with Mark.

i'll follow up with any progress. :)

Thanks!
-joe

On Friday, 13 March 2015 13:13:30 UTC-4, heavyKevy wrote:
>
> I believe that is your answer you were looking for... 
> I missed it too. 
>
> Thanks Jose for pointing that one out.

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


Re: Still having trouble with saving BelongsToMany data

2015-03-12 Thread Joe T.
Thank you José, i'll try that tonight as well.


On Thursday, 12 March 2015 12:12:05 UTC-4, José Lorenzo wrote:
>
> If you want to create first and then link follow the instructions in this 
> section:
>
>
> http://book.cakephp.org/3.0/en/orm/saving-data.html#saving-belongstomany-associations
>
> Specifically where it shows the calls to `Users->link($article, [$user])`
>
> On Thursday, March 12, 2015 at 3:09:54 PM UTC+1, Joe T. wrote:
>>
>> Somehow, i'm totally unsurprised. >_<
>>
>> i'll take a look at the sample you uploaded tonight. You're right, 
>> without some UI controls, all the Attributes would require values for the 
>> Submit to save successfully. i have Javascript toggling the [disabled] 
>> property on the *_joinData.value* and hidden *attribute* inputs. That 
>> way, unless the user specifically checks the Attribute to enable it, its 
>> inputs won't POST.
>>
>> i've compared my files to what i did when (i *swear*) it was working, 
>> and don't see any functional changes, but maybe i need to back up a step in 
>> my own code. This has been really frustrating because i *know* other 
>> people are doing this successfully, so it's hard to understand what's so 
>> radically different about me.
>>
>>  DIGRESSION 
>> i'm still hoping for some explanation from the developers why this is 
>> necessary. i've only managed to get this working at all by adding 
>> unnecessary hidden inputs to my interface & adding Javascript to handle 
>> whether they're enabled for the Submit. All i *want* to do is grab an ID 
>> from the foreign table (Attributes), add a value for the joint table 
>> (ListingsAttributes), and save the Listings and ListingsAttributes records. 
>> There's no need to touch the Attributes table, but it fails unless i 
>> provide all that data.
>>
>> i can see how it's useful for some scenarios (Articles/Tags) where it's 
>> all data you'd typically create/change simultaneously. But even the 
>> Students/Courses example doesn't sit right in my mind. You don't generally 
>> create Courses at the same time you create Students. You create the links 
>> between them with the additional data (grade, attendance, etc.). But 
>> according to everything happening here, when you create a Student & want to 
>> link it to Courses, you have to provide ALL the data for every Course, else 
>> the save will fail.
>>
>>
>>
>> On Thursday, 12 March 2015 09:19:53 UTC-4, heavyKevy wrote:
>>>
>>> Joe, 
>>> I tried doing a composer update and test and it is not broken for me.
>>>
>>> https://www.dropbox.com/s/7tjqy3i5z9hnngc/src.zip?dl=0
>>>
>>> This is all of the source that I threw together to get it to work.
>>>
>>> The example is far from perfect in that I don't have all of the fields 
>>> that you have in my tables, just the bare necessities in order to test and 
>>> make it work.
>>> Also, all 4 of the listingsAttributes have to be filled in currently or 
>>> it does not save, so the validation needs a bit of work, but I verified 
>>> this this code does still work after updating.
>>>
>>> Could it be that yours still works if you specify a value for every 
>>> ListingsAttribute?
>>>
>>> Hope something here helps...
>>> --Kevin
>>>
>>

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


Re: Still having trouble with saving BelongsToMany data

2015-03-12 Thread Joe T.
Somehow, i'm totally unsurprised. >_<

i'll take a look at the sample you uploaded tonight. You're right, without 
some UI controls, all the Attributes would require values for the Submit to 
save successfully. i have Javascript toggling the [disabled] property on 
the *_joinData.value* and hidden *attribute* inputs. That way, unless the 
user specifically checks the Attribute to enable it, its inputs won't POST.

i've compared my files to what i did when (i *swear*) it was working, and 
don't see any functional changes, but maybe i need to back up a step in my 
own code. This has been really frustrating because i *know* other people 
are doing this successfully, so it's hard to understand what's so radically 
different about me.

 DIGRESSION 
i'm still hoping for some explanation from the developers why this is 
necessary. i've only managed to get this working at all by adding 
unnecessary hidden inputs to my interface & adding Javascript to handle 
whether they're enabled for the Submit. All i *want* to do is grab an ID 
from the foreign table (Attributes), add a value for the joint table 
(ListingsAttributes), and save the Listings and ListingsAttributes records. 
There's no need to touch the Attributes table, but it fails unless i 
provide all that data.

i can see how it's useful for some scenarios (Articles/Tags) where it's all 
data you'd typically create/change simultaneously. But even the 
Students/Courses example doesn't sit right in my mind. You don't generally 
create Courses at the same time you create Students. You create the links 
between them with the additional data (grade, attendance, etc.). But 
according to everything happening here, when you create a Student & want to 
link it to Courses, you have to provide ALL the data for every Course, else 
the save will fail.



On Thursday, 12 March 2015 09:19:53 UTC-4, heavyKevy wrote:
>
> Joe, 
> I tried doing a composer update and test and it is not broken for me.
>
> https://www.dropbox.com/s/7tjqy3i5z9hnngc/src.zip?dl=0
>
> This is all of the source that I threw together to get it to work.
>
> The example is far from perfect in that I don't have all of the fields 
> that you have in my tables, just the bare necessities in order to test and 
> make it work.
> Also, all 4 of the listingsAttributes have to be filled in currently or it 
> does not save, so the validation needs a bit of work, but I verified this 
> this code does still work after updating.
>
> Could it be that yours still works if you specify a value for every 
> ListingsAttribute?
>
> Hope something here helps...
> --Kevin
>

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


Re: Still having trouble with saving BelongsToMany data

2015-03-12 Thread Joe T.
Unfortunately no, i don't know what hash i was on before i updated. It 
would be one of the untagged RC2 commits within the last couple weeks i was 
trying to get this to work.

i'm willing to backtrack, though, to try to find out. Suggestions how i 
would do that?

Looking at the PR list on Github & comparing that with the timeline of this 
thread, i'd say it's *likely* something within the last 4-5 PRs:
March 2: https://github.com/cakephp/cakephp/pull/5991 
March 6: https://github.com/cakephp/cakephp/pull/6021
March 8: https://github.com/cakephp/cakephp/pull/6030
March 10: https://github.com/cakephp/cakephp/pull/5905

The most recent PR was March 11 fixing a link in a comment. Not a likely 
candidate. ;)

If you want me to try going backward prior to any of those, let me know how.
-joe

On Thursday, 12 March 2015 04:29:17 UTC-4, José Lorenzo wrote:
>
> No, it is not related to that issue. Do you have any idea of what cake 
> version you were using before updating?
>
> On Thursday, March 12, 2015 at 4:37:50 AM UTC+1, Joe T. wrote:
>>
>> i absolutely cannot believe this: it's broken again. i haven't done 
>> anything but run *composer update* and i'm back to losing the 
>> [_joinData][value] from request data when i patch the entity, so the joint 
>> table record inserts NULL. It DOES insert, but the _joinData is GONE from 
>> the entity.
>>
>> Is there any chance it's related to this issue? 
>> https://github.com/cakephp/cakephp/issues/6050
>>
>> Now what?
>>
>>
>> On Sunday, 8 March 2015 00:40:49 UTC-5, Joe T. wrote:
>>>
>>> Kevin,
>>>
>>> i'm so grateful for all your effort & ideas. i don't fully grasp 
>>> conditional validation yet, though i suspect i will have to address that 
>>> sooner or later. When i re-baked the models, 
>>> ->requirePresence('field_name', 
>>> 'create') is already set by default in *AttributesTable*, so that got 
>>> me nowhere.
>>>
>>> i also tried making a one-stop association like so:
>>> >> ="1">
>>>  
>>>
>>> Then in the Controller:
>>> $listing = $this->Listings->patchEntity($listing, $this->request->data, 
>>> ['associated' => ['ListingsAttributes']]);
>>>
>>> It didn't produce any entity errors, but it didn't save the 
>>> ListingsAttributes record, either. The data never makes it to the entity.
>>>
>>> What i ultimately had to do (though it feels *really* dirty) was your 
>>> initial suggestion: add all the *attribute* fields as hidden inputs. 
>>> However, that added another problem: ALL the attributes were being 
>>> submitted because the hidden fields were enabled for POSTing. So i had to 
>>> tweak the Javascript that presents a text input for the join data (value) 
>>> to also toggle the [*disabled*] property of all the hidden inputs for a 
>>> given Attribute check box.
>>>
>>> i'm *FINALLY* getting data in the ListingsAttributes table. i'm not a 
>>> fan of doing it this way, but i'll have to live with it for now.
>>>
>>> i really think there should be an option to tell the ORM to stop the 
>>> save at the join table, rather than always trying to update the linked 
>>> record in the associated table. If there is a way to do this with the ORM's 
>>> save options, it doesn't appear to be documented. Obviously, i followed the 
>>> documentation to the letter, but my assumption of its behavior was wrong.
>>>
>>> Thanks again!
>>> -joe
>>>
>>>
>>> On Saturday, 7 March 2015 13:21:56 UTC-5, heavyKevy wrote:
>>>>
>>>> I thought of one more option... 
>>>>
>>>> You can specify a separate validation specifically for adding the 
>>>> listing attributes such that the usual validation continues to be used and 
>>>> work as it was and the new validation works only for this instance.   The 
>>>> documentation has all of the information on how to do this should you 
>>>> decide to choose this option...
>>>
>>>

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


Re: Still having trouble with saving BelongsToMany data

2015-03-11 Thread Joe T.
i absolutely cannot believe this: it's broken again. i haven't done 
anything but run *composer update* and i'm back to losing the 
[_joinData][value] from request data when i patch the entity, so the joint 
table record inserts NULL. It DOES insert, but the _joinData is GONE from 
the entity.

Is there any chance it's related to this issue? 
https://github.com/cakephp/cakephp/issues/6050

Now what?


On Sunday, 8 March 2015 00:40:49 UTC-5, Joe T. wrote:
>
> Kevin,
>
> i'm so grateful for all your effort & ideas. i don't fully grasp 
> conditional validation yet, though i suspect i will have to address that 
> sooner or later. When i re-baked the models, ->requirePresence('field_name', 
> 'create') is already set by default in *AttributesTable*, so that got me 
> nowhere.
>
> i also tried making a one-stop association like so:
>  "1">
>  
>
> Then in the Controller:
> $listing = $this->Listings->patchEntity($listing, $this->request->data, [
> 'associated' => ['ListingsAttributes']]);
>
> It didn't produce any entity errors, but it didn't save the 
> ListingsAttributes record, either. The data never makes it to the entity.
>
> What i ultimately had to do (though it feels *really* dirty) was your 
> initial suggestion: add all the *attribute* fields as hidden inputs. 
> However, that added another problem: ALL the attributes were being 
> submitted because the hidden fields were enabled for POSTing. So i had to 
> tweak the Javascript that presents a text input for the join data (value) 
> to also toggle the [*disabled*] property of all the hidden inputs for a 
> given Attribute check box.
>
> i'm *FINALLY* getting data in the ListingsAttributes table. i'm not a fan 
> of doing it this way, but i'll have to live with it for now.
>
> i really think there should be an option to tell the ORM to stop the save 
> at the join table, rather than always trying to update the linked record in 
> the associated table. If there is a way to do this with the ORM's save 
> options, it doesn't appear to be documented. Obviously, i followed the 
> documentation to the letter, but my assumption of its behavior was wrong.
>
> Thanks again!
> -joe
>
>
> On Saturday, 7 March 2015 13:21:56 UTC-5, heavyKevy wrote:
>>
>> I thought of one more option... 
>>
>> You can specify a separate validation specifically for adding the listing 
>> attributes such that the usual validation continues to be used and work as 
>> it was and the new validation works only for this instance.   The 
>> documentation has all of the information on how to do this should you 
>> decide to choose this option...
>
>

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


Re: Still having trouble with saving BelongsToMany data

2015-03-07 Thread Joe T.
Kevin,

i'm so grateful for all your effort & ideas. i don't fully grasp 
conditional validation yet, though i suspect i will have to address that 
sooner or later. When i re-baked the models, ->requirePresence('field_name', 
'create') is already set by default in *AttributesTable*, so that got me 
nowhere.

i also tried making a one-stop association like so:

 

Then in the Controller:
$listing = $this->Listings->patchEntity($listing, $this->request->data, [
'associated' => ['ListingsAttributes']]);

It didn't produce any entity errors, but it didn't save the 
ListingsAttributes record, either. The data never makes it to the entity.

What i ultimately had to do (though it feels *really* dirty) was your 
initial suggestion: add all the *attribute* fields as hidden inputs. 
However, that added another problem: ALL the attributes were being 
submitted because the hidden fields were enabled for POSTing. So i had to 
tweak the Javascript that presents a text input for the join data (value) 
to also toggle the [*disabled*] property of all the hidden inputs for a 
given Attribute check box.

i'm *FINALLY* getting data in the ListingsAttributes table. i'm not a fan 
of doing it this way, but i'll have to live with it for now.

i really think there should be an option to tell the ORM to stop the save 
at the join table, rather than always trying to update the linked record in 
the associated table. If there is a way to do this with the ORM's save 
options, it doesn't appear to be documented. Obviously, i followed the 
documentation to the letter, but my assumption of its behavior was wrong.

Thanks again!
-joe


On Saturday, 7 March 2015 13:21:56 UTC-5, heavyKevy wrote:
>
> I thought of one more option... 
>
> You can specify a separate validation specifically for adding the listing 
> attributes such that the usual validation continues to be used and work as 
> it was and the new validation works only for this instance.   The 
> documentation has all of the information on how to do this should you 
> decide to choose this option...

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


Re: Still having trouble with saving BelongsToMany data

2015-03-06 Thread Joe T.
Kevin,
i'm still not sure that's a good idea. When an admin goes to update an 
Attribute, validation would allow them to leave required fields empty. The 
database would object, since those fields are set NOT NULL. i'm not sure how 
that objection is handled if i didn't prevent it with the validation...

If i'm forced to assume a save that uses the belongsToMany structure & 
associated entity option will ALWAYS send a save to the associated table and 
the joint table between them, then i'd rather not use that approach. Is there a 
way i can structure my form & generate the entity so i only send data to 
Listings & ListingsAttributes? Or am i forced to use the saved ID from Listings 
& do a separate replace/save to ListingsAttributes?

Thanks for the continued help.
-joe

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


Re: Still having trouble with saving BelongsToMany data

2015-03-05 Thread Joe T.
Kevin,
i can do that, but it doesn't make sense to me. i don't want my Listing to make 
any changes to the Attributes, so why is it attempting to do so? If i disable 
validation for updates, they won't be validated when the admin actually DOES 
edit an Attribute.

Maybe a full end-to-end association isn't what i want here?

If i want my data save to stop at ListingsAttributes, what would that look like 
in the form & Controller? Is it even possible? i made a couple half-hearted 
attempts at it, but didn't get anywhere.

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


Re: Still having trouble with saving BelongsToMany data

2015-03-04 Thread Joe T.
José:
i'll try to get on IRC tomorrow night, but i think i have a bit more 
information about the _joinData problem...

Here are my debug entries:

//Log::debug($this->request-data);
Array
(
[attributes] => Array
(
[3] => Array
(
[id] => 1
[_joinData] => Array
(
[value] => Off-street
)
)
)
//... Other valid, normal Listings data
)

We agree the POST data is correct, right? [id] is the Attribute record's 
ID, [_joinData] is for the joint table *listings_attributes*

Here's the patched Listing entity:
// $listing = $this->Listings->patchEntity($listing, $this->request->data, 
['associated' => ['Attributes._joinData']]);
// Log::debug($listing);
Array
(
[attributes] => Array
(
[0] => Array
(
[id] => 1
)
)
//... Other Listing entity data
)

As we saw in my previous posts, *_joinData* is GONE. i'm not doing anything 
special to any of my forms/data/etc., but somehow, it's just disappearing.

Now, here's what i get when i log the entity's errors:
//Log::debug($listing->errors());
Array
(
[attributes] => Array
(
[0] => Array
(
[name] => Array
(
[_required] => This field is required
)

[requires_value] => Array
(
[_required] => This field is required
)

[active] => Array
(
[_required] => This field is required
)
)
)
)

These are all Attributes columns being validated (and obviously *not found* 
because they're not part of the data i'm working with).

It's as though trying to save to the joint table ListingsAttributes also 
tries to save a new Attribute record.
*i don't want it to do that.* 

i only care about the Attribute ID in my data for the 
*ListingsAttributes.attribute_id*. i don't want to pass through & try to 
insert/update an Attribute record. The documentation examples (Articles <-> 
Tags) seem to assume that when you create a new Article, you also want to 
create/update Tags, and save the joint data while you're there. In my case, 
i'm not trying to save to Attributes, i want to *stop at the joint table*.

So, does that offer any insight to what's going on? 

Hope to hear from you, otherwise i'll see who's around IRC tomorrow.
Thank you.



On Tuesday, 3 March 2015 14:05:11 UTC-5, José Lorenzo wrote:
>
> Can you show a debug of the resulting entity after patchEntity. Also, if 
> you join the #cakephp IRC channel in freenode, I think we can help you 
> faster :)
>
> On Tuesday, March 3, 2015 at 6:01:25 PM UTC+1, Joe T. wrote:
>>
>> José
>> i appreciate your response. Please forgive my frustration, i'm *trying* 
>> to learn what i'm doing wrong (and i do still believe i'm doing something 
>> wrong, but can't figure out WHAT). Your comments make sense, and i was 
>> originally working under those assumptions. However, the original approach 
>> didn't work. i followed the documentation at
>>
>> http://book.cakephp.org/3.0/en/orm/saving-data.html#saving-additional-data-to-the-joint-table
>>
>> http://book.cakephp.org/3.0/en/views/helpers/form.html#associated-form-inputs
>> which are what gave me inputs and POST data matching exactly what the 
>> documentation describes. But when feeding the POST into patchEntity, the 
>> association data *disappears*.
>>
>> i re-baked my models and the Controller, dealing almost entirely with the 
>> automatic code (changing only what i needed for views/layouts - nothing 
>> affecting data). It didn't work. The furthest i could get with that was the 
>> Listing record, but the Listing entity never had the associated Attribute 
>> data. The first time anything DID save to ListingsAttributes was with 
>> Kevin's changes.
>>
>> The only discrepancy i see is the documentation calling
>> $this->Students->newEntity($data, // POST data
>> ['associated' => ['Courses._joinData']]);
>> while your comment below used
>> $this->Posts->patchEntity($post, $this->request->data, 
>>   ['Tags._joinData']);
>> Leaving aside the object differences, is that options array correct? 
>>
>> i *wa

Re: Still having trouble with saving BelongsToMany data

2015-03-04 Thread Joe T.
Kevin,
i definitely need to spend some time getting XDebug running through my 
router, but currently no, i don't have it. i've relied on Log::debug for 
info on what's happening. There are lots of things i'd like to do to 
streamline this process (Vagrant, for one) but my enthusiasm for this 
particular project has faded - which is only partially due to this specific 
obstacle. :-\

i thought i had gotten everything, but if you'd like to send me what you 
have, just so i can make sure i'm on the same page, i'd be grateful. 
Private-reply & i'll let you know what i missed. ;)

Thanks for the continued help.
-joe

On Wednesday, 4 March 2015 03:18:03 UTC-5, heavyKevy wrote:
>
> Joe, 
> did you make sure that you modified all of the files I mentioned? 
>
> As I mentioned, it works for me allowing me to add with the join data. 
> would it help if I zipped all of the files and emailed them or made them 
> available via dropbox? 
>
> By the way do you have a debugger that allows you to step thruogh your 
> code? 
> I find stepping thruogh code and checking variables a much easier way to 
> see what is going on in my code...

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


Re: Still having trouble with saving BelongsToMany data

2015-03-03 Thread Joe T.
Try not to laugh too hard: 20 years online & i've *never* used IRC. i won't 
be home until 8pm (12-1a GMT) or so tonight, but if anyone is around, i'd 
be grateful for the help.

Nearly everything i've posted in code blocks has been directly from the 
Cake Debugger Log. The most recent POST & Entity were:

// *Log::debug($this->request->data)* :
Array
(
[attributes] => Array
(
[3] => Array
(
[id] => 1
[_joinData] => Array

(
[value] => Off-street
)
)
)
// Other field/value pairs for the Listings table
)

The Listing Entity after *patchEntity*:

// *Log::debug($listing->jsonSerialize())* : 
Array
(
[attributes] => Array
(
[0] => Array
(
[id] => 1
)
)
// Other field/value pairs for the Listings table
)



On Tuesday, 3 March 2015 14:05:11 UTC-5, José Lorenzo wrote:
>
> Can you show a debug of the resulting entity after patchEntity. Also, if 
> you join the #cakephp IRC channel in freenode, I think we can help you 
> faster :)
>
> On Tuesday, March 3, 2015 at 6:01:25 PM UTC+1, Joe T. wrote:
>>
>> José
>> i appreciate your response. Please forgive my frustration, i'm *trying* 
>> to learn what i'm doing wrong (and i do still believe i'm doing something 
>> wrong, but can't figure out WHAT). Your comments make sense, and i was 
>> originally working under those assumptions. However, the original approach 
>> didn't work. i followed the documentation at
>>
>> http://book.cakephp.org/3.0/en/orm/saving-data.html#saving-additional-data-to-the-joint-table
>>
>> http://book.cakephp.org/3.0/en/views/helpers/form.html#associated-form-inputs
>> which are what gave me inputs and POST data matching exactly what the 
>> documentation describes. But when feeding the POST into patchEntity, the 
>> association data *disappears*.
>>
>> i re-baked my models and the Controller, dealing almost entirely with the 
>> automatic code (changing only what i needed for views/layouts - nothing 
>> affecting data). It didn't work. The furthest i could get with that was the 
>> Listing record, but the Listing entity never had the associated Attribute 
>> data. The first time anything DID save to ListingsAttributes was with 
>> Kevin's changes.
>>
>> The only discrepancy i see is the documentation calling
>> $this->Students->newEntity($data, // POST data
>> ['associated' => ['Courses._joinData']]);
>> while your comment below used
>> $this->Posts->patchEntity($post, $this->request->data, 
>>   ['Tags._joinData']);
>> Leaving aside the object differences, is that options array correct? 
>>
>> i *was* using newEntity to create it directly from POST, as the 
>> documentation does. The re-baked Controller switched it to patchEntity & 
>> Kevin's changes did the same, so i went that way.
>>
>> i've been calling
>> $this->Listings->patchEntity($listing, $this->request->data, 
>>  ['associated' => ['Attributes._joinData']]);
>>
>> i've tried to be very clear about what i was originally doing, and Kevin 
>> had the same problem: no associated record saved. He was very helpful, 
>> offering clear instructions for what he changed to get it to work, which is 
>> where i am now. All the points i listed are from changes *he* had to 
>> make to get the ListingsAttributes record to save. Only AFTER making the 
>> same changes am i now seeing the ListingsAttributes record saved, but the 
>> `value` from POST never makes it into the Listing Entity.
>>
>> i will try again tonight, but i'm at a loss for what i can do 
>> differently. Kevin's help is the only thing that has even *partially* 
>> worked so far, but you're telling me that's doing it wrong. So what's left?
>>
>> Thank you.
>>
>>
>> On Tuesday, 3 March 2015 10:13:53 UTC-5, José Lorenzo wrote:
>>>
>>>
>>>
>>> On Tuesday, March 3, 2015 at 2:43:55 PM UTC+1, Joe T. wrote:
>>>>
>>>>
>>>>1. Had to add *`id`* to the Attributes *$_accessible* field array 
>>>>(as described by heavyKevy in a post above). If making foreign table 
>>>> IDs 
>>>>available for a joint table is necessary, why isn't the bake process 

Re: Still having trouble with saving BelongsToMany data

2015-03-03 Thread Joe T.
José
i appreciate your response. Please forgive my frustration, i'm *trying* to 
learn what i'm doing wrong (and i do still believe i'm doing something 
wrong, but can't figure out WHAT). Your comments make sense, and i was 
originally working under those assumptions. However, the original approach 
didn't work. i followed the documentation at
http://book.cakephp.org/3.0/en/orm/saving-data.html#saving-additional-data-to-the-joint-table
http://book.cakephp.org/3.0/en/views/helpers/form.html#associated-form-inputs
which are what gave me inputs and POST data matching exactly what the 
documentation describes. But when feeding the POST into patchEntity, the 
association data *disappears*.

i re-baked my models and the Controller, dealing almost entirely with the 
automatic code (changing only what i needed for views/layouts - nothing 
affecting data). It didn't work. The furthest i could get with that was the 
Listing record, but the Listing entity never had the associated Attribute 
data. The first time anything DID save to ListingsAttributes was with 
Kevin's changes.

The only discrepancy i see is the documentation calling
$this->Students->newEntity($data, // POST data
['associated' => ['Courses._joinData']]);
while your comment below used
$this->Posts->patchEntity($post, $this->request->data, 
  ['Tags._joinData']);
Leaving aside the object differences, is that options array correct? 

i *was* using newEntity to create it directly from POST, as the 
documentation does. The re-baked Controller switched it to patchEntity & 
Kevin's changes did the same, so i went that way.

i've been calling
$this->Listings->patchEntity($listing, $this->request->data, 
 ['associated' => ['Attributes._joinData']]);

i've tried to be very clear about what i was originally doing, and Kevin 
had the same problem: no associated record saved. He was very helpful, 
offering clear instructions for what he changed to get it to work, which is 
where i am now. All the points i listed are from changes *he* had to make 
to get the ListingsAttributes record to save. Only AFTER making the same 
changes am i now seeing the ListingsAttributes record saved, but the `value` 
from POST never makes it into the Listing Entity.

i will try again tonight, but i'm at a loss for what i can do differently. 
Kevin's help is the only thing that has even *partially* worked so far, but 
you're telling me that's doing it wrong. So what's left?

Thank you.


On Tuesday, 3 March 2015 10:13:53 UTC-5, José Lorenzo wrote:
>
>
>
> On Tuesday, March 3, 2015 at 2:43:55 PM UTC+1, Joe T. wrote:
>>
>>
>>1. Had to add *`id`* to the Attributes *$_accessible* field array (as 
>>described by heavyKevy in a post above). If making foreign table IDs 
>>available for a joint table is necessary, why isn't the bake process 
>> doing 
>>that when it analyzes the foreign key structure?
>>
>> It is not needed, unless you want to do everything manual. The usual 
> workflow where making this column accessible is not needed is when you have 
> a code like the following
>
> $post = $this->Posts->get(1, ['associated' => ['Tags']]);
> $this->set(compact($post));
>
> The $post will contain its tags with their '_joinData' (including the id). 
> Having the id in the result is important when you render the form:
>
>
> $this->From->input('tags.0.id);
> $this->From->input('tags.0._joinData.another_column');
>
> Based on the id of the tag, the data that was modified will be matched 
> when you do the patch entity:
>
> $post = $this->Posts->patchEntity($post, $this->request->data, 
> ['Tags._joinData']);
>
> There are numerous tests and other apps doing this successfully, as the 
> other person that tried to help you showed.
>
>>
>>1. Manually setting join data dirty after the entity patch: 
>> *$listing->dirty('attributes._joinData', 
>>true);* - The documentation's examples for doing this are when you 
>>manually set entity data *outside* an entity-related call. 
>>*patchEntity* implies there will be dirty data, so it should handle 
>>it internally. Besides, when it comes to editing & i go to patch the 
>>existing entity with the POST data, maybe the _joinData is unaltered, and 
>>therefore manually setting it dirty is *incorrect*. i can't make 
>>assumptions with the POST data on what's dirty or not. That, to me, is 
>>exactly what *patchEntity* is for. However, i haven't even 

Re: Still having trouble with saving BelongsToMany data

2015-03-03 Thread Joe T.

   
   1. Had to add *`id`* to the Attributes *$_accessible* field array (as 
   described by heavyKevy in a post above). If making foreign table IDs 
   available for a joint table is necessary, why isn't the bake process doing 
   that when it analyzes the foreign key structure?
   2. Manually setting join data dirty after the entity patch: 
*$listing->dirty('attributes._joinData', 
   true);* - The documentation's examples for doing this are when you 
   manually set entity data *outside* an entity-related call. *patchEntity* 
   implies there will be dirty data, so it should handle it internally. 
   Besides, when it comes to editing & i go to patch the existing entity with 
   the POST data, maybe the _joinData is unaltered, and therefore manually 
   setting it dirty is *incorrect*. i can't make assumptions with the POST 
   data on what's dirty or not. That, to me, is exactly what *patchEntity* 
   is for. However, i haven't even managed to get the joint record to save 
   without *all* the modifications described in Kevin's previous post.
   3. In the *ListingsAttributesTable* validation, it doesn't seem correct 
   that *allowEmpty* for the two foreign IDs should be required to save the 
   data, but it doesn't seem to work otherwise. In fact, if either of those 
   IDs is empty for the joint table, validation should *fail*, but these 
   validations will permit it.


And none of that explains why, after following the documentation examples & 
Kevin's gracious effort to help me out, why the 
*`listings_attributes.value`* column still doesn't receive the 
*_joinData.value* POST data...


On Tuesday, 3 March 2015 03:11:03 UTC-5, José Lorenzo wrote:
>
> What did you have to do that was not in the documentation? It would be 
> helpful to add it to the docs so other don't get stuck as well in the same 
> problem
>
> On Tuesday, March 3, 2015 at 7:25:01 AM UTC+1, Joe T. wrote:
>>
>> i'm REALLY sorry for the delay getting back to you. And unfortunately, 
>> i'm still not there. It's CLOSE though:
>>
>> i did exactly as you suggested in your last post. Set up my Entities & 
>> Tables just as you described. Set up the controller to manually set the 
>> _joinData "dirty" and called the save.
>>
>> i get the ListingsAttributes record now! But no value from the text input 
>> (_joinData.value).
>>
>> The POST data is correct:
>>
>> Array
>> (
>> [attributes] => Array
>> (
>> [3] => Array
>> (
>> [id] => 1
>> [_joinData] => Array
>> (
>> [value] => Off-street
>> )
>> )
>> )
>> )
>>
>> That's exactly what i've been getting since i change to use _joinData...
>>
>> Here's the Entity after merging & setting _joinData dirty:
>>
>> Array
>> (
>> [attributes] => Array
>> (
>> [0] => Array
>> (
>> [id] => 1
>> )
>> )
>> )
>>
>> As before, the "value" input got lost. However, there is FINALLY an 
>> Attributes array in the Listing entity with the correct Attributes.id. The 
>> result is, i get a ListingsAttributes record with the Listings.id and 
>> Attributes.id, but nothing in the *value* column.
>>
>> This is making me crazy & i'm on the edge of scrapping this thing & 
>> starting over with something else. i never expected this much difficulty 
>> getting some basic data relationships to work after following documentation 
>> exactly (and then having to make *undocumented* changes that still only 
>> get me part-way there. i don't think i'm doing anything radical or 
>> unconventional with my form, so i don't understand the difficulty of making 
>> the ORM function as advertised.
>>
>> i'm frustrated, obviously. It's taken me this long to come back to follow 
>> up because it becomes harder & harder to come back & try again. i'm almost 
>> there, i just don't know why the *value* input won't go into the Entity 
>> data with everything else.
>>
>> If you're moving on, i totally understand. But if you'd like to look at 
>> the code directly, let me know. i'll have to put a version online without 
>> sensitive info in it...
>>
>> Thanks for at least getting me this far. :)
>> -joe
>>
>>
>>
&

Re: Still having trouble with saving BelongsToMany data

2015-03-02 Thread Joe T.
i'm REALLY sorry for the delay getting back to you. And unfortunately, i'm 
still not there. It's CLOSE though:

i did exactly as you suggested in your last post. Set up my Entities & 
Tables just as you described. Set up the controller to manually set the 
_joinData "dirty" and called the save.

i get the ListingsAttributes record now! But no value from the text input 
(_joinData.value).

The POST data is correct:

Array
(
[attributes] => Array
(
[3] => Array
(
[id] => 1
[_joinData] => Array
(
[value] => Off-street
)
)
)
)

That's exactly what i've been getting since i change to use _joinData...

Here's the Entity after merging & setting _joinData dirty:

Array
(
[attributes] => Array
(
[0] => Array
(
[id] => 1
)
)
)

As before, the "value" input got lost. However, there is FINALLY an 
Attributes array in the Listing entity with the correct Attributes.id. The 
result is, i get a ListingsAttributes record with the Listings.id and 
Attributes.id, but nothing in the *value* column.

This is making me crazy & i'm on the edge of scrapping this thing & 
starting over with something else. i never expected this much difficulty 
getting some basic data relationships to work after following documentation 
exactly (and then having to make *undocumented* changes that still only get 
me part-way there. i don't think i'm doing anything radical or 
unconventional with my form, so i don't understand the difficulty of making 
the ORM function as advertised.

i'm frustrated, obviously. It's taken me this long to come back to follow 
up because it becomes harder & harder to come back & try again. i'm almost 
there, i just don't know why the *value* input won't go into the Entity 
data with everything else.

If you're moving on, i totally understand. But if you'd like to look at the 
code directly, let me know. i'll have to put a version online without 
sensitive info in it...

Thanks for at least getting me this far. :)
-joe




On Wednesday, 25 February 2015 04:57:35 UTC-5, heavyKevy wrote:
>
> Joe,
>
> Here is what I did:
> In the attribute entity:
>protected $_accessible = [
> 'id' => true,
> 'name' => true,
> 'listings' => true,
> ];
>
> In the Listings_Attributes Table:
>public function validationDefault(Validator $validator)
> {
> $validator
> ->add('id', 'valid', ['rule' => 'numeric'])
> ->allowEmpty('id', 'create')
> ->add('listing_id', 'valid', ['rule' => 'numeric'])
> ->allowEmpty('listing_id', 'create')
> ->notEmpty('listing_id')
> ->add('attribute_id', 'valid', ['rule' => 'numeric'])
> ->allowEmpty('attribute_id', 'create')
> ->notEmpty('attribute_id')
> ->allowEmpty('value');
>
> return $validator;
> }
>
>
> In the Listings Controller:  Add method:
> public function add()
> {
> $listing = $this->Listings->newEntity();
> if ($this->request->is('post')) {
> $listing = $this->Listings->patchEntity($listing, 
> $this->request->data,['associated'=>['attributes._joinData']]);
> $listing->dirty('attributes._joinData',true);
> if ($this->Listings->save($listing)) {
> $this->Flash->success('The listing has been saved.');
> return $this->redirect(['action' => 'index']);
> } else {
> $this->Flash->error('The listing could not be saved. 
> Please, try again.');
> }
> }
> $attributes = $this->Listings->Attributes->find('list', ['limit' 
> => 200]);
> $this->set(compact('listing', 'attributes'));
> $this->set('_serialize', ['listing']);
> }
>
> In the Add template of the Listing: add.ctp
>  Form->create($listing); ?>
> 
> 
>  echo

Re: Still having trouble with saving BelongsToMany data

2015-02-24 Thread Joe T.
Okay, i've tried again, but i'm still not there. i think i need a little 
more detail / hand-holding...

LISTING
Entity:
protected $_accessible = [
// All table columns = true, except id (not listed)
// ...
'attributes' => true
];

Table:
public function initialize() {
// Calls to table, primaryKey, displayField, belongsTo for other 
tables...
$this->belongsToMany('Attributes', [
'foreignKey' => 'listing_id',
'targetForeignKey' => 'attribute_id',
'joinTable' => 'listings_attributes'
]);
// i thought all that could be handled automatically with 
// $this->belongsToMany('Attributes', ['through' => 
'ListingsAttributes']); ?
}

ATTRIBUTES 
Entity:
protected $_accessible = [
// All table columns = true, except id (not listed)
'listings' => true
];

Table:
public function initialize() {
// Calls to table, displayField, primaryKey
$this->belongsToMany('Listings', [
'foreignKey' => 'attribute_id',
'targetForeignKey' => 'listing_id',
'joinTable' => 'listings_attributes'
]);
// Again, i thought this could be done with
// $this->belongsToMany('Listings', ['through' => 
'ListingsAttributes']);
}

LISTINGS_ATTRIBUTES
Entity:
protected $_accessible = [
'listing_id'   => true,
'attribute_id' => true,
'value'=> true,
'listing'  => true,
'attribute'=> true,
];

Table:
public function initialize() {
// Calls to table, displayField, primaryKey
$this->belongsTo('Listings', ['foreignKey' => 'listing_id']);
$this->belongsTo('Attributes', ['foreignKey' => 'attribute_id']);
}

public function validationDefault(Validator $validator) {
$validator
->add('id', 'valid' ['rule' => 'numeric'])
->allowEmpty('id', 'create')
->add('listing_id', 'valid', ['rule' => 'numeric'])
->requirePresence('listing_id', 'create')
->notEmpty('listing_id')
->add('attribute_id', 'valid', ['rule' => 'numeric'])
->requirePresence('attribute_id', 'create')
->notEmpty('attribute_id')
->allowEmpty('value');
}

public function buildRules(RulesChecker $rules) {
$rules->add($rules->existsIn(['listing_id'], 'Listings');
$rules->add($rules->existsIn(['attribute_id'], 'Attributes');
return $rules;
}

Finally, ListingsController:
// Simplified add():
public function add() {
$listing = $this->Listings->newEntity();
if ($this->request->is('post')) {
$listing = $this->Listings->patchEntity($listing, $this->request->
data);

if ($this->Listings->save($listing)) {
// Flash->success & return redirect to index
} else {
// Flash->error
}
}

// various association data lookups for form data
// stuff like $attributes = 
$this->Listings->findListByActive(true)->order('name');
// using magic finders

$this->set(compact(/* all the variables from the finders */));
}

Note that nowhere in the baked code is the *['associated' => 
['Attributes._joinData']]* option used as it is in the documentation. i 
HAVE tried it in either *newEntity* or *patchEntity* calls, and both 
together. No luck.

~whew~

The result of all this: the Listings record saves. But i'd already gotten 
that far before. Still no ListingsAttributes records.

   1. Your last post mentions removing validation for the two foreign key 
   columns in ListingsAttribute... So that means removing the *add*/
   *requirePresence*/*notEmpty *calls for them?
   2. i left my HTML/Form alone (see original post for what that looks 
   like), because i think there's a bug specifying a connection for cake bake 
   template... If the current documentation is accurate, that Form build 
   should work, correct?
   3. i'm not sure what you meant by allowing id for attributes... i'm not 
   trying to create new attributes in this form, just write the joint table 
   records... Please clarify?
   
i hope i'm almost there... i will be SO happy when i can finally move 
forward with this project again...
Thanks.
-joe


On Tuesday, 24 February 2015 02:09:55 UTC-5, heavyKevy wrote:
>
> Joe,

Re: Still having trouble with saving BelongsToMany data

2015-02-23 Thread Joe T.
i took a look at the issues tonight myself and saw the same. i'll run the 
update & re-bakes tomorrow to test it out.

Thanks for all your help.
-joe


On Tuesday, 24 February 2015 02:09:55 UTC-5, heavyKevy wrote:
>
> Joe,
> Looking more carefully, I see that the tickets are recently closed.
>
> I did a composer update --prefer-dist,
>
> rebaked the listingsAttributes controller and templates,
> removed the validation for attribute_id and listing_id from the 
> listings_Attributes table and it is saving the listings and the listing 
> attributes correctly.
>
> Note: don't forget to allow the id for the attributes or it will recreate 
> the attributes every time.
>
> --Kevin
>

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


Re: Still having trouble with saving BelongsToMany data

2015-02-23 Thread Joe T.
Thanks again! i'll try to move forward by kludging around this with a 
separate Entity for ListingsAttributes & see if that manages to work.
-joe


On Monday, 23 February 2015 15:11:05 UTC-5, heavyKevy wrote:
>
> You are welcome...
>
> By the way, others have already submitted bug reports for this issue, so I 
> decided to hold off on submitting a duplicate.
>
> --Kevin
>

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


Re: Still having trouble with saving BelongsToMany data

2015-02-23 Thread Joe T.
i agree. If you'd like to do the "honor", i think you have a clearer grasp 
of what's happening in the background. i just know it's not happening as 
advertised.

As for getting the primary Listings record to save, i'll follow up when i 
get home with the configuration that gets that far, but nothing i've done 
gets the ListingsAttributes record to work.

Thank you so much for checking into this with me.
-joe


On Monday, 23 February 2015 13:55:16 UTC-5, heavyKevy wrote:
>
> Saving works fine with using the _ids, but as soon as I add join data to 
> the mix, it refuses to save with validation errors.
>
> Also, if I include the entire Attribute entity, and remove the validation 
> of attribute_id and listing_id from listings_attributes, I can get the 
> attributes to save, but the _joinData still does not save.  It is obviously 
> not working as advertised.
>
> Also, I looked for test cases in the test code and found none.  
>
> It appears that it is time to write it up as a bug...
>

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


Re: Still having trouble with saving BelongsToMany data

2015-02-22 Thread Joe T.
Also, just to clarify, i'm not adding new Attributes in the Listing form. 
i'm displaying them, and when the user checks them, a text input is shown 
for those that require it. The only data i need to save apart from the 
Listing is in ListingsAttributes:
attribute_id : 1 (Attribute's checkbox value),
listing_id   : 1 (new id generated by Listings save),
value: 'Off-street' (string from the checked Attribute's text input)

But it sounds like you're hitting the same issue i am: the Listing record 
saves, but nothing is fed to ListingsAttributes despite the established 
associations.

Thanks for at least investigating it further. i just wish i knew what to do 
about it.
-joe


On Sunday, 22 February 2015 17:39:52 UTC-5, heavyKevy wrote:
>
> I took the time to construct a test project with the 3 join tables and was 
> able to get data that looks like the documentation requires, but it refuses 
> to save.
> The joint marshaller chokes because no listing_id, and no attribute_id is 
> found when marshalling the _joinData.
>
> I don't see in the documentation what else needs to be included to ensure 
> that the attributes are saved.
>
>

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


Re: Still having trouble with saving BelongsToMany data

2015-02-22 Thread Joe T.
Thanks for responding.

So i might NOT be crazy???

The 3 you identified as the ID isn't - it's the array index for that 
listing field. See the inputs again. "Parking" is index 3, its record ID is 
1. i wouldn't want to insert 3 as the *listings_attributes.attribute_id*.

i re-baked the Tables, Entity, and Controller classes as you suggested. 
While there were some minor discrepancies i merged into the originals, it 
doesn't seem the re-bakes are working either.

The chief difference in the controller:
Original: 
// i've also tried a few variants of this, where either *nothing* gets 
saved, or *only* the Listing record.
$listing = $this->Listings->newEntity($this->request->data, ['associated' => 
['Attributes._joinData']]);
Re-baked: 
$listing = $this->Listings->newEntity();
$listing = $this->Listings->patchEntity($listing, $this->request->data);

Just as you reported, i can manage to save the Listings record under some 
variations, but never the ListingsAttributes record(s). i can't see 
anything in the documentation i'm skipping, either. Also as you mentioned, 
when i patch the Listing entity (or create it directly from request data), 
the association (attributes) data from request disappears.

i was actually surprised by the docs update, which is why i came back to 
revisit this issue. Even with the updated documentation, i haven't managed 
to make the joint table data save. i suppose i'll have to force it in by 
creating a separate entity, but i don't think that's how the Cake magic is 
supposed to work...

Thanks for following up, and (at least tentatively) confirming i'm not 
insane with this issue. ;-)
-joe



On Sunday, 22 February 2015 17:39:52 UTC-5, heavyKevy wrote:
>
> I took the time to construct a test project with the 3 join tables and was 
> able to get data that looks like the documentation requires, but it refuses 
> to save.
> The joint marshaller chokes because no listing_id, and no attribute_id is 
> found when marshalling the _joinData.
>
> I don't see in the documentation what else needs to be included to ensure 
> that the attributes are saved.
>
>

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


Still having trouble with saving BelongsToMany data

2015-02-21 Thread Joe T.
So, i had a thread going here: 
https://groups.google.com/forum/#!topic/cake-php/PMtHkEvIURo

Never got anywhere on solving this. Decided a new thread was called for 
because tables have changed & documentation has been updated, but i'm 
having the same problem.

i'll try to explain as clearly as i can...

i have two B2M tables: *li**stings* and *attributes*. The pivot table is 
*listings_attributes*:
listings_attributes:
id
listing_id   -FK-> listings.id
attribute_id -FK-> attributes.id
value

The Table connections look like this:
*ListingsTable::initialize*
$this->addAssociations([
'belongsTo' => [ /* some other tables */ ],
'hasMany'   => [ /* another table */ ],

'belongsToMany' => [
'Attributes' => [
'through' => 'ListingsAttributes'
]
]
]);


*AttributesTable::initialize*
$this->belongsToMany('Listings', [
'through' => 'ListingsAttributes'
]);


*ListingsAttributesTable::initialize*
$this->belongsTo('Listings');
$this->belongsTo('Attributes');


The Attributes are already established. i'm not adding new Attributes when 
i save a Listing. The documentation's example is Articles & Tags, and 
implies new Tags are created with a new Article, while the _joinData 
"starred" is saved to the pivot table *articles_tags*.

So my form inputs look like this (following the example from documentation 
<http://book.cakephp.org/3.0/en/views/helpers/form.html#associated-form-inputs>
):
 Bathrooms


 Bedrooms


 Laundry


 Parking



The idea is, an Attribute is checked, and a value entered that goes to the 
*listings_attributes* table. In my test, i'm checking "Parking" (ID 1, 
index 3), and entering "Off-street" as its value.

My response data looks like (from Log::debug):
Array
(
// Various fields about the listing, and this section for the 
attributes:
[attributes] => Array
(
[3] => Array // Index for this Attribute in the form's inputs.
(
[id] => 1 // Attribute record ID for "Parking"
[_joinData] => Array // Data intended for the 
ListingsAttributes table
(
[value] => Off-street
)
)
)
)

To me, this looks much like the documentation example for Students / 
Courses:
$data = [
'first_name' => 'Sally',
'last_name' => 'Parker',
'courses' => [
[
'id' => 10,
'_joinData' => [
'grade' => 80.12,
'days_attended' => 30
]
],
// Other courses.
]
];
$student = $this->Students->newEntity($data, [
'associated' => ['Courses._joinData']
]);

In my controller, i create the Entity thus (just like the example above):
$listing = $this->Listings->newEntity($this->request->data, ['associated' => 
['Attributes._joinData']]);

When i call *$this->Listings->save($listing)* i'd expect the *listings* 
record to be saved, then the ID for that added to the associated data for 
*listings_attributes*:
listings_id  : 1(newly generated)
attributes_id: 1(selected from the form)
value: 'Off-street' (set in the form)

When i log *$listing->jsonSerialize()*, it looks like this:
Array
(
// Various fields about the listing, and this section for the 
attributes:
[attributes] => Array
(
[0] => Array
(
)
)
)

The result of this is the *listings* record is not saved, nor the 
*listings_attributes*. 

So, where did the Attribute data go? Is something wrong with the Table 
classes? Can anyone tell me what's wrong here? If you need more 
information, please let me know.

Thank you.
-joe

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


Re: 3.0 - Cakephp plugins gone from /plugins

2015-01-31 Thread Joe T.
SOLVED:
Somewhere along the line, Congfigure::load() was changed to OMIT the ".php" 
file extension from config files. So Configure::load('app.php') is no 
longer correct, instead requiring Configure::load('app')

i'm not sure when that change was made, why Configure thinks i'm trying to 
load a Plugin when i use the ".php" extension, or how i got along until now 
with the old way working, but the site is finally loading again.

-joe

PS: Looking through Core/Configure, i noticed my IDE detected an undefined 
$config variable in Configure::version()...


On Wednesday, 28 January 2015 04:10:46 UTC-5, José Lorenzo wrote:
>
> The plugins that are installed by composer are not (correctly) put inside 
> vendor. Your own baked plugins can stay in ./plugins
>
> The error you are having seems to be that you are trying to load a plugin 
> called app somewhere. Try looking at the stacktrace of the error. Install 
> the php xdebug extension, that should help.
>
> On Wednesday, January 28, 2015 at 3:14:02 AM UTC+1, Joe T. wrote:
>>
>> i recently did a *composer update* for my dev site, and all the Cake 
>> plugins that were under /plugins were removed:
>>
>> /plugins
>> - /Bake   (gone)
>> - /DebugKit   (gone)
>> - /Migrations (gone)
>>
>> However, there are new(?) directories under /vendor/cakephp corresponding 
>> to the same plugins:
>>
>> /vendor/cakephp
>> - /bake
>> - /debug_kit
>> - /migrations
>>
>> i've tried deleting everything in /plugins & /vendor and the 
>> composer.lock file, then running *composer install* to get a fresh copy 
>> of everything, with no luck. i added the line to "scripts" as mentioned in 
>> the RC1 release notes and prescribed by the composer update message when i 
>> ran without it... If i'm missing some step with composer, i wouldn't be 
>> surprised, but i have no idea what it might be.
>>
>> My composer.json requires & such:
>>   "require": {
>> "php": ">=5.4.19",
>> "cakephp/cakephp": "3.0.*-dev",
>> "cakephp/plugin-installer": "dev-master",
>> "zurb/foundation": "dev-master",
>> "jockmac22/foundation_calendar_date_time_picker": "*",
>> "ckeditor/ckeditor": "dev-standard/latest",
>> "tecnick.com/tcpdf": "dev-master",
>> "openwall/phpass": "*"
>>   },
>>   "require-dev": {
>> "cakephp/bake": "dev-master",
>> "cakephp/debug_kit": "3.0.*-dev",
>> "cakephp/migrations": "dev-master",
>> "d11wtq/boris": "1.0.*"
>>   },
>>   "autoload": {
>> "psr-4": {
>>   "App\\": "App",
>>   "App\\Test\\": "Test",
>>   "": "./plugins",
>>   "Thook\\": "./plugins/Thook/src",
>>   "Thook\\Cakerov\\": "./plugins/Thook/Cakerov/src",
>>   "Thook\\Websites\\": "./plugins/Thook/Websites/src",
>>   "Thook\\Test\\": "./plugins/Thook/tests"
>> }
>>   },
>>   "autoload-dev": {
>> "psr-4": {
>>   "Thook\\Cakerov\\Test\\": "./Plugin/Thook/Cakerov/tests",
>>   "Thook\\Websites\\Test\\": "./Plugin/Thook/Websites/tests"
>> }
>>   },
>>   "scripts": {
>> "post-install-cmd": "App\\Console\\Installer::postInstall",
>> "post-autoload-dump": 
>> "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump"
>>   },
>>
>>
>> Yeah, yeah, i know, silly names... 
>> Since this has happened, my dev site is completely broken. This is what 
>> appears on every page:
>>
>> *Plugin app could not be found.*
>>
>> No line number, file, or anything indicating what the problem is, and i'm 
>> pretty sure "app" isn't a plugin. It's thrown by (semi-obviously) 
>> MissingPluginException, and i see references to that in the Plugin loader 
>> (also somewhat obvious)... So what plugin is failing to load that 
>> identifies itself as "app", and is it related to the missing directories 
>> under /plugins? If so, why did they disappear, how do i get them back, or 
>> change my config to find them, etc.?
>>
>> If i seem cross, i apologize. i'm not frustrated with Cake itself, so 
>> much as my project & being too busy to immerse myself in learning the 
>> framework. 
>> Code available here: https://bitbucket.org/cautionbug/kodiak-investments
>>
>> Any help is truly appreciated.
>> -joe
>>
>>
>>

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


3.0 - Cakephp plugins gone from /plugins

2015-01-27 Thread Joe T.
i recently did a *composer update* for my dev site, and all the Cake 
plugins that were under /plugins were removed:

/plugins
- /Bake   (gone)
- /DebugKit   (gone)
- /Migrations (gone)

However, there are new(?) directories under /vendor/cakephp corresponding 
to the same plugins:

/vendor/cakephp
- /bake
- /debug_kit
- /migrations

i've tried deleting everything in /plugins & /vendor and the composer.lock 
file, then running *composer install* to get a fresh copy of everything, 
with no luck. i added the line to "scripts" as mentioned in the RC1 release 
notes and prescribed by the composer update message when i ran without 
it... If i'm missing some step with composer, i wouldn't be surprised, but 
i have no idea what it might be.

My composer.json requires & such:
  "require": {
"php": ">=5.4.19",
"cakephp/cakephp": "3.0.*-dev",
"cakephp/plugin-installer": "dev-master",
"zurb/foundation": "dev-master",
"jockmac22/foundation_calendar_date_time_picker": "*",
"ckeditor/ckeditor": "dev-standard/latest",
"tecnick.com/tcpdf": "dev-master",
"openwall/phpass": "*"
  },
  "require-dev": {
"cakephp/bake": "dev-master",
"cakephp/debug_kit": "3.0.*-dev",
"cakephp/migrations": "dev-master",
"d11wtq/boris": "1.0.*"
  },
  "autoload": {
"psr-4": {
  "App\\": "App",
  "App\\Test\\": "Test",
  "": "./plugins",
  "Thook\\": "./plugins/Thook/src",
  "Thook\\Cakerov\\": "./plugins/Thook/Cakerov/src",
  "Thook\\Websites\\": "./plugins/Thook/Websites/src",
  "Thook\\Test\\": "./plugins/Thook/tests"
}
  },
  "autoload-dev": {
"psr-4": {
  "Thook\\Cakerov\\Test\\": "./Plugin/Thook/Cakerov/tests",
  "Thook\\Websites\\Test\\": "./Plugin/Thook/Websites/tests"
}
  },
  "scripts": {
"post-install-cmd": "App\\Console\\Installer::postInstall",
"post-autoload-dump": 
"Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump"
  },


Yeah, yeah, i know, silly names... 
Since this has happened, my dev site is completely broken. This is what 
appears on every page:

*Plugin app could not be found.*

No line number, file, or anything indicating what the problem is, and i'm 
pretty sure "app" isn't a plugin. It's thrown by (semi-obviously) 
MissingPluginException, and i see references to that in the Plugin loader 
(also somewhat obvious)... So what plugin is failing to load that 
identifies itself as "app", and is it related to the missing directories 
under /plugins? If so, why did they disappear, how do i get them back, or 
change my config to find them, etc.?

If i seem cross, i apologize. i'm not frustrated with Cake itself, so much 
as my project & being too busy to immerse myself in learning the framework. 
Code available here: https://bitbucket.org/cautionbug/kodiak-investments

Any help is truly appreciated.
-joe


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


Re: 3.0: Saving new entity with belongsToMany data

2015-01-22 Thread Joe T.
Yes, i agree i left that pretty open-ended. My apologies. And no offense 
intended toward you for not being able to follow up sooner. i've been busy 
too & just haven't been able to keep beating on this on my own.

In *App/Controller/Admin/ListingsController.php*, the Entity is created 
~line 124. Just inside the try{} i have 3 Log::debug lines, and according 
to the Debug plugin, those now have the data i expect (which is in a 
previous message on this thread). However, while the save now succeeds for 
the parent table (Listings), it still isn't saving anything to the 
associated child (ListingsAttrs).

i don't know if it's a problem with the way i'm setting up the fields & 
thus that data is going into the POST:

// *App/Template/Element/Admin/Form/listing-attributes.ctp* produces this 
part of the POST data:
[listings_attrs] => Array (
[4] => Array (
[attr_id] => 4
)
[1] => Array (
[attr_id] => 1
[value] => Off-street
)
)

Or if it's something wrong with the Tables (
*App/Model/Table/ListingsTable.php* & 
*App/Model/Table/ListingsAttrsTable.php*)
Or it's a problem with my Entity prep in the Controller.
Or something else i'm missing completely.

i didn't go into a lot of detail before as i hope it's just something 
simple that would jump out as wrong since you know how things *should* work.

As i noted before, being able to see this in action is behind a login i'd 
rather provide privately *if you can* take a little time to see it 
happening. If you don't have the time, i understand. Free advice & help has 
its limitations. You guys are already very generous helping me & the rest 
of the group. :)

Oh, hey, i just discovered the private reply menu item... i'll send the 
info that way.

Thanks again.
-joe


On Thursday, 22 January 2015 04:03:38 UTC-5, José Lorenzo wrote:
>
> No, I have not had the time to check the code. I was expecting something 
> more manageable for me to review and not a full application. Or at least 
> instructions for getting your code to run and where in your code the 
> problem is.
>
> On Thursday, January 22, 2015 at 5:39:21 AM UTC+1, Joe T. wrote:
>>
>> Did i get lost in the shuffle? i confess i've been busy with other things 
>> myself, but have been checking here to see if there was any response with 
>> some ideas what i'm doing wrong...
>>
>> Any help? Please? :)
>>
>> Always appreciated.
>> -joe
>>
>>
>> On Tuesday, 13 January 2015 08:04:37 UTC-5, Joe T. wrote:
>>>
>>> https://bitbucket.org/cautionbug/kodiak-investments
>>>
>>> The stuff i'm having trouble with is behind an admin login. If you need 
>>> access, i'd prefer to send that privately.
>>>
>>> Thanks for responding & being willing to take a look.
>>>
>>> -joe
>>>
>>>
>>> On Tuesday, 13 January 2015 03:38:36 UTC-5, José Lorenzo wrote:
>>>>
>>>> I think you should put your code somewhere so we can take a look, 
>>>> otherwise trying to guess what the problem is will take a while.
>>>>
>>>> On Tuesday, January 13, 2015 at 4:02:56 AM UTC+1, Joe T. wrote:
>>>>>
>>>>> Wondering if someone can help me take a closer look at this... i'm 
>>>>> still not having any luck & can't really get much forward progress until 
>>>>> i 
>>>>> understand this.
>>>>>
>>>>> If you need more information to determine suggestions, let me know. 
>>>>> Any suggestions are appreciated.
>>>>>
>>>>> -joe
>>>>>
>>>>>
>>>>> On Tuesday, 30 December 2014 01:52:54 UTC-5, Joe T. wrote:
>>>>>>
>>>>>> i figured out part of my trouble, but the purpose of the original 
>>>>>> post still remains.
>>>>>>
>>>>>> The parent record in Listings wasn't saving correctly because i 
>>>>>> didn't have an `active` field in the form (*facepalm*). Corrected 
>>>>>> that. Still having trouble with the date field, kinda frustrated there. 
>>>>>> But 
>>>>>> to the point...
>>>>>>
>>>>>> When i save my data, i'm now getting a record in Listings. Yay! But 
>>>>>> the associated data in ListingsAttrs is still not there. Boo!
>>>>>>
>>>>>> Current structure of ListingsAttrs POST data:
>>>>>> [listings_attrs] => Array (
>>>>>> [4] => Arr

Re: 3.0: Saving new entity with belongsToMany data

2015-01-21 Thread Joe T.
Did i get lost in the shuffle? i confess i've been busy with other things 
myself, but have been checking here to see if there was any response with 
some ideas what i'm doing wrong...

Any help? Please? :)

Always appreciated.
-joe


On Tuesday, 13 January 2015 08:04:37 UTC-5, Joe T. wrote:
>
> https://bitbucket.org/cautionbug/kodiak-investments
>
> The stuff i'm having trouble with is behind an admin login. If you need 
> access, i'd prefer to send that privately.
>
> Thanks for responding & being willing to take a look.
>
> -joe
>
>
> On Tuesday, 13 January 2015 03:38:36 UTC-5, José Lorenzo wrote:
>>
>> I think you should put your code somewhere so we can take a look, 
>> otherwise trying to guess what the problem is will take a while.
>>
>> On Tuesday, January 13, 2015 at 4:02:56 AM UTC+1, Joe T. wrote:
>>>
>>> Wondering if someone can help me take a closer look at this... i'm still 
>>> not having any luck & can't really get much forward progress until i 
>>> understand this.
>>>
>>> If you need more information to determine suggestions, let me know. Any 
>>> suggestions are appreciated.
>>>
>>> -joe
>>>
>>>
>>> On Tuesday, 30 December 2014 01:52:54 UTC-5, Joe T. wrote:
>>>>
>>>> i figured out part of my trouble, but the purpose of the original post 
>>>> still remains.
>>>>
>>>> The parent record in Listings wasn't saving correctly because i didn't 
>>>> have an `active` field in the form (*facepalm*). Corrected that. Still 
>>>> having trouble with the date field, kinda frustrated there. But to the 
>>>> point...
>>>>
>>>> When i save my data, i'm now getting a record in Listings. Yay! But the 
>>>> associated data in ListingsAttrs is still not there. Boo!
>>>>
>>>> Current structure of ListingsAttrs POST data:
>>>> [listings_attrs] => Array (
>>>> [4] => Array (
>>>> [attr_id] => 4
>>>> )
>>>> [1] => Array (
>>>> [attr_id] => 1
>>>> [value] => Off-street
>>>> )
>>>> )
>>>>
>>>> Which now gives me this in the *$listing* Entity:
>>>> "listings_attrs": {
>>>> "4": {
>>>> "attr_id": "4"
>>>> },
>>>> "1": {
>>>> "attr_id": "1",
>>>> "value": "Off-street"
>>>> }
>>>> }
>>>>
>>>> This is progress! The associated data wasn't in previous debug data.
>>>>
>>>> So what am i still missing that it won't save that data? Remember, 
>>>> `value` is optional to the data record, it's controlled by the UI. So 
>>>> both of those records *should be* valid. Why then is neither of them 
>>>> being saved?
>>>>
>>>> Any additional help here is appreciated.
>>>> -joe t.
>>>>
>>>>
>>>> On Monday, 22 December 2014 22:54:12 UTC-5, Joe T. wrote:
>>>>>
>>>>> Sorry this took several days to respond, i was sick all weekend, 
>>>>> didn't get anywhere near my computer.
>>>>>
>>>>> i changed the names of the inputs from *listingsattrs* >> 
>>>>> *listings_attrs* as you recommended (no clue how i missed that to 
>>>>> begin with). My POST data now looks exactly as it did before, except for 
>>>>> the name of that particular item. However, the log output for the 
>>>>> $listing entity is still missing the associated ListingsAttrs data.
>>>>>
>>>>> The ListingsAttrs Entity didn't have a $_accessible array, so i added 
>>>>> a default:
>>>>> $_accessible = [
>>>>>   '*' => true
>>>>> ];
>>>>>
>>>>> The controller code looks like:
>>>>> $listing = $this->Listings->newEntity($this->request->data);
>>>>>
>>>>> /* i've also tried:
>>>>> $listing = $this->Listings->newEntity($this->request->data, 
>>>>> ['associated' => ['ListingsAttrs']]);
>>>>> $listing = $this->Listings->newEntity($this->request->data, 
>>>>> ['associated

Re: CakePHP 2.0 authentication(login) without ctp files but other types

2015-01-13 Thread Joe T.
i'm not sure if/how you can disable Auth's automatic hashing of the 
password value to authenticate the login. In any case, i'd be very careful 
about doing so. i have a very basic understanding of that component. 

Someone else would have to speak to that, and any ideas for converting the 
existing user record's password without setting up a new account. i don't 
know if there are that many options. Security sacrifices a good amount of 
flexibility in cases like this.

-joe


On Sunday, 11 January 2015 06:52:07 UTC-5, tech_me wrote:
>
> > If '123' is the actual data in your password field in the data record, 
> it's very likely this is the problem you're having with logging in.
> Maybe this is the problem;)
>
> > That's why i recommended setting up the create-user form from the 
> tutorial. 
> > It will set up the creation of the user record, which will encrypt the 
> password you supply and store *that* version in the table for comparison 
> during login.
> I will try the CTP style login soon.
> But, could I use existed (user) data if I just wanted to test my login 
> success or failure with session functionality?
> Not want to do the creating user process before other implementations.
>
> Thank you,
> tech_me
>
>
> On Tuesday, January 6, 2015 at 9:11:07 AM UTC+9, Joe T. wrote:
>>
>> >> Is that the actual data in `users`, or just simplified for example? 
>> Just want to clarify. Manually adding records won't work in this case. 
>> >It is the actual data which is storing in my `users` table.
>>
>> If '123' is the actual data in your password field in the data record, 
>> it's very likely this is the problem you're having with logging in.
>>
>> The line
>>   if ($this->Auth->login()) { ...
>> fails because Auth->login() method encrypts the POST password, turning '
>> *123*' into something like *$2y$10$VgMbmaJ5l96WJYJeU*... (in other 
>> words, an encrypted version of '*123*'). The encrypted string is 
>> compared to the database value more or less *as-is*. It expects the 
>> database value to *already* be encrypted. If they match, login passes. 
>> In your case:
>>
>> Encrypted POST password *$2y$10$VgMbmaJ5l96WJYJeU*... *!==* stored 
>> password value *123*, so login fails.
>>
>> That's why i recommended setting up the create-user form from the 
>> tutorial. It will set up the creation of the user record, which will 
>> encrypt the password you supply and store *that* version in the table 
>> for comparison during login.
>>
>> When i said you should adapt it to your needs, i meant the way the 
>> tutorial demonstrates the Form builder for CTP may not match exactly what 
>> you need for TAL. i'm unfamiliar with that, so if ignore that part if it 
>> was more confusing. :)
>>
>> Hope that clears things up a *little*. :)
>> -joe
>>
>>
>> On Sunday, 4 January 2015 01:59:27 UTC-5, tech_me wrote:
>>>
>>> Hi Joe, 
>>> Happy New Year!
>>>
>>> I'm sorry for delaying reply you.
>>> > Is that the actual data in `users`, or just simplified for example? 
>>> Just want to clarify. Manually adding records won't work in this case. 
>>> It is the actual data which is storing in my `users` table.
>>>
>>> > Auth automatically encrypts the submitted password & compares it to 
>>> the database value. If you enter '123' as the password, it's not going to 
>>> match '123' in the database after Auth encrypts it.
>>> I don't know this issue, but entered the password `123` just as it have 
>>> been stored in my table.
>>> Maybe this is the problem...I'll check it.
>>>
>>> > Obviously, adapt the CTP form to your TAL needs.
>>> What this means? Are you talking about the usage in my controller but 
>>> not html(TAL) files for login?
>>>
>>> Regards,
>>> tech_me
>>>
>>>
>>> On Tuesday, December 23, 2014 11:35:40 PM UTC+9, Joe T. wrote:
>>>>
>>>> Is that the actual data in `users`, or just simplified for example? 
>>>> Just want to clarify. Manually adding records won't work in this case. 
>>>> Auth 
>>>> automatically encrypts the submitted password & compares it to the 
>>>> database 
>>>> value. If you enter '123' as the password, it's not going to match '123' 
>>>> in 
>>>> the database after Auth encrypts it.
>>&

Re: 3.0: Saving new entity with belongsToMany data

2015-01-13 Thread Joe T.
https://bitbucket.org/cautionbug/kodiak-investments

The stuff i'm having trouble with is behind an admin login. If you need 
access, i'd prefer to send that privately.

Thanks for responding & being willing to take a look.

-joe


On Tuesday, 13 January 2015 03:38:36 UTC-5, José Lorenzo wrote:
>
> I think you should put your code somewhere so we can take a look, 
> otherwise trying to guess what the problem is will take a while.
>
> On Tuesday, January 13, 2015 at 4:02:56 AM UTC+1, Joe T. wrote:
>>
>> Wondering if someone can help me take a closer look at this... i'm still 
>> not having any luck & can't really get much forward progress until i 
>> understand this.
>>
>> If you need more information to determine suggestions, let me know. Any 
>> suggestions are appreciated.
>>
>> -joe
>>
>>
>> On Tuesday, 30 December 2014 01:52:54 UTC-5, Joe T. wrote:
>>>
>>> i figured out part of my trouble, but the purpose of the original post 
>>> still remains.
>>>
>>> The parent record in Listings wasn't saving correctly because i didn't 
>>> have an `active` field in the form (*facepalm*). Corrected that. Still 
>>> having trouble with the date field, kinda frustrated there. But to the 
>>> point...
>>>
>>> When i save my data, i'm now getting a record in Listings. Yay! But the 
>>> associated data in ListingsAttrs is still not there. Boo!
>>>
>>> Current structure of ListingsAttrs POST data:
>>> [listings_attrs] => Array (
>>> [4] => Array (
>>> [attr_id] => 4
>>> )
>>> [1] => Array (
>>> [attr_id] => 1
>>> [value] => Off-street
>>> )
>>> )
>>>
>>> Which now gives me this in the *$listing* Entity:
>>> "listings_attrs": {
>>> "4": {
>>> "attr_id": "4"
>>> },
>>> "1": {
>>> "attr_id": "1",
>>> "value": "Off-street"
>>> }
>>> }
>>>
>>> This is progress! The associated data wasn't in previous debug data.
>>>
>>> So what am i still missing that it won't save that data? Remember, 
>>> `value` is optional to the data record, it's controlled by the UI. So 
>>> both of those records *should be* valid. Why then is neither of them 
>>> being saved?
>>>
>>> Any additional help here is appreciated.
>>> -joe t.
>>>
>>>
>>> On Monday, 22 December 2014 22:54:12 UTC-5, Joe T. wrote:
>>>>
>>>> Sorry this took several days to respond, i was sick all weekend, didn't 
>>>> get anywhere near my computer.
>>>>
>>>> i changed the names of the inputs from *listingsattrs* >> 
>>>> *listings_attrs* as you recommended (no clue how i missed that to 
>>>> begin with). My POST data now looks exactly as it did before, except for 
>>>> the name of that particular item. However, the log output for the 
>>>> $listing entity is still missing the associated ListingsAttrs data.
>>>>
>>>> The ListingsAttrs Entity didn't have a $_accessible array, so i added 
>>>> a default:
>>>> $_accessible = [
>>>>   '*' => true
>>>> ];
>>>>
>>>> The controller code looks like:
>>>> $listing = $this->Listings->newEntity($this->request->data);
>>>>
>>>> /* i've also tried:
>>>> $listing = $this->Listings->newEntity($this->request->data, 
>>>> ['associated' => ['ListingsAttrs']]);
>>>> $listing = $this->Listings->newEntity($this->request->data, 
>>>> ['associated' => ['ItemAttrs']]);
>>>> $listing = $this->Listings->newEntity($this->request->data, 
>>>> ['associated' => ['ListingsAttrs.ItemAttrs']]);
>>>> $listing = $this->Listings->newEntity($this->request->data, 
>>>> ['associated' => ['ItemAttrs.ListingsAttrs']]);
>>>> */
>>>>
>>>> if ($this->Listings->save($listing)) {
>>>>   // etc.
>>>> }
>>>> else {
>>>>   throw new Exception...
>>>> }
>>>>
>>>> What else can i try? i appreciate the h

Re: 3.0: Saving new entity with belongsToMany data

2015-01-12 Thread Joe T.
Wondering if someone can help me take a closer look at this... i'm still 
not having any luck & can't really get much forward progress until i 
understand this.

If you need more information to determine suggestions, let me know. Any 
suggestions are appreciated.

-joe


On Tuesday, 30 December 2014 01:52:54 UTC-5, Joe T. wrote:
>
> i figured out part of my trouble, but the purpose of the original post 
> still remains.
>
> The parent record in Listings wasn't saving correctly because i didn't 
> have an `active` field in the form (*facepalm*). Corrected that. Still 
> having trouble with the date field, kinda frustrated there. But to the 
> point...
>
> When i save my data, i'm now getting a record in Listings. Yay! But the 
> associated data in ListingsAttrs is still not there. Boo!
>
> Current structure of ListingsAttrs POST data:
> [listings_attrs] => Array (
> [4] => Array (
> [attr_id] => 4
> )
> [1] => Array (
> [attr_id] => 1
> [value] => Off-street
> )
> )
>
> Which now gives me this in the *$listing* Entity:
> "listings_attrs": {
> "4": {
> "attr_id": "4"
> },
> "1": {
> "attr_id": "1",
> "value": "Off-street"
> }
> }
>
> This is progress! The associated data wasn't in previous debug data.
>
> So what am i still missing that it won't save that data? Remember, `value` 
> is optional to the data record, it's controlled by the UI. So both of those 
> records *should be* valid. Why then is neither of them being saved?
>
> Any additional help here is appreciated.
> -joe t.
>
>
> On Monday, 22 December 2014 22:54:12 UTC-5, Joe T. wrote:
>>
>> Sorry this took several days to respond, i was sick all weekend, didn't 
>> get anywhere near my computer.
>>
>> i changed the names of the inputs from *listingsattrs* >> 
>> *listings_attrs* as you recommended (no clue how i missed that to begin 
>> with). My POST data now looks exactly as it did before, except for the name 
>> of that particular item. However, the log output for the $listing entity 
>> is still missing the associated ListingsAttrs data.
>>
>> The ListingsAttrs Entity didn't have a $_accessible array, so i added a 
>> default:
>> $_accessible = [
>>   '*' => true
>> ];
>>
>> The controller code looks like:
>> $listing = $this->Listings->newEntity($this->request->data);
>>
>> /* i've also tried:
>> $listing = $this->Listings->newEntity($this->request->data, 
>> ['associated' => ['ListingsAttrs']]);
>> $listing = $this->Listings->newEntity($this->request->data, 
>> ['associated' => ['ItemAttrs']]);
>> $listing = $this->Listings->newEntity($this->request->data, 
>> ['associated' => ['ListingsAttrs.ItemAttrs']]);
>> $listing = $this->Listings->newEntity($this->request->data, 
>> ['associated' => ['ItemAttrs.ListingsAttrs']]);
>> */
>>
>> if ($this->Listings->save($listing)) {
>>   // etc.
>> }
>> else {
>>   throw new Exception...
>> }
>>
>> What else can i try? i appreciate the help.
>> -joe
>>
>> On Friday, 19 December 2014 11:29:12 UTC-5, José Lorenzo wrote:
>>>
>>> You should post a property called listings_attrs, check your entity 
>>> $_accessible array to make sure the property is also writable with request 
>>> data.
>>>
>>> On Friday, December 19, 2014 6:29:43 AM UTC+1, Joe T. wrote:
>>>>
>>>> i've seen a couple similar threads about this, but not my exact problem.
>>>>
>>>> i'm trying to follow the guide here: 
>>>> http://book.cakephp.org/3.0/en/orm/saving-data.html#converting-request-data-into-entities
>>>>  
>>>> and coming up short. *i'm not getting any errors* (except a date field 
>>>> that constantly fails if it has a value, separate issue)...so i have no 
>>>> idea what's happening to the data i submit, or why it isn't saved to the 
>>>> DB.
>>>>
>>>> My raw response data logged to Cake Debug is:
>>>>
>>>> Array (
>>>>   [title] => '123 Main St'
>>>>   [street] => '123 Main St'
>>>>   [lot_no] => 1
>>>>   [lat] =>
>&

Re: CakePHP 2.0 authentication(login) without ctp files but other types

2015-01-05 Thread Joe T.
>> Is that the actual data in `users`, or just simplified for example? Just 
want to clarify. Manually adding records won't work in this case. 
>It is the actual data which is storing in my `users` table.

If '123' is the actual data in your password field in the data record, it's 
very likely this is the problem you're having with logging in.

The line
  if ($this->Auth->login()) { ...
fails because Auth->login() method encrypts the POST password, turning '
*123*' into something like *$2y$10$VgMbmaJ5l96WJYJeU*... (in other words, 
an encrypted version of '*123*'). The encrypted string is compared to the 
database value more or less *as-is*. It expects the database value to 
*already* be encrypted. If they match, login passes. In your case:

Encrypted POST password *$2y$10$VgMbmaJ5l96WJYJeU*... *!==* stored password 
value *123*, so login fails.

That's why i recommended setting up the create-user form from the tutorial. 
It will set up the creation of the user record, which will encrypt the 
password you supply and store *that* version in the table for comparison 
during login.

When i said you should adapt it to your needs, i meant the way the tutorial 
demonstrates the Form builder for CTP may not match exactly what you need 
for TAL. i'm unfamiliar with that, so if ignore that part if it was more 
confusing. :)

Hope that clears things up a *little*. :)
-joe


On Sunday, 4 January 2015 01:59:27 UTC-5, tech_me wrote:
>
> Hi Joe, 
> Happy New Year!
>
> I'm sorry for delaying reply you.
> > Is that the actual data in `users`, or just simplified for example? Just 
> want to clarify. Manually adding records won't work in this case. 
> It is the actual data which is storing in my `users` table.
>
> > Auth automatically encrypts the submitted password & compares it to the 
> database value. If you enter '123' as the password, it's not going to match 
> '123' in the database after Auth encrypts it.
> I don't know this issue, but entered the password `123` just as it have 
> been stored in my table.
> Maybe this is the problem...I'll check it.
>
> > Obviously, adapt the CTP form to your TAL needs.
> What this means? Are you talking about the usage in my controller but not 
> html(TAL) files for login?
>
> Regards,
> tech_me
>
>
> On Tuesday, December 23, 2014 11:35:40 PM UTC+9, Joe T. wrote:
>>
>> Is that the actual data in `users`, or just simplified for example? Just 
>> want to clarify. Manually adding records won't work in this case. Auth 
>> automatically encrypts the submitted password & compares it to the database 
>> value. If you enter '123' as the password, it's not going to match '123' in 
>> the database after Auth encrypts it.
>>
>> Look here for how to set up adding/editing users: 
>> http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html
>> Obviously, adapt the CTP form to your TAL needs.
>>
>> Hope that helps...
>> -joe t.
>>
>>
>> On Monday, 22 December 2014 20:42:33 UTC-5, tech_me wrote:
>>>
>>> By the way, I have a table `users` in my db, which have 2 records.
>>> id,   email,  password
>>> 1001, abc@com, 123
>>> 1002, abc@org, 456
>>>
>>> When I input email and password on the login form, it fails at `if 
>>> ($this->Auth->login())`
>>>
>>>
>>> On Tuesday, December 23, 2014 10:39:39 AM UTC+9, tech_me wrote:
>>>>
>>>> In my view file(html)
>>>> 
>>>> >>> placeholder="your email" />
>>>> >>> placeholder="password" />
>>>> 
>>>> 
>>>>
>>>> In my AppController.php
>>>> public $components = array('RequestHandler',
>>>> 'Auth' => array(
>>>> 'authenticate' => array(
>>>> 'Form' => array('userModel' => 'User',
>>>> 'fields' => array('username' => 
>>>> 'email',
>>>> 'password' => 'password'))),
>>>> 'loginAction' => array('controller' => 'users', 
>>>> 'action' => 'login'));
>>>>
>>>> public function beforeFilter() {
>>>> $this->Auth->allow('login', 'logo

Re: 3.0: Saving new entity with belongsToMany data

2014-12-29 Thread Joe T.
i figured out part of my trouble, but the purpose of the original post 
still remains.

The parent record in Listings wasn't saving correctly because i didn't have 
an `active` field in the form (*facepalm*). Corrected that. Still having 
trouble with the date field, kinda frustrated there. But to the point...

When i save my data, i'm now getting a record in Listings. Yay! But the 
associated data in ListingsAttrs is still not there. Boo!

Current structure of ListingsAttrs POST data:
[listings_attrs] => Array (
[4] => Array (
[attr_id] => 4
)
[1] => Array (
[attr_id] => 1
[value] => Off-street
)
)

Which now gives me this in the *$listing* Entity:
"listings_attrs": {
"4": {
"attr_id": "4"
},
"1": {
"attr_id": "1",
"value": "Off-street"
}
}

This is progress! The associated data wasn't in previous debug data.

So what am i still missing that it won't save that data? Remember, `value` 
is optional to the data record, it's controlled by the UI. So both of those 
records *should be* valid. Why then is neither of them being saved?

Any additional help here is appreciated.
-joe t.


On Monday, 22 December 2014 22:54:12 UTC-5, Joe T. wrote:
>
> Sorry this took several days to respond, i was sick all weekend, didn't 
> get anywhere near my computer.
>
> i changed the names of the inputs from *listingsattrs* >> *listings_attrs* 
> as you recommended (no clue how i missed that to begin with). My POST data 
> now looks exactly as it did before, except for the name of that particular 
> item. However, the log output for the $listing entity is still missing 
> the associated ListingsAttrs data.
>
> The ListingsAttrs Entity didn't have a $_accessible array, so i added a 
> default:
> $_accessible = [
>   '*' => true
> ];
>
> The controller code looks like:
> $listing = $this->Listings->newEntity($this->request->data);
>
> /* i've also tried:
> $listing = $this->Listings->newEntity($this->request->data, ['associated' 
> => ['ListingsAttrs']]);
> $listing = $this->Listings->newEntity($this->request->data, ['associated' 
> => ['ItemAttrs']]);
> $listing = $this->Listings->newEntity($this->request->data, ['associated' 
> => ['ListingsAttrs.ItemAttrs']]);
> $listing = $this->Listings->newEntity($this->request->data, ['associated' 
> => ['ItemAttrs.ListingsAttrs']]);
> */
>
> if ($this->Listings->save($listing)) {
>   // etc.
> }
> else {
>   throw new Exception...
> }
>
> What else can i try? i appreciate the help.
> -joe
>
> On Friday, 19 December 2014 11:29:12 UTC-5, José Lorenzo wrote:
>>
>> You should post a property called listings_attrs, check your entity 
>> $_accessible array to make sure the property is also writable with request 
>> data.
>>
>> On Friday, December 19, 2014 6:29:43 AM UTC+1, Joe T. wrote:
>>>
>>> i've seen a couple similar threads about this, but not my exact problem.
>>>
>>> i'm trying to follow the guide here: 
>>> http://book.cakephp.org/3.0/en/orm/saving-data.html#converting-request-data-into-entities
>>>  
>>> and coming up short. *i'm not getting any errors* (except a date field 
>>> that constantly fails if it has a value, separate issue)...so i have no 
>>> idea what's happening to the data i submit, or why it isn't saved to the DB.
>>>
>>> My raw response data logged to Cake Debug is:
>>>
>>> Array (
>>>   [title] => '123 Main St'
>>>   [street] => '123 Main St'
>>>   [lot_no] => 1
>>>   [lat] =>
>>>   [lng] =>
>>>   [city] => 'Hometown'
>>>   [county] => 
>>>   [state] => 'MI'
>>>   [zip] => '49000'
>>>   [area] => 900 
>>>   [bedrooms] => 2 
>>>   [bathrooms] => 1 
>>>   [price] => 525 
>>>   [ready_date] =>
>>>   [listingsattrs] => Array (
>>> [4] => Array (
>>>   [id] => 4
>>> )
>>> [1] => Array (
>>>   [id] => 1
>>>   [value] => 'Off-street'
>>> )
>>>   )
>>>   [park_id] => 1
>>>   [house_condition_id] => 3
>>>   [house_style_id] => 2 
>>>   [term_id] => 2
&g

Re: CakePHP 2.0 authentication(login) without ctp files but other types

2014-12-23 Thread Joe T.
Is that the actual data in `users`, or just simplified for example? Just 
want to clarify. Manually adding records won't work in this case. Auth 
automatically encrypts the submitted password & compares it to the database 
value. If you enter '123' as the password, it's not going to match '123' in 
the database after Auth encrypts it.

Look here for how to set up adding/editing users: 
http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html
Obviously, adapt the CTP form to your TAL needs.

Hope that helps...
-joe t.


On Monday, 22 December 2014 20:42:33 UTC-5, tech_me wrote:
>
> By the way, I have a table `users` in my db, which have 2 records.
> id,   email,  password
> 1001, abc@com, 123
> 1002, abc@org, 456
>
> When I input email and password on the login form, it fails at `if 
> ($this->Auth->login())`
>
>
> On Tuesday, December 23, 2014 10:39:39 AM UTC+9, tech_me wrote:
>>
>> In my view file(html)
>> 
>> > placeholder="your 
>> email" />
>> > placeholder="password" />
>> 
>> 
>>
>> In my AppController.php
>> public $components = array('RequestHandler',
>> 'Auth' => array(
>> 'authenticate' => array(
>> 'Form' => array('userModel' => 'User',
>> 'fields' => array('username' => 
>> 'email',
>> 'password' => 'password'))),
>> 'loginAction' => array('controller' => 'users', 
>> 'action' => 'login'));
>>
>> public function beforeFilter() {
>> $this->Auth->allow('login', 'logout');
>> }
>>
>> In my UsersController.php
>> public function login() {
>> if ($this->request->is('post')) {
>>if ($this->Auth->login()) {
>> return $this->redirect($this->Auth->redirect());
>> } else {
>> echo ('failed'); // Always come here...
>> }
>> }
>> }
>>
>> public function logout() {
>> $this->Auth->logout();
>> $this->Session->destroy();
>> $this->redirect(array('action' => 'login'));
>> }
>>
>> Could you give some hints, please?
>> Thank you.
>>
>>
>> On Sunday, December 21, 2014 4:48:14 PM UTC+9, tech_me wrote:
>>>
>>> 1. Yes
>>> 2. Yes
>>> 3. No any error but just failed(false) at that `if` statement.
>>> 4. Maybe there is no the same name field in my user table, which is 
>>> 'email' in html while 'nickname' in table schema
>>>
>>> I will have a try soon.
>>> Thank you.
>>>
>>>
>>> On Friday, December 19, 2014 4:55:03 AM UTC+9, John Andersen wrote:
>>>>
>>>> Please provide more information on the steps leading up to the error 
>>>> that you get.
>>>> 1. Is the login form showing?
>>>> 2. Can you submit the form?
>>>> 3. Do you get the error back from your login method - wrong e-mail or 
>>>> password?
>>>> 4. Something else?
>>>>
>>>> Suggest that you at least create the users table and add one user, so 
>>>> that CakePHP has something to work with.
>>>>
>>>> Enjoy, John
>>>>
>>>> On Wednesday, 17 December 2014 14:14:43 UTC+2, tech_me wrote:
>>>>>
>>>>> I posted to SO several days ago, but no expected replies.
>>>>> http://stackoverflow.com/q/27403391
>>>>>
>>>>> I am now using PHPTAL <http://phptal.org/> which use html instead of 
>>>>> ctp files.
>>>>> Is there anyone who use the html files to cooperate with Cake's 
>>>>> authentication?
>>>>>
>>>>> 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/d/optout.


Re: 3.0: Saving new entity with belongsToMany data

2014-12-22 Thread Joe T.
Sorry this took several days to respond, i was sick all weekend, didn't get 
anywhere near my computer.

i changed the names of the inputs from *listingsattrs* >> *listings_attrs* 
as you recommended (no clue how i missed that to begin with). My POST data 
now looks exactly as it did before, except for the name of that particular 
item. However, the log output for the $listing entity is still missing the 
associated ListingsAttrs data.

The ListingsAttrs Entity didn't have a $_accessible array, so i added a 
default:
$_accessible = [
  '*' => true
];

The controller code looks like:
$listing = $this->Listings->newEntity($this->request->data);

/* i've also tried:
$listing = $this->Listings->newEntity($this->request->data, ['associated' 
=> ['ListingsAttrs']]);
$listing = $this->Listings->newEntity($this->request->data, ['associated' 
=> ['ItemAttrs']]);
$listing = $this->Listings->newEntity($this->request->data, ['associated' 
=> ['ListingsAttrs.ItemAttrs']]);
$listing = $this->Listings->newEntity($this->request->data, ['associated' 
=> ['ItemAttrs.ListingsAttrs']]);
*/

if ($this->Listings->save($listing)) {
  // etc.
}
else {
  throw new Exception...
}

What else can i try? i appreciate the help.
-joe

On Friday, 19 December 2014 11:29:12 UTC-5, José Lorenzo wrote:
>
> You should post a property called listings_attrs, check your entity 
> $_accessible array to make sure the property is also writable with request 
> data.
>
> On Friday, December 19, 2014 6:29:43 AM UTC+1, Joe T. wrote:
>>
>> i've seen a couple similar threads about this, but not my exact problem.
>>
>> i'm trying to follow the guide here: 
>> http://book.cakephp.org/3.0/en/orm/saving-data.html#converting-request-data-into-entities
>>  
>> and coming up short. *i'm not getting any errors* (except a date field 
>> that constantly fails if it has a value, separate issue)...so i have no 
>> idea what's happening to the data i submit, or why it isn't saved to the DB.
>>
>> My raw response data logged to Cake Debug is:
>>
>> Array (
>>   [title] => '123 Main St'
>>   [street] => '123 Main St'
>>   [lot_no] => 1
>>   [lat] =>
>>   [lng] =>
>>   [city] => 'Hometown'
>>   [county] => 
>>   [state] => 'MI'
>>   [zip] => '49000'
>>   [area] => 900 
>>   [bedrooms] => 2 
>>   [bathrooms] => 1 
>>   [price] => 525 
>>   [ready_date] =>
>>   [listingsattrs] => Array (
>> [4] => Array (
>>   [id] => 4
>> )
>> [1] => Array (
>>   [id] => 1
>>   [value] => 'Off-street'
>> )
>>   )
>>   [park_id] => 1
>>   [house_condition_id] => 3
>>   [house_style_id] => 2 
>>   [term_id] => 2
>>   [info_body] => 'Live here. It's great!'
>> ) 
>>
>> i have tables *Listings*, *ItemAttrs*, and *ListingsAttrs*. In 
>> *ListingsTable*, the relationship is defined as:
>> $this->addAssociations([
>>   'belongsToMany' => [
>> 'ItemAttrs' => [
>>   'targetForeignKey' => 'attr_id',
>>   'through'  => 'ListingsAttrs',
>>   'saveStrategy' => 'replace',
>>   ]
>> ])'
>>
>> *Some* attributes are required to have a value when assigned to a 
>> Listing (or other parent object they can be assigned to with a similar 
>> relationship). When a requires-value attribute is selected for the (in this 
>> case) Listing, a text field is shown & marked as required. The value is 
>> stored in the *ListingsAttrs* record with the Listing ID and ItemAttr ID.
>>
>> When i submit the form, the correct attribute data is there. But it gets 
>> lost when i generate the Entity:
>>
>> $listing = $this->Listings->newEntity($this->request->data, [
>>   'associated' => ['ListingsAttrs']
>> ]);
>>
>>
>> Log of *$listing*:
>> {
>>   "title": "123 Main St",
>>   "street": "123 Main St",
>>   "lot_no": "1",
>>   "lat": null,
>>   "lng": null,
>>   "city": "Hometown",
>>   "county": null,
>>   "state": "MI",
>>   "zip&quo

3.0: Saving new entity with belongsToMany data

2014-12-18 Thread Joe T.
i've seen a couple similar threads about this, but not my exact problem.

i'm trying to follow the guide here: 
http://book.cakephp.org/3.0/en/orm/saving-data.html#converting-request-data-into-entities
 
and coming up short. *i'm not getting any errors* (except a date field that 
constantly fails if it has a value, separate issue)...so i have no idea 
what's happening to the data i submit, or why it isn't saved to the DB.

My raw response data logged to Cake Debug is:

Array (
  [title] => '123 Main St'
  [street] => '123 Main St'
  [lot_no] => 1
  [lat] =>
  [lng] =>
  [city] => 'Hometown'
  [county] => 
  [state] => 'MI'
  [zip] => '49000'
  [area] => 900 
  [bedrooms] => 2 
  [bathrooms] => 1 
  [price] => 525 
  [ready_date] =>
  [listingsattrs] => Array (
[4] => Array (
  [id] => 4
)
[1] => Array (
  [id] => 1
  [value] => 'Off-street'
)
  )
  [park_id] => 1
  [house_condition_id] => 3
  [house_style_id] => 2 
  [term_id] => 2
  [info_body] => 'Live here. It's great!'
) 

i have tables *Listings*, *ItemAttrs*, and *ListingsAttrs*. In 
*ListingsTable*, the relationship is defined as:
$this->addAssociations([
  'belongsToMany' => [
'ItemAttrs' => [
  'targetForeignKey' => 'attr_id',
  'through'  => 'ListingsAttrs',
  'saveStrategy' => 'replace',
  ]
])'

*Some* attributes are required to have a value when assigned to a Listing 
(or other parent object they can be assigned to with a similar 
relationship). When a requires-value attribute is selected for the (in this 
case) Listing, a text field is shown & marked as required. The value is 
stored in the *ListingsAttrs* record with the Listing ID and ItemAttr ID.

When i submit the form, the correct attribute data is there. But it gets 
lost when i generate the Entity:

$listing = $this->Listings->newEntity($this->request->data, [
  'associated' => ['ListingsAttrs']
]);


Log of *$listing*:
{
  "title": "123 Main St",
  "street": "123 Main St",
  "lot_no": "1",
  "lat": null,
  "lng": null,
  "city": "Hometown",
  "county": null,
  "state": "MI",
  "zip": "49000",
  "area": 900,
  "bedrooms": 2,
  "bathrooms": 1,
  "price": 525,
  "ready_date": null,
  "park_id": 1,
  "house_condition_id": 3,
  "house_style_id": 2,
  "term_id": 2,
  "info_body": "Live here. It's great!<\/p>\r\n" 
}

i've tried creating the Listings entity without 'associated' at all, as 
'associated' 
=> 'ListingsAttrs', and 'associated' => 'ItemAttrs'

i'm trying to understand this ORM, because it *looks* like it should be 
very automated & easy to use. (By comparison, has anyone here used ZF1's 
ORM? Yikes.) But i don't know what i'm doing wrong here. It *seems* like 
i'm following the guide, but i'm obviously mixing something up.


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


Re: 3.0b3 - label[for] & input[id] discrepancies

2014-12-03 Thread Joe T.
Oops. Yes, i goofed. i'm looking right at it in the docs. >.<

Well, here's what i did...
i created an extension FormHelper class, adding a public domId function 
that returns the protected _domId value. Checkbox isn't generating a 
wrapping label, nor a DOM-valid ID, so i'm providing the field's name in 
dot-notation to label() & checkbox(), and calling $this->Form->domId on the 
name for the checkbox's id attribute. The for & id match. It's not exactly 
as elegant as how other inputs handle things, but i can live with it.

Thanks for the help.
-joe


On Wednesday, 3 December 2014 02:15:17 UTC-5, José Lorenzo wrote:
>
> The first argument for label is not "for", it is "fieldName" From the 
> "fieldName" the "for" attribute is inferred. If you wish to provide you own 
> for attribute, then use label('field_name', 'Label text', ['for' => 
> 'field-id']);
>
> On Wednesday, December 3, 2014 6:14:34 AM UTC+1, Joe Theuerkauf wrote:
>>
>> Thanks for responding José.
>>
>> To address the first message, i understand i have to provide the 
>> attributes if i build the elements separately. That's what i thought i was 
>> doing. The first argument of label() is the [for] attribute (notice i 
>> didn't provide any options to label() except 'escape'=>false to render 
>> the inner HTML correctly). The variable i set previous to that gets the 
>> _domId() treatment. Then in the checkbox call, the $attrId variable is 
>> untouched for [id]. The _domId() method isn't public, so i can't treat 
>> my variable when using it as the [id]. The result is it doesn't match 
>> the label's [for]. It seems like the [id] attribute should always get 
>> the _domId() treatment, but currently it looks like _domId() is only 
>> applied to the auto-generated [id]. If i provide my own, the 
>> auto-generated is skipped, and mine isn't converted - and thus match the 
>> label's [for].
>>
>> Also, as i noted in my original, i tried using just the checkbox call 
>> with a 'label' key, and the label was instead used as an attribute, no 
>> tag was generated to wrap the checkbox. It may have been unclear in the way 
>> i posted it, because it was a secondary issue. 
>>
>> This:
>> $this->Form->checkbox('checkboxName', ['label' => 'Some Checkbox']);
>> or
>> $this->Form->checkbox('checkboxName', ['label' => ['text' => 'Some 
>> Checkbox']]);
>>
>> Produces:
>> 
>> rather than:
>> > name="checkboxName">Some Checkbox
>>
>> The other inputs don't seem to have that label problem, but i don't know 
>> if checkbox is the only one doing this (or why).
>>
>> The basic structure i'm trying to achieve is something like:
>> 
>> 
>> > name="associated[checkbox][1]">
>> 
>> 
>> 
>>
>> So, getting to your second message: since the label tag wasn't being 
>> generated, and because i needed a little extra customization (the text 
>> input is generated/required for some of the checkboxes), i went with 
>> building the elements separately. The Form helper is very flexible & i'd 
>> like to use it's capabilities, but i wasn't sure how to get the results i 
>> needed using the templating system (especially the additional text input).
>>
>> Which brings me back to my question: if i'm providing the attributes 
>> myself, but Form helper is converting some of them with _domId() but not 
>> others, how do i get the [for] to match the [id] (and both be DOM-valid)?
>>
>> Thanks!
>> -joe
>>
>>
>> On Tuesday, 2 December 2014 03:03:46 UTC-5, José Lorenzo wrote:
>>>
>>> Why not use the form tempting system instead? The Form helper is very 
>>> flexible in the way that it allows you to create your html
>>>
>>> On Tuesday, December 2, 2014 9:01:06 AM UTC+1, José Lorenzo wrote:
>>>>
>>>> If you use label() and checkbox() separately, you re responsible for 
>>>> passing the correct attributes to those 2 functions. For example, for 
>>>> label() you will have to provide the 'for' attribute and for checkbox() 
>>>> the 
>>>> 'id' attribute.
>>>> When using the input() function, the label and the checkbox will be 
>>>> generated for you with a matching id for both t

Re: 3.0b3 - label[for] & input[id] discrepancies

2014-12-02 Thread Joe Theuerkauf
Thanks for responding José.

To address the first message, i understand i have to provide the attributes 
if i build the elements separately. That's what i thought i was doing. The 
first argument of label() is the [for] attribute (notice i didn't provide 
any options to label() except 'escape'=>false to render the inner HTML 
correctly). The variable i set previous to that gets the _domId() 
treatment. Then in the checkbox call, the $attrId variable is untouched for 
[id]. The _domId() method isn't public, so i can't treat my variable when 
using it as the [id]. The result is it doesn't match the label's [for]. It 
seems like the [id] attribute should always get the _domId() treatment, but 
currently it looks like _domId() is only applied to the auto-generated [id]. 
If i provide my own, the auto-generated is skipped, and mine isn't 
converted - and thus match the label's [for].

Also, as i noted in my original, i tried using just the checkbox call with 
a 'label' key, and the label was instead used as an attribute, no tag was 
generated to wrap the checkbox. It may have been unclear in the way i 
posted it, because it was a secondary issue. 

This:
$this->Form->checkbox('checkboxName', ['label' => 'Some Checkbox']);
or
$this->Form->checkbox('checkboxName', ['label' => ['text' => 'Some 
Checkbox']]);

Produces:

rather than:
Some Checkbox

The other inputs don't seem to have that label problem, but i don't know if 
checkbox is the only one doing this (or why).

The basic structure i'm trying to achieve is something like:







So, getting to your second message: since the label tag wasn't being 
generated, and because i needed a little extra customization (the text 
input is generated/required for some of the checkboxes), i went with 
building the elements separately. The Form helper is very flexible & i'd 
like to use it's capabilities, but i wasn't sure how to get the results i 
needed using the templating system (especially the additional text input).

Which brings me back to my question: if i'm providing the attributes 
myself, but Form helper is converting some of them with _domId() but not 
others, how do i get the [for] to match the [id] (and both be DOM-valid)?

Thanks!
-joe


On Tuesday, 2 December 2014 03:03:46 UTC-5, José Lorenzo wrote:
>
> Why not use the form tempting system instead? The Form helper is very 
> flexible in the way that it allows you to create your html
>
> On Tuesday, December 2, 2014 9:01:06 AM UTC+1, José Lorenzo wrote:
>>
>> If you use label() and checkbox() separately, you re responsible for 
>> passing the correct attributes to those 2 functions. For example, for 
>> label() you will have to provide the 'for' attribute and for checkbox() the 
>> 'id' attribute.
>> When using the input() function, the label and the checkbox will be 
>> generated for you with a matching id for both tags
>>
>> On Tuesday, December 2, 2014 5:21:47 AM UTC+1, Joe Theuerkauf wrote:
>>>
>>> i'm a little confused about how labels & inputs are assigned for/id 
>>> pairs in FormHelper.
>>>
>>> Here's the code i have (it's inside a foreach of an entity collection):
>>>
>>> $attrId = 'Listing.ItemAttr.' . $attr->id;
>>> echo
>>>   $this->Html->div('columns small-16 medium-8',
>>> $this->Form->label($attrId, // [for] attribute
>>>   $this->Form->checkbox(
>>> $attrId, // [name] attribute
>>> [
>>>'id' => $attrId, // [id] attribute - if i skip this for 
>>> checkbox inputs, i don't get an [id] attribute.
>>>// 'label' => $attr->name >> turns into >> type="checkbox" label="Attribute Name">
>>>// other checkbox attributes
>>> ]
>>>   ) . $attr->name,
>>>   [
>>>  'escape' => FALSE
>>>   ]
>>> ) // end label
>>> );
>>>
>>> The resulting HTML:
>>>
>>> 
>>>   
>>> Attribute Name
>>>   
>>> 
>>>
>>> The label passes the [for] attribute through FormHelper::_domId, which 
>>> i'd expect. But the [id] attribute doesn't appear to get the same 
>>> treatment. i changed the checkbox() call to input() and the same ID 
>>> string was assigned. It looks like an auto-generated ID is passed through 
>>> _domId, but that o

Decoupling cake php applications

2014-12-02 Thread Joe Appleton
Hi, I've been doing some research on how to decouple cakePHP applications. 
The main issue seems to be models being communicated  via related models 
and controllers. E.G. I often see things like 
$this->user->post->comment->add() being implemented. So far I have found 
Carl Sutton's talk, where he suggests using cake events 
https://www.youtube.com/watch?v=EerAI2no9PY

Is there any other documentation addressing this issue?

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


3.0b3 - label[for] & input[id] discrepancies

2014-12-01 Thread Joe Theuerkauf
i'm a little confused about how labels & inputs are assigned for/id pairs 
in FormHelper.

Here's the code i have (it's inside a foreach of an entity collection):

$attrId = 'Listing.ItemAttr.' . $attr->id;
echo
  $this->Html->div('columns small-16 medium-8',
$this->Form->label($attrId, // [for] attribute
  $this->Form->checkbox(
$attrId, // [name] attribute
[
   'id' => $attrId, // [id] attribute - if i skip this for checkbox 
inputs, i don't get an [id] attribute.
   // 'label' => $attr->name >> turns into 
   // other checkbox attributes
]
  ) . $attr->name,
  [
 'escape' => FALSE
  ]
) // end label
);

The resulting HTML:


  
Attribute Name
  


The label passes the [for] attribute through FormHelper::_domId, which i'd 
expect. But the [id] attribute doesn't appear to get the same treatment. i 
changed the checkbox() call to input() and the same ID string was assigned. 
It looks like an auto-generated ID is passed through _domId, but that only 
gets into the attributes if 'id' isn't already set in that array.

i also discovered that in the checkbox() method, a 'label' key is turned 
into an attribute of the input, not used to generate a wrapping  
element as with most other inputs. Peculiar. So i'm doing this manual 
structure (which is fine, i also need to customize some other parts of the 
HTML anyway). 

*Question 1*: In FormHelper::input(), shouldn't the ID attribute be 
adjusted with _domId *after* the $options array is complete? Or is there an 
issue in checkbox() that it's not outputting the generated ID to HTML?

*Question 2*: Any suggestions how to get the wrapping label's [for] to 
match the checkbox's [id] until one of the above is addressed?

Thanks.
-joe t.

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


Re: Conditionally set defaultConnectionName

2014-11-03 Thread Joe Theuerkauf
Heh, just for the record, the arguments were reversed:

ConnectionManager::alias('admin', 'default'); ($from, $to)

i'm sure you were just making sure i'm paying attention. ;-)
It's working. Very grateful for the help.
-joe


On Monday, 3 November 2014 04:02:00 UTC-5, José Lorenzo wrote:
>
> In your controller under the admin namespace do:
>
> public function beforeFilter() {
>   parent::beforeFilter();
>   \Cake\Datasource\ConnectionManager::alias('default', 'admin');
> }
>
> On Sunday, November 2, 2014 4:44:16 PM UTC+1, Joe Theuerkauf wrote:
>>
>> Sorry, what i meant was, i don't plan to use defaultConnectionName the 
>> same WAY i was using it for the Captcha question. If it's a legit option, 
>> i'll use it, but i see your point about not using defaultConnectionName AND 
>> a connection alias.
>>
>> On Sunday, 2 November 2014 10:40:20 UTC-5, Joe Theuerkauf wrote:
>>>
>>> Thanks for that tip, Mark. i don't plan to use defaultConnectionName in 
>>> this scenario (as i did for the Captcha thread where the table i needed is 
>>> in a different database). 
>>>
>>> i can see where aliasing the connection will make it hard to access the 
>>> original connection. Which is why i asked for some elaboration on how/where 
>>> it's used. If it can be done during the request life cycle (i.e. 
>>> Controllers), i could set the alias just for the Admin-level controllers, 
>>> where they WILL need the elevated permissions. The general-level 
>>> controllers would never see the alias (i think). But if the alias can't be 
>>> used that way, maybe it's the wrong solution.
>>>
>>> Is it possible/reasonable to use defaultConnectionName with some 
>>> conditional logic to return which connection should be used?
>>>
>>> public function defaultConnectionName() {
>>> return $adminIsLoggedIn ? 'admin' : 'default';
>>> }
>>>
>>> If that's a reasonable approach, how can i determine $adminIsLoggedIn 
>>> from inside the Table(s)? Maybe the whole question is clumsy and/or 
>>> unnecessary to start with. :)
>>>
>>> Thanks again.
>>> -joe
>>>
>>>
>>> On Sunday, 2 November 2014 06:48:30 UTC-5, mark_story wrote:
>>>>
>>>> If you alias connections you don't need to use defaultConnectionName(). 
>>>> Aliasing the connection makes it much harder to access the regular default 
>>>> connection as whenever you ask for it you get the admin connection instead.
>>>>
>>>> -mark
>>>>
>>>

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


Re: Conditionally set defaultConnectionName

2014-11-02 Thread Joe Theuerkauf
Sorry, what i meant was, i don't plan to use defaultConnectionName the same 
WAY i was using it for the Captcha question. If it's a legit option, i'll 
use it, but i see your point about not using defaultConnectionName AND a 
connection alias.

On Sunday, 2 November 2014 10:40:20 UTC-5, Joe Theuerkauf wrote:
>
> Thanks for that tip, Mark. i don't plan to use defaultConnectionName in 
> this scenario (as i did for the Captcha thread where the table i needed is 
> in a different database). 
>
> i can see where aliasing the connection will make it hard to access the 
> original connection. Which is why i asked for some elaboration on how/where 
> it's used. If it can be done during the request life cycle (i.e. 
> Controllers), i could set the alias just for the Admin-level controllers, 
> where they WILL need the elevated permissions. The general-level 
> controllers would never see the alias (i think). But if the alias can't be 
> used that way, maybe it's the wrong solution.
>
> Is it possible/reasonable to use defaultConnectionName with some 
> conditional logic to return which connection should be used?
>
> public function defaultConnectionName() {
> return $adminIsLoggedIn ? 'admin' : 'default';
> }
>
> If that's a reasonable approach, how can i determine $adminIsLoggedIn 
> from inside the Table(s)? Maybe the whole question is clumsy and/or 
> unnecessary to start with. :)
>
> Thanks again.
> -joe
>
>
> On Sunday, 2 November 2014 06:48:30 UTC-5, mark_story wrote:
>>
>> If you alias connections you don't need to use defaultConnectionName(). 
>> Aliasing the connection makes it much harder to access the regular default 
>> connection as whenever you ask for it you get the admin connection instead.
>>
>> -mark
>>
>

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


Re: Conditionally set defaultConnectionName

2014-11-02 Thread Joe Theuerkauf
Thanks for that tip, Mark. i don't plan to use defaultConnectionName in 
this scenario (as i did for the Captcha thread where the table i needed is 
in a different database). 

i can see where aliasing the connection will make it hard to access the 
original connection. Which is why i asked for some elaboration on how/where 
it's used. If it can be done during the request life cycle (i.e. 
Controllers), i could set the alias just for the Admin-level controllers, 
where they WILL need the elevated permissions. The general-level 
controllers would never see the alias (i think). But if the alias can't be 
used that way, maybe it's the wrong solution.

Is it possible/reasonable to use defaultConnectionName with some 
conditional logic to return which connection should be used?

public function defaultConnectionName() {
return $adminIsLoggedIn ? 'admin' : 'default';
}

If that's a reasonable approach, how can i determine $adminIsLoggedIn from 
inside the Table(s)? Maybe the whole question is clumsy and/or unnecessary 
to start with. :)

Thanks again.
-joe


On Sunday, 2 November 2014 06:48:30 UTC-5, mark_story wrote:
>
> If you alias connections you don't need to use defaultConnectionName(). 
> Aliasing the connection makes it much harder to access the regular default 
> connection as whenever you ask for it you get the admin connection instead.
>
> -mark
>

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


Re: Conditionally set defaultConnectionName

2014-11-01 Thread Joe Theuerkauf
Thanks for the idea José. Could you elaborate a little on usage? The API 
explains how it works, but i'm fuzzy on *where* to use it. Doesn't looks 
like it's mentioned in the Cookbook.

As a basic example, if i have these controllers:

*/App/Controller/AboutController*
- public Controller that connects to table "Parks" to produce info about 
the company's parks (locations, park maps, owner-entered blah-blah, etc.)
- Should only use the restricted *actual *"default" connection

*/App/Controller/Admin/AboutController*
- Admin-access controller where the "Parks" records are managed
- Needs the elevated "admin" connection for data changes.

i presume i would use the *alias* method somewhere in the Admin's 
AboutController (or a step up in the AdminController abstract the admin 
controllers inherit from), but how & where?

Thanks for your help.
-joe


On Friday, 31 October 2014 04:51:29 UTC-4, José Lorenzo wrote:
>
> The easiest way is to alias the connection:
>
> \Cake\Datasource\ConnectionManager::alias('default', 'admin');
>
> What it does is that, when a table is created instead of passing the 
> default connection it will pass the admin one.
>
> On Friday, October 31, 2014 1:42:42 AM UTC+1, Joe Theuerkauf wrote:
>>
>> Correct. When the Admin is logged in to that part of the site, the 
>> connection with the elevated account would be used for all requests so data 
>> edits can be performed. For the general user, the restricted connection 
>> would be used, where data edits aren't permitted (with limited exceptions 
>> granted to that db account). i don't want to mix data connections on a 
>> single request.
>>
>> Thanks.
>> -joe
>>
>>
>> On Thursday, 30 October 2014 04:10:35 UTC-4, José Lorenzo wrote:
>>>
>>> Let me see if I understood correctly: For certain admin actions you want 
>>> to use the admin connection instead of default for ALL tables used in that 
>>> request?
>>>
>>> On Thursday, October 30, 2014 4:25:30 AM UTC+1, Joe Theuerkauf wrote:
>>>>
>>>> i may be overthinking this - if so, tell me.
>>>>
>>>> i'd like to have a DB config for the general website user, who needs 
>>>> only SELECT for most things, and a separate config for the Admin side of 
>>>> the site where other privileges are needed.
>>>>
>>>> Since *defaultConnectionName* returns which config to use, is it 
>>>> possible to determine within that method which connection i need to return 
>>>> (Admin or basic) for the Table?
>>>>
>>>> My original thought was to somehow set the connection i need in the 
>>>> controllers, as i have an abstract AdminController that the Admin-level 
>>>> controllers inherit from. But i don't see any obvious reference to doing 
>>>> this in the documentation. So i thought a conditional return from 
>>>> *[Table]::defaultConnectionName* might work.
>>>>
>>>> If it's better just to use a single higher-privilege account for all 
>>>> purposes, so be it. Just thought i'd ask. :)
>>>>
>>>> Thanks.
>>>> -joe t.
>>>>
>>>

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


Re: Conditionally set defaultConnectionName

2014-10-30 Thread Joe Theuerkauf
Correct. When the Admin is logged in to that part of the site, the 
connection with the elevated account would be used for all requests so data 
edits can be performed. For the general user, the restricted connection 
would be used, where data edits aren't permitted (with limited exceptions 
granted to that db account). i don't want to mix data connections on a 
single request.

Thanks.
-joe


On Thursday, 30 October 2014 04:10:35 UTC-4, José Lorenzo wrote:
>
> Let me see if I understood correctly: For certain admin actions you want 
> to use the admin connection instead of default for ALL tables used in that 
> request?
>
> On Thursday, October 30, 2014 4:25:30 AM UTC+1, Joe Theuerkauf wrote:
>>
>> i may be overthinking this - if so, tell me.
>>
>> i'd like to have a DB config for the general website user, who needs only 
>> SELECT for most things, and a separate config for the Admin side of the 
>> site where other privileges are needed.
>>
>> Since *defaultConnectionName* returns which config to use, is it 
>> possible to determine within that method which connection i need to return 
>> (Admin or basic) for the Table?
>>
>> My original thought was to somehow set the connection i need in the 
>> controllers, as i have an abstract AdminController that the Admin-level 
>> controllers inherit from. But i don't see any obvious reference to doing 
>> this in the documentation. So i thought a conditional return from 
>> *[Table]::defaultConnectionName* might work.
>>
>> If it's better just to use a single higher-privilege account for all 
>> purposes, so be it. Just thought i'd ask. :)
>>
>> Thanks.
>> -joe t.
>>
>

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


Conditionally set defaultConnectionName

2014-10-29 Thread Joe Theuerkauf
i may be overthinking this - if so, tell me.

i'd like to have a DB config for the general website user, who needs only 
SELECT for most things, and a separate config for the Admin side of the 
site where other privileges are needed.

Since *defaultConnectionName* returns which config to use, is it possible 
to determine within that method which connection i need to return (Admin or 
basic) for the Table?

My original thought was to somehow set the connection i need in the 
controllers, as i have an abstract AdminController that the Admin-level 
controllers inherit from. But i don't see any obvious reference to doing 
this in the documentation. So i thought a conditional return from 
*[Table]::defaultConnectionName* might work.

If it's better just to use a single higher-privilege account for all 
purposes, so be it. Just thought i'd ask. :)

Thanks.
-joe t.

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


Re: Make Apache ignore actual directory for route?

2014-10-20 Thread Joe Theuerkauf
Okay, i've got Apache *mostly* behaving now... However, there's still a 
problem:

i had to rename /webroot/admin to /webroot/_admin so Apache wouldn't keep 
trying to load the directory instead of handing the path to mod_rewrite to 
get the application's route.

Now, however, i still have a problem with the /admin route. When i restart 
Apache and go to /admin, it redirects to /webroot/admin and gives a missing 
Controller error (it thinks WebrootController is missing). If i remove 
/webroot from the URL and try /admin again, it routes correctly: i get my 
login form.

What's happening on that first try? Can someone help? i know it sounds 
confusing to describe, but i'd be grateful for ideas.
-joe t.


On Sunday, 19 October 2014 00:45:35 UTC-4, Joe Theuerkauf wrote:
>
> Forewarning: i'm not great with Apache. Usually i can fumble my way 
> around, but it doesn't take much to throw me off.
>
> i've done all my development using Cake's built-in server, and things have 
> been mostly smooth. i'm now working toward migrating to a LAMP server 
> (testing locally in Windows), starting with figuring out what configuration 
> differences there will be. i need this to be a VirtualHost config. Cake's 
> server Just Works (TM), but Apache is giving me migraines.
>
> i have a set of Routes with prefix "admin", so anything from 
> /admin/whatever... is using /Controller/Admin/WhateverController. This Just 
> Works (TM) with the Cake server, but with Apache, it gives me various 
> errors, depending on config variations.
>
> Before getting much further into the TL of this DR, i think i've 
> discovered *part* of the problem: i have an actual /webroot/admin 
> directory where CSS/IMG/JS assets for the Admin section of the site are 
> held. There's no index.php there, just the resources. It *appears* Apache 
> is choking on this directory. If i create /webroot/contact, it chokes on 
> that as well. Without the directory, the /contact URL displays correctly. 
> The Cake server doesn't seem to care that i have either /webroot/admin or 
> /webroot/contact. So there must be something wrong in my Apache config, 
> but i can't seem to get the right setup.
>
> If that's enough to trigger some suggestions, great! PLEASE tell me what 
> stupid-simple thing i missed. If not, here's what i currently have...
>
>
> *1. Virtual Host config:*
> Define SITE_ROOT "C:/Sites/kodiakinvestmentsllc.com-cake3"
> ServerName kodiak.local
> 
> DocumentRoot   ${SITE_ROOT}
> DirectoryIndex index.php
>
> ErrorLog  ${SITE_ROOT}/tmp/logs/error.log
> CustomLog ${SITE_ROOT}/tmp/logs/debug.log combined
> 
> 
> AllowOverride All
> Order Allow,Deny
> 
> 
>
> *2. Routes*
> Router::scope('/', function(RouteBuilder $routes) {
> // Several routes defined here that work in Apache
> });
>
> Router::prefix('admin', function(RouteBuilder $routes){
> $routes->connect('/:controller', ['action' => 'index'], ['routeClass' 
> => 'InflectedRoute']);
> $routes->connect('/:controller/:action/*', [], ['routeClass' => 
> 'InflectedRoute']);
> $routes->connect('/login', ['controller' => 'Users', 'action' => 
> 'login']);
> $routes->connect('/logout', ['controller' => 'Users', 'action' => 
> 'logout']);
> $routes->connect('/', ['controller' => 'Admin', 'action' => 'index']);
> });
>
>
> *3. .htaccess**/.htaccess*
> 
> RewriteEngine On
> RewriteRule   ^$   webroot/   [L]
> RewriteRule   (.*) webroot/$1 [L]
> 
> 
> Header Set Access-Control-Allow-Origin "*"
> 
> AddType image/svg+xml .svg .svgz
>
> */webroot/.htaccess*
> 
> RewriteEngine On
> RewriteCond   %{REQUEST_FILENAME} !-d
> RewriteCond   %{REWRITE_FILENAME} !-f
> RewriteRule   ^ index.php [L]
> 
>
>
> *3. URLs*kodiak.local:8008/ : Works, shows Cake's system check page. (i 
> still have to work out a main index.)
> kodiak.local:8008/contact : Works, uses route defined above in the '/' 
> scope. Other routes similar to this also work, so i know mod_rewrite is 
> doing some part of its job.
> kodiak.local:8008/admin : Broken... 
>
>- It typically redirects to /webroot/admin and gives an error that 
>either i'm missing "WebrootController" (obviously wrong), or usually a 403 
>access forbidden t

Make Apache ignore actual directory for route?

2014-10-18 Thread Joe Theuerkauf
Forewarning: i'm not great with Apache. Usually i can fumble my way around, 
but it doesn't take much to throw me off.

i've done all my development using Cake's built-in server, and things have 
been mostly smooth. i'm now working toward migrating to a LAMP server 
(testing locally in Windows), starting with figuring out what configuration 
differences there will be. i need this to be a VirtualHost config. Cake's 
server Just Works (TM), but Apache is giving me migraines.

i have a set of Routes with prefix "admin", so anything from 
/admin/whatever... is using /Controller/Admin/WhateverController. This Just 
Works (TM) with the Cake server, but with Apache, it gives me various 
errors, depending on config variations.

Before getting much further into the TL of this DR, i think i've discovered 
*part* of the problem: i have an actual /webroot/admin directory where 
CSS/IMG/JS assets for the Admin section of the site are held. There's no 
index.php there, just the resources. It *appears* Apache is choking on this 
directory. If i create /webroot/contact, it chokes on that as well. Without 
the directory, the /contact URL displays correctly. The Cake server doesn't 
seem to care that i have either /webroot/admin or /webroot/contact. So 
there must be something wrong in my Apache config, but i can't seem to get 
the right setup.

If that's enough to trigger some suggestions, great! PLEASE tell me what 
stupid-simple thing i missed. If not, here's what i currently have...


*1. Virtual Host config:*
Define SITE_ROOT "C:/Sites/kodiakinvestmentsllc.com-cake3"
ServerName kodiak.local

DocumentRoot   ${SITE_ROOT}
DirectoryIndex index.php

ErrorLog  ${SITE_ROOT}/tmp/logs/error.log
CustomLog ${SITE_ROOT}/tmp/logs/debug.log combined


AllowOverride All
Order Allow,Deny



*2. Routes*
Router::scope('/', function(RouteBuilder $routes) {
// Several routes defined here that work in Apache
});

Router::prefix('admin', function(RouteBuilder $routes){
$routes->connect('/:controller', ['action' => 'index'], ['routeClass' 
=> 'InflectedRoute']);
$routes->connect('/:controller/:action/*', [], ['routeClass' => 
'InflectedRoute']);
$routes->connect('/login', ['controller' => 'Users', 'action' => 
'login']);
$routes->connect('/logout', ['controller' => 'Users', 'action' => 
'logout']);
$routes->connect('/', ['controller' => 'Admin', 'action' => 'index']);
});


*3. .htaccess**/.htaccess*

RewriteEngine On
RewriteRule   ^$   webroot/   [L]
RewriteRule   (.*) webroot/$1 [L]


Header Set Access-Control-Allow-Origin "*"

AddType image/svg+xml .svg .svgz

*/webroot/.htaccess*

RewriteEngine On
RewriteCond   %{REQUEST_FILENAME} !-d
RewriteCond   %{REWRITE_FILENAME} !-f
RewriteRule   ^ index.php [L]



*3. URLs*kodiak.local:8008/ : Works, shows Cake's system check page. (i 
still have to work out a main index.)
kodiak.local:8008/contact : Works, uses route defined above in the '/' 
scope. Other routes similar to this also work, so i know mod_rewrite is 
doing some part of its job.
kodiak.local:8008/admin : Broken... 

   - It typically redirects to /webroot/admin and gives an error that 
   either i'm missing "WebrootController" (obviously wrong), or usually a 403 
   access forbidden to /webroot/admin.
   - Cake's server correctly redirects to /admin/login and correctly lets 
   me log in and go to various /admin paths...
   

Let me know if more info is needed to figure out what i'm missing. i 
appreciate all the help i've gotten here. :)

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


Re: CakePHP 3.0.0-beta2 released

2014-10-05 Thread Joe Theuerkauf
Excellent work guys. It's been great following the progress of this new 
major release. For all the challenges & frustrations (of my own making), 
i'm glad i picked Cake as a learning experience. The framework & the team 
are awesome.
-Joe T.

On Sunday, 28 September 2014 09:49:02 UTC-4, José Lorenzo wrote:
>
> The CakePHP core team is proud to announce the second beta release for 
> CakePHP 
> 3.0.0 <https://github.com/cakephp/cakephp/releases/3.0.0-beta2>.
> It's been a month since our first beta release, and we are excited by the 
> big welcome the community has given to the new version. All the positive 
> feedback and help has been a great motivation for the core team to work 
> harder on improving the developer experience for 3.0.
>
> This will be the last beta release for 3.0, this means that the API is 
> already stabilizing and we're mostly focusing on polishing the current 
> features, performance optimizations, documentation and quickly solving any 
> issues reported in Github.
>
> We've had a very busy month implementing a few missing features we had in 
> our roadmap and upgrading some of the popular plugins for CakePHP.
>
> Below the list of new features and changes that made it into 3.0.0-beta2:
> DebugKit 
>
> Debugging CakePHP 3.0 applications is even better. The new DebugKit is 
> easier to install, faster and looks gorgeous.
>
> DebugKit is a application toolbar that collects useful statistics about 
> your code such as time and memory, executed queries, log messages and view 
> variables. To install Debugkit just use
>
> composer require cakephp/debug_kit "3.0.*-dev"
>
> And add this line to your bootstrap.php file:
>
> Plugin::load('DebugKit', ['bootstrap' => true]);
>
> If you install a new application using the app skeleton 
> <https://github.com/cakephp/app>, DebugKit will be automatically 
> installed for you.
> Database Migrations 
>
> Migrations <https://github.com/cakephp/collection> is now an official 
> CakePHP plugin. It wraps the excellent Phinx <http://phinx.org/> library 
> into a CakePHP shell to avoid repeating configuration strings and add some 
> of the cake experience. A database migration generated by this plugin would 
> look like:
>
>  AbstractMigration {
> /** * Change. */
> public function change() {
> // create the table
> $table = $this->table('users');
> $table->addColumn('id', 'integer')
> ->addColumn('username', 'string')
> ->addColumn('password', 'string')
> ->addColumn('created', 'datetime')
> ->create();
> }
>
> Migrations are reversible. This means that with the same code you can 
> create or rollback the changes done to the database schema.
>
> To install the Migrations plugins run:
>
> composer require cakephp/migrations "dev-master"
>
> And add this line to your bootstrap.php file:
>
> Plugin::load('Migrations');
>
> New Logger interface 
>
> CakePHP has adopted the PSR-3 recommendation for loggers. Now all log 
> engines implement the Prs\Log\LoggerInterface interface. This means that 
> the entire logging system can easily be replaced by other implementations, 
> such as the popular Monolog library <https://github.com/Seldaek/monolog>.
> Integration Tests and Data Integrity 
>
> Testing controllers has always been problematic. While ControllerTestCase 
> solved some of the problems, we identified this class as a source of 
> problems and confusion among our users. We decided to implement the new 
> IntegrationTestCase class as a way totest all aspects of an HTTP request 
> in your application without much mocking being involved. This should help 
> you improve code quality and ensure that your application and routes are 
> working as expected.
>
> We also made the fixtures system better, allowing developers to define and 
> work with foreign key constraints in their database. The fixtures system 
> will now correctly load all data and enable constraints right before your 
> test code is executed.
> New Bake templates 
>
> With the date for a stable release getting closer and closer we decided to 
> give a new look to default baked applications. Hopefully the new look will 
> feel fresher, more modern, and easier to work with.
> Separate packages 
>
> We've seen an increasing interest in using the new ORM outside the 
> framework or within older CakePHP applications. One of our goals since the 
> start has been making this possible. We 

Re: 3.0: Entity get/set mutators

2014-09-22 Thread Joe Theuerkauf
That did the trick. Small correction: _getActiveStatus worked for me in the 
Entity class, _activeStatus didn't display anything.

Thank you!
-joe


On Monday, 22 September 2014 04:42:23 UTC-4, José Lorenzo wrote:
>
> Don't use accessors for formatting your columns to be displayed in the 
> view. The accessors are meant to get the data as it should be saved in the 
> database. You can use instead a virtual field such as active_status:
>
> protected function _activeStatus() {
>  return $this->active ? 'Active' : 'Inactive';
> }
>
> echo $entity->active_status;
>
> On Sunday, September 21, 2014 11:45:33 PM UTC+2, Joe Theuerkauf wrote:
>>
>> i have several tables with an `active` column, and the Admin should be 
>> able to de/activate records to determine whether they & related records are 
>> available in the application.
>>
>> Instead of constantly converting T/F or 1/0 to "Active"/"Inactive", i 
>> wrote an Entity getter:
>>
>> protected function _getActive($active) {
>> return $active ? 'Active' : 'Inactive';
>> }
>>
>> That's been working pretty well. The Entity->active property always 
>> provides the string.
>>
>> The problem is updating the data:
>>
>> SomeTableController gets a request like */some_table/active/2/1* to set 
>> ID 2 "active" (1):
>>
>> public function active($id, $active) {
>> $entity = $this->SomeTable->get($id);
>> $entity->active = $active;
>>
>> if ($this->SomeTable->save($entity)) {
>> // Success!
>> }
>> else {
>> // Fail!
>> }
>> }
>>
>> The problem: save() reports a successful save, but the database isn't 
>> updated. Scratch that: the `modified` column is updated, but not the 
>> `active` flag.
>>
>> If i kill _getActive() the update works, but i lose the convenience of 
>> the string representation.
>>
>> My *guess* is, i need a setter to handle the switch, but i'm not sure 
>> exactly how they work. The documentation (
>> http://book.cakephp.org/3.0/en/orm/entities.html#Cake\ORM\Entity::set) 
>> for set mutators shows an example of setting some *other* entity 
>> property ('slug') using the 'title' property. But there's no example for 
>> mutating the property being called, and i don't know if that even makes 
>> sense...
>>
>> Along with no _setActive mutator, i also tried the following:
>>
>> protected function _setActive($active) {
>> // $this->set('active', $active); <-- Created loop condition & fatal 
>> error.
>>
>> $this->_properties['active'] = $active;
>> return $active;
>> }
>>
>> No luck. It does the same as no setter: updates the entity (with updated 
>> active & modified properties), but save() doesn't write the changed 
>> active property to the database.
>>
>> Any help? Thanks.
>> -joe t.
>>
>>

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


3.0: Entity get/set mutators

2014-09-21 Thread Joe Theuerkauf
i have several tables with an `active` column, and the Admin should be able 
to de/activate records to determine whether they & related records are 
available in the application.

Instead of constantly converting T/F or 1/0 to "Active"/"Inactive", i wrote 
an Entity getter:

protected function _getActive($active) {
return $active ? 'Active' : 'Inactive';
}

That's been working pretty well. The Entity->active property always 
provides the string.

The problem is updating the data:

SomeTableController gets a request like */some_table/active/2/1* to set ID 
2 "active" (1):

public function active($id, $active) {
$entity = $this->SomeTable->get($id);
$entity->active = $active;

if ($this->SomeTable->save($entity)) {
// Success!
}
else {
// Fail!
}
}

The problem: save() reports a successful save, but the database isn't 
updated. Scratch that: the `modified` column is updated, but not the 
`active` flag.

If i kill _getActive() the update works, but i lose the convenience of the 
string representation.

My *guess* is, i need a setter to handle the switch, but i'm not sure 
exactly how they work. The documentation 
(http://book.cakephp.org/3.0/en/orm/entities.html#Cake\ORM\Entity::set) for 
set mutators shows an example of setting some *other* entity property 
('slug') using the 'title' property. But there's no example for mutating 
the property being called, and i don't know if that even makes sense...

Along with no _setActive mutator, i also tried the following:

protected function _setActive($active) {
// $this->set('active', $active); <-- Created loop condition & fatal 
error.

$this->_properties['active'] = $active;
return $active;
}

No luck. It does the same as no setter: updates the entity (with updated 
active & modified properties), but save() doesn't write the changed active 
property to the database.

Any help? Thanks.
-joe t.

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


Re: DebugKit 3.0 installation

2014-09-10 Thread Joe Theuerkauf
Agreed. Things are running more smoothly now. Composer is current, config 
seems to be working. i just needed to clear up the two plugin directories, 
which you responded to above.

Thank you!
-joe


On Wednesday, 10 September 2014 09:49:37 UTC-4, José Lorenzo wrote:
>
> The best way is to install with composer
>
> On Wednesday, September 10, 2014 11:13:56 AM UTC+2, Bprd Codin wrote:
>>
>> Hi,
>>
>> the best way is to install it manually ?? 
>>
>> for me under linux it's working  probably your composer is not update ?
>>
>> codeindev
>>
>> Le jeudi 4 septembre 2014 07:13:31 UTC+2, Joe Theuerkauf a écrit :
>>>
>>> Dumb question # 3,582,697:
>>>
>>> Why is composer installing DebugKit (3.0.*-dev) to /plugins rather than 
>>> /Plugin?
>>>
>>> When i follow the idiot-simple (and i should know!) instructions for the 
>>> DK3 branch, i end up with this:
>>>
>>> *Fatal error*:  Uncaught exception 
>>> 'Cake\Core\Exception\MissingPluginException' with message 'Plugin DebugKit 
>>> could not be found.' 
>>>   in 
>>> C:\Sites\kodiakinvestmentsllc.com-cake3\vendor\cakephp\cakephp\src\Core\Plugin.php:140Stack
>>>  trace:#0 
>>> C:\Sites\kodiakinvestmentsllc.com-cake3\App\Config\bootstrap.php(99): 
>>> Cake\Core\Plugin::load('DebugKit', Array)#1 
>>> C:\Sites\kodiakinvestmentsllc.com-cake3\webroot\index.php(27): 
>>> require('C:\\Sites\\kodiak...')#2 {main}  thrown in 
>>> C:\Sites\kodiakinvestmentsllc.com-cake3\vendor\cakephp\cakephp\src\Core\Plugin.php
>>>  on line 140
>>>
>>>
>>> To me that looks like Cake is trying to load plugins exclusively from 
>>> /Plugin.
>>>
>>> i know the 3.0 work is just getting underway now that Cake 3 beta is 
>>> out. i'm sure this is something simple i'm missing. i gotta stop trying to 
>>> be productive at 1am.
>>>
>>> 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/d/optout.


Re: DebugKit 3.0 installation

2014-09-09 Thread Joe Theuerkauf
Thanks for responding.

i also had to add *"minimum-stability":"dev"* to composer.json, but that 
appears to be a recent change in composer to permit dev packages in the 
"production" require section.
"minimum-stability" default is now "stable": 
https://getcomposer.org/doc/04-schema.md#minimum-stability

After digging STILL FURTHER, i found the trouble.

In Config/app.php inside the "App" array, there's an array called "paths". 
There's a path key called "plugins". Mine *WAS* set to "Plugin". Because of 
this, a plugin i developed was loading just fine (it was in that 
directory). However, since DebugKit installs to plugins/ it was failing.

In Core\Plugin, a check is made for *$config['path']* in case you've placed 
your plugin somewhere outside the app.php *App.paths.plugins* value.
When there's no path in the load() config, it falls back to the 
*App.paths.plugins* setting.

i don't know how there came to be two "plugins" paths in my project (Plugin/ 
& plugins/), but since Composer-installed plugins are going to plugins/, i 
moved my personal ones there, too, and set *App.paths.plugins* => *ROOT . 
'/plugins/'*.

Now everything loads.

So. TWO LAST QUESTIONS for the devs (if they care to respond):?

   1. Is Plugin/ supposed to exist? i don't recall creating it.
   2. Aside from specifying an off-the-beaten 'path' key when calling 
   Plugin::load, is there another way to handle these multiple plugins 
   paths, or is it wiser just to remove Plugin/?
   
Thanks. i like the learning process, i just wish i could get back the time 
spent figuring it out so i can use it to get actual work done. :-)
-joe


On Tuesday, 9 September 2014 23:14:55 UTC-4, Dr. Tarique Sani wrote:
>
> Must be a Windows thing. 
>
> FWIW I had to add 
>
> "minimum-stability" : "dev",
> "prefer-stable": true
>
> To composer.json to make it install as per instructions on Github but that 
> is to be expected...
>
> T
>
>
> On Wed, Sep 10, 2014 at 6:40 AM, Joe Theuerkauf  > wrote:
>
>> Well, more digging around on my own & i got DebugKit to run. However, the 
>> config is pretty different from the Github instructions (
>> https://github.com/cakephp/debug_kit/tree/3.0).
>>
>> i don't know how other people have DK running without special settings, 
>> but with the default instructions, i consistently get this 
>>
>>
>> *C:\Sites\[project]>App\Console\cake server -p 8765*
>> PHP Fatal error:  Uncaught exception 
>> 'Cake\Core\Exception\MissingPluginException' with message 'Plugin DebugKit 
>> could not be found.' in 
>> C:\Sites\[project]\vendor\cakephp\cakephp\src\Core\Plugin.php:140
>> Stack trace:
>> #0 C:\Sites\[project]\App\Config\bootstrap.php(99): 
>> Cake\Core\Plugin::load('DebugKit', Array)
>> #1 C:\Sites\[project]\App\Console\cake.php(18): 
>> include('C:\\Sites\\kodiak...')
>> #2 {main}
>>   thrown in C:\Sites\[project]\vendor\cakephp\cakephp\src\Core\Plugin.php 
>> on line 140
>>
>> Fatal error: Uncaught exception 
>> 'Cake\Core\Exception\MissingPluginException' with message 'Plugin DebugKit 
>> could not be found.' in 
>> C:\Sites\[project]\vendor\cakephp\cakephp\src\Core\Plugin.php:140
>> Stack trace:
>> #0 C:\Sites\[project]\App\Config\bootstrap.php(99): 
>> Cake\Core\Plugin::load('DebugKit', Array)
>> #1 C:\Sites\[project]\App\Console\cake.php(18): 
>> include('C:\\Sites\\kodiak...')
>> #2 {main}
>>   thrown in C:\Sites\[project]\vendor\cakephp\cakephp\src\Core\Plugin.php 
>> on line 140
>>
>> After looking more closely at Core\Plugin.php, it's apparently because it 
>> can't find DebugKit in the default directory (*Plugin*) and there's no 
>> accompanying *'path'* key in *$config*.
>>
>> A few more attempts, and i got the application to launch with DK running:
>>
>> Plugin::load('DebugKit', [
>> 'bootstrap' => true, // per the instructions
>> 'path' => 'plugins/DebugKit/' // yes, the whole path with trailing / 
>> was necessary
>> ]);
>>
>> i'm glad i got it to work, but the question remains: why doesn't the 
>> typical setup work? Any suggestions what i should look for to see if i'm 
>> doing something peculiar?
>>
>> Thanks.
>> -joe
>>
>>
>>
>> On Friday, 5 September 2014 03:49:39 UTC-4, José Lorenzo wrote:
>>>
>>> Looks good! DebugK

Re: DebugKit 3.0 installation

2014-09-09 Thread Joe Theuerkauf
Well, more digging around on my own & i got DebugKit to run. However, the 
config is pretty different from the Github instructions 
(https://github.com/cakephp/debug_kit/tree/3.0).

i don't know how other people have DK running without special settings, but 
with the default instructions, i consistently get this 


*C:\Sites\[project]>App\Console\cake server -p 8765*
PHP Fatal error:  Uncaught exception 
'Cake\Core\Exception\MissingPluginException' with message 'Plugin DebugKit 
could not be found.' in 
C:\Sites\[project]\vendor\cakephp\cakephp\src\Core\Plugin.php:140
Stack trace:
#0 C:\Sites\[project]\App\Config\bootstrap.php(99): 
Cake\Core\Plugin::load('DebugKit', Array)
#1 C:\Sites\[project]\App\Console\cake.php(18): 
include('C:\\Sites\\kodiak...')
#2 {main}
  thrown in C:\Sites\[project]\vendor\cakephp\cakephp\src\Core\Plugin.php 
on line 140

Fatal error: Uncaught exception 
'Cake\Core\Exception\MissingPluginException' with message 'Plugin DebugKit 
could not be found.' in 
C:\Sites\[project]\vendor\cakephp\cakephp\src\Core\Plugin.php:140
Stack trace:
#0 C:\Sites\[project]\App\Config\bootstrap.php(99): 
Cake\Core\Plugin::load('DebugKit', Array)
#1 C:\Sites\[project]\App\Console\cake.php(18): 
include('C:\\Sites\\kodiak...')
#2 {main}
  thrown in C:\Sites\[project]\vendor\cakephp\cakephp\src\Core\Plugin.php 
on line 140

After looking more closely at Core\Plugin.php, it's apparently because it 
can't find DebugKit in the default directory (*Plugin*) and there's no 
accompanying *'path'* key in *$config*.

A few more attempts, and i got the application to launch with DK running:

Plugin::load('DebugKit', [
'bootstrap' => true, // per the instructions
'path' => 'plugins/DebugKit/' // yes, the whole path with trailing / 
was necessary
]);

i'm glad i got it to work, but the question remains: why doesn't the 
typical setup work? Any suggestions what i should look for to see if i'm 
doing something peculiar?

Thanks.
-joe


On Friday, 5 September 2014 03:49:39 UTC-4, José Lorenzo wrote:
>
> Looks good! DebugKit is supposed to get installed inside plugins/
>
> On Friday, September 5, 2014 1:46:45 AM UTC+2, Joe Theuerkauf wrote:
>>
>> i junked everything inside */vendor*. Empty directory.
>>
>> *composer install*
>>
>> Everything installed cleanly.
>>
>> DebugKit is in /plugins Here are the clone hashes composer listed:
>>
>>   - Installing cakephp/plugin-installer (dev-master 2f1a842)
>> Cloning 2f1a84253e216edd4462724aaca822bdda36dfdf
>>
>>   - Installing cakephp/cakephp (3.0.x-dev b35cc28)
>> Cloning b35cc28793a5e6a6f8f730fd03c4368d7aa0fdb5
>>
>>   - Installing cakephp/debug_kit (3.0.x-dev 0dde466)
>> Cloning 0dde4663d9df811b2b8660c05a72c29b903386c3
>>
>> So, any ideas? :)
>> -joe
>>
>>
>> On Thursday, 4 September 2014 19:31:43 UTC-4, Joe Theuerkauf wrote:
>>>
>>> i thought i did, but in the past, updates meant deleting 
>>> */vendor/cakephp* then running *composer update* to get the newest repo.
>>>
>>> So i attempted that again. With no /vendor/cakephp (and also deleted 
>>> */plugins/DebugKit*) i get this:
>>>
>>> C:\Sites\kodiak.com-cake3>composer update
>>> PHP Fatal error:  Class 'Cake\Composer\Installer\PluginInstaller' not 
>>> found in 
>>> phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Plugin/PluginManager.php
>>>  
>>> on line 235
>>>
>>> Fatal error: Class 'Cake\Composer\Installer\PluginInstaller' not found 
>>> in 
>>> phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Plugin/PluginManager.php
>>>  
>>> on line 235
>>>
>>> Oookaaayyy, now it needs Cake in order to update Cake?
>>>
>>> So i restored */vendor/cakephp*. Now DebugKit installs, but to 
>>> */plugins*.
>>> Also, it appeared to want to update the Cake library, but this happened:
>>>
>>>   - Updating cakephp/cakephp 3.0.x-dev (0368cbd => b00de78)
>>>
>>>   [RuntimeException]
>>>   The .git directory is missing from 
>>> C:\Sites\kodiakinvestmentsllc.com-cake3\vendor\cakephp\cakephp, see 
>>> http://getcomposer.org/commit-deps for more information
>>>
>>> update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] 
>>> [--lock] [--no-plugins] [--no-custom-installers] [--no-scripts] 
>>> [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] 
>>> [-o|--optimize-aut

Re: DebugKit 3.0 installation

2014-09-05 Thread Joe Theuerkauf
If that's where it's supposed to install, why do i get the error from my 
original post? i can't start the application if i try to load DebugKit. What 
other info can i put up to help diagnose this?

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


Re: DebugKit 3.0 installation

2014-09-04 Thread Joe Theuerkauf
i junked everything inside */vendor*. Empty directory.

*composer install*

Everything installed cleanly.

DebugKit is in /plugins Here are the clone hashes composer listed:

  - Installing cakephp/plugin-installer (dev-master 2f1a842)
Cloning 2f1a84253e216edd4462724aaca822bdda36dfdf

  - Installing cakephp/cakephp (3.0.x-dev b35cc28)
Cloning b35cc28793a5e6a6f8f730fd03c4368d7aa0fdb5

  - Installing cakephp/debug_kit (3.0.x-dev 0dde466)
Cloning 0dde4663d9df811b2b8660c05a72c29b903386c3

So, any ideas? :)
-joe


On Thursday, 4 September 2014 19:31:43 UTC-4, Joe Theuerkauf wrote:
>
> i thought i did, but in the past, updates meant deleting */vendor/cakephp* 
> then running *composer update* to get the newest repo.
>
> So i attempted that again. With no /vendor/cakephp (and also deleted 
> */plugins/DebugKit*) i get this:
>
> C:\Sites\kodiak.com-cake3>composer update
> PHP Fatal error:  Class 'Cake\Composer\Installer\PluginInstaller' not 
> found in 
> phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Plugin/PluginManager.php
>  
> on line 235
>
> Fatal error: Class 'Cake\Composer\Installer\PluginInstaller' not found in 
> phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Plugin/PluginManager.php
>  
> on line 235
>
> Oookaaayyy, now it needs Cake in order to update Cake?
>
> So i restored */vendor/cakephp*. Now DebugKit installs, but to */plugins*.
> Also, it appeared to want to update the Cake library, but this happened:
>
>   - Updating cakephp/cakephp 3.0.x-dev (0368cbd => b00de78)
>
>   [RuntimeException]
>   The .git directory is missing from 
> C:\Sites\kodiakinvestmentsllc.com-cake3\vendor\cakephp\cakephp, see 
> http://getcomposer.org/commit-deps for more information
>
> update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] 
> [--lock] [--no-plugins] [--no-custom-installers] [--no-scripts] 
> [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] 
> [-o|--optimize-autoloader] [packages1] ... [packagesN]
>
> As of now i have */vendor/cakephp/cakephp* (with no *.git* directory), 
> and that's it. No /plugins/DebugKit & no 
> */vendor/cakephp/plugin-installer* (that originally installed with 
> DebugKit).
>
> When i try *composer update* now, i get the missing Class error from 
> above.
>
> i know it's something i did wrong, but after you're done smacking your 
> head on the desk, some help to repair this stuff would be greatly 
> appreciated. :-)
> -joe
>
>
> On Thursday, 4 September 2014 03:18:15 UTC-4, José Lorenzo wrote:
>>
>> Do you have the latest cakephp 3 code? Debugkit is installing fine for me
>>
>> On Thursday, September 4, 2014 7:13:31 AM UTC+2, Joe Theuerkauf wrote:
>>>
>>> Dumb question # 3,582,697:
>>>
>>> Why is composer installing DebugKit (3.0.*-dev) to /plugins rather than 
>>> /Plugin?
>>>
>>> When i follow the idiot-simple (and i should know!) instructions for the 
>>> DK3 branch, i end up with this:
>>>
>>> *Fatal error*:  Uncaught exception 
>>> 'Cake\Core\Exception\MissingPluginException' with message 'Plugin DebugKit 
>>> could not be found.' 
>>>   in 
>>> C:\Sites\kodiakinvestmentsllc.com-cake3\vendor\cakephp\cakephp\src\Core\Plugin.php:140Stack
>>>  trace:#0 
>>> C:\Sites\kodiakinvestmentsllc.com-cake3\App\Config\bootstrap.php(99): 
>>> Cake\Core\Plugin::load('DebugKit', Array)#1 
>>> C:\Sites\kodiakinvestmentsllc.com-cake3\webroot\index.php(27): 
>>> require('C:\\Sites\\kodiak...')#2 {main}  thrown in 
>>> C:\Sites\kodiakinvestmentsllc.com-cake3\vendor\cakephp\cakephp\src\Core\Plugin.php
>>>  on line 140
>>>
>>>
>>> To me that looks like Cake is trying to load plugins exclusively from 
>>> /Plugin.
>>>
>>> i know the 3.0 work is just getting underway now that Cake 3 beta is 
>>> out. i'm sure this is something simple i'm missing. i gotta stop trying to 
>>> be productive at 1am.
>>>
>>> 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/d/optout.


Re: DebugKit 3.0 installation

2014-09-04 Thread Joe Theuerkauf
i thought i did, but in the past, updates meant deleting */vendor/cakephp* 
then running *composer update* to get the newest repo.

So i attempted that again. With no /vendor/cakephp (and also deleted 
*/plugins/DebugKit*) i get this:

C:\Sites\kodiak.com-cake3>composer update
PHP Fatal error:  Class 'Cake\Composer\Installer\PluginInstaller' not found 
in 
phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Plugin/PluginManager.php
 
on line 235

Fatal error: Class 'Cake\Composer\Installer\PluginInstaller' not found in 
phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Plugin/PluginManager.php
 
on line 235

Oookaaayyy, now it needs Cake in order to update Cake?

So i restored */vendor/cakephp*. Now DebugKit installs, but to */plugins*.
Also, it appeared to want to update the Cake library, but this happened:

  - Updating cakephp/cakephp 3.0.x-dev (0368cbd => b00de78)

  [RuntimeException]
  The .git directory is missing from 
C:\Sites\kodiakinvestmentsllc.com-cake3\vendor\cakephp\cakephp, see 
http://getcomposer.org/commit-deps for more information

update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] 
[--lock] [--no-plugins] [--no-custom-installers] [--no-scripts] 
[--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] 
[-o|--optimize-autoloader] [packages1] ... [packagesN]

As of now i have */vendor/cakephp/cakephp* (with no *.git* directory), and 
that's it. No /plugins/DebugKit & no */vendor/cakephp/plugin-installer* 
(that originally installed with DebugKit).

When i try *composer update* now, i get the missing Class error from above.

i know it's something i did wrong, but after you're done smacking your head 
on the desk, some help to repair this stuff would be greatly appreciated. 
:-)
-joe


On Thursday, 4 September 2014 03:18:15 UTC-4, José Lorenzo wrote:
>
> Do you have the latest cakephp 3 code? Debugkit is installing fine for me
>
> On Thursday, September 4, 2014 7:13:31 AM UTC+2, Joe Theuerkauf wrote:
>>
>> Dumb question # 3,582,697:
>>
>> Why is composer installing DebugKit (3.0.*-dev) to /plugins rather than 
>> /Plugin?
>>
>> When i follow the idiot-simple (and i should know!) instructions for the 
>> DK3 branch, i end up with this:
>>
>> *Fatal error*:  Uncaught exception 
>> 'Cake\Core\Exception\MissingPluginException' with message 'Plugin DebugKit 
>> could not be found.' 
>>   in 
>> C:\Sites\kodiakinvestmentsllc.com-cake3\vendor\cakephp\cakephp\src\Core\Plugin.php:140Stack
>>  trace:#0 
>> C:\Sites\kodiakinvestmentsllc.com-cake3\App\Config\bootstrap.php(99): 
>> Cake\Core\Plugin::load('DebugKit', Array)#1 
>> C:\Sites\kodiakinvestmentsllc.com-cake3\webroot\index.php(27): 
>> require('C:\\Sites\\kodiak...')#2 {main}  thrown in 
>> C:\Sites\kodiakinvestmentsllc.com-cake3\vendor\cakephp\cakephp\src\Core\Plugin.php
>>  on line 140
>>
>>
>> To me that looks like Cake is trying to load plugins exclusively from 
>> /Plugin.
>>
>> i know the 3.0 work is just getting underway now that Cake 3 beta is out. 
>> i'm sure this is something simple i'm missing. i gotta stop trying to be 
>> productive at 1am.
>>
>> 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/d/optout.


DebugKit 3.0 installation

2014-09-03 Thread Joe Theuerkauf
Dumb question # 3,582,697:

Why is composer installing DebugKit (3.0.*-dev) to /plugins rather than 
/Plugin?

When i follow the idiot-simple (and i should know!) instructions for the 
DK3 branch, i end up with this:

*Fatal error*:  Uncaught exception 'Cake\Core\Exception\MissingPluginException' 
with message 'Plugin DebugKit could not be found.' 
  in 
C:\Sites\kodiakinvestmentsllc.com-cake3\vendor\cakephp\cakephp\src\Core\Plugin.php:140Stack
 trace:#0 C:\Sites\kodiakinvestmentsllc.com-cake3\App\Config\bootstrap.php(99): 
Cake\Core\Plugin::load('DebugKit', Array)#1 
C:\Sites\kodiakinvestmentsllc.com-cake3\webroot\index.php(27): 
require('C:\\Sites\\kodiak...')#2 {main}  thrown in 
C:\Sites\kodiakinvestmentsllc.com-cake3\vendor\cakephp\cakephp\src\Core\Plugin.php
 on line 140


To me that looks like Cake is trying to load plugins exclusively from 
/Plugin.

i know the 3.0 work is just getting underway now that Cake 3 beta is out. 
i'm sure this is something simple i'm missing. i gotta stop trying to be 
productive at 1am.

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/d/optout.


Re: 3.0.x - defaultConnectionName not working in Plugin

2014-08-31 Thread Joe Theuerkauf
Okay, i think i'm finally on the right track.

As i noted, going to [host]/captchas was giving a Controller-not-found 
error. i realize now it's because the route connecting '/captchas' required 
an action to match... Oops. After trying the full URL that the Captcha 
validator uses, i got a JSON response, but it was a 500 error, the database 
was still trying to find the table *kodiak.captchas*. Changed 
*TableRegistry::get('Captchas')* to 
*TableRegistry::get('Thook/Websites.Captchas')* and got a JSON response i 
expected.

i know most of this is considered basic stuff, so i appreciate the patience 
in trying to help me. At least i'm trying to figure it out on my own while 
i wait for help, right? :)
-joe



On Saturday, 30 August 2014 12:28:50 UTC-4, Joe Theuerkauf wrote:
>
> @José: Here's what i'm using that works on the Contact page where i need 
> to load the Captchas model to grab a question:
>
> Works:
> Plugin::loadAll([
> [
> 'Thook/Websites' => ['routes' => true]
> ]
> ]);
>
> Also works:
> Plugin::load('Thook/Websites');
>
> Doesn't work:
> Plugin::load('Thook/Websites', ['routes' => true]);
>
> Results in ([...] shortening the path to relevant stuff):
>
> *Warning* (2): include([...]/Plugin/Thook\Websites\config\routes.php): failed 
> to open stream: No such file or directory 
> [*ROOT\vendor\cakephp\cakephp\src\Core\Plugin.php*, line *346*]
>
> *Warning* (2): include() [function.include]: Failed opening 
> '[...]/Plugin/Thook\Websites\config\routes.php' for inclusion 
> (include_path='.;C:\WebServer\php5\pear\pear') 
> [*ROOT\vendor\cakephp\cakephp\src\Core\Plugin.php*, line *346*]
>
>
> However, the file path it's trying to include IS valid (aside from 
> directory separators).
>
> ---
>
> @mark
> In my primary routes file:
>
> Router::scope('/', function(RouteBuilder $routes) {
> // Some routes linking to main App Controllers, working.
>
> // Per your response:
>
>
>
>
> *$routes->connect('/captchas/:action/*', ['plugin' => 
> 'Thook/Websites','controller' => 'captchas' // Also tried 
> 'Captchas', but the other routes' controller values are lower-case & 
> working]);*
> $routes->connect(':controller', ['action' => 'index], ['routeClass' => 
> 'InflectedRoute']);
>
> $routes->connect('/:controller/:action/*', [], ['routeClass' => 
> 'InflectedRoute']);
>
> // This will be dropped for production. ;)
> $routes->connect('/', [
> 'controller' => 'pages',
> 'action' => 'display',
> 'home'
> ]);
> });
>
> Still receiving Controller not found when i go directly to 
> *[host]/captchas*:
> Missing Controller
>
> *Error: * *CaptchasController* could not be found.
>
> *Error: * Create the class *CaptchasController* below in file: 
> App\Controller\CaptchasController.php
>
>  namespace App\Controller;
>
> use App\Controller\AppController;
>
> class CaptchasController extends AppController {
>
> }
>
>
> Thanks a lot guys, for taking a look at this with me.
> -joe
>
>
> On Saturday, 30 August 2014 08:33:57 UTC-4, mark_story wrote:
>>
>> If Router::plugin() isn't getting you the routes you want, you can 
>> combine scope() and connect () to create the exact routes you want. Just 
>> keep in mind that all the routing data that doesn't change should be in the 
>> defaults list. For example
>>
>> $routes->connect('/captchas/:action/*', ['plugin' => 
>> 'Thook/Websites','controller' => 'Captchas']);
>>
>> Would let you connect all the actions on the CaptchasController in your 
>> plugin.
>>
>> -mark
>>
>>
>

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


Re: 3.0.x - defaultConnectionName not working in Plugin

2014-08-30 Thread Joe Theuerkauf
@José: Here's what i'm using that works on the Contact page where i need to 
load the Captchas model to grab a question:

Works:
Plugin::loadAll([
[
'Thook/Websites' => ['routes' => true]
]
]);

Also works:
Plugin::load('Thook/Websites');

Doesn't work:
Plugin::load('Thook/Websites', ['routes' => true]);

Results in ([...] shortening the path to relevant stuff):

*Warning* (2): include([...]/Plugin/Thook\Websites\config\routes.php): failed 
to open stream: No such file or directory 
[*ROOT\vendor\cakephp\cakephp\src\Core\Plugin.php*, line *346*]

*Warning* (2): include() [function.include]: Failed opening 
'[...]/Plugin/Thook\Websites\config\routes.php' for inclusion 
(include_path='.;C:\WebServer\php5\pear\pear') 
[*ROOT\vendor\cakephp\cakephp\src\Core\Plugin.php*, line *346*]


However, the file path it's trying to include IS valid (aside from 
directory separators).

---

@mark
In my primary routes file:

Router::scope('/', function(RouteBuilder $routes) {
// Some routes linking to main App Controllers, working.

// Per your response:




*$routes->connect('/captchas/:action/*', ['plugin' => 
'Thook/Websites','controller' => 'captchas' // Also tried 
'Captchas', but the other routes' controller values are lower-case & 
working]);*
$routes->connect(':controller', ['action' => 'index], ['routeClass' => 
'InflectedRoute']);

$routes->connect('/:controller/:action/*', [], ['routeClass' => 
'InflectedRoute']);

// This will be dropped for production. ;)
$routes->connect('/', [
'controller' => 'pages',
'action' => 'display',
'home'
]);
});

Still receiving Controller not found when i go directly to *[host]/captchas*
:
Missing Controller

*Error: * *CaptchasController* could not be found.

*Error: * Create the class *CaptchasController* below in file: 
App\Controller\CaptchasController.php


> If Router::plugin() isn't getting you the routes you want, you can combine 
> scope() and connect () to create the exact routes you want. Just keep in 
> mind that all the routing data that doesn't change should be in the 
> defaults list. For example
>
> $routes->connect('/captchas/:action/*', ['plugin' => 
> 'Thook/Websites','controller' => 'Captchas']);
>
> Would let you connect all the actions on the CaptchasController in your 
> plugin.
>
> -mark
>
>

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


Re: 3.0.x - defaultConnectionName not working in Plugin

2014-08-29 Thread Joe Theuerkauf
*sigh* i guess i still need help here, but with the routing, not the DB 
connection.

i want to preserve the original way i was accessing my general-purpose 
Controller: /captchas/whatever.

i'm generally confused by routing, but AM reading the docs trying to figure 
it out. i know i *don't* want to use /thook/websites/captchas to get to 
this Controller. It's just a validation AJAX call, and besides, having the 
extra path segments in there feels awkward to me.

Trying to follow these:
http://book.cakephp.org/3.0/en/plugins.html#plugin-configuration
http://book.cakephp.org/3.0/en/plugins.html#plugin-controllers
http://book.cakephp.org/3.0/en/development/routing.html#plugin-routing

i've enabled the plugin's 'routes' option in *bootstrap.php* 
Plugin::loadAll() and i have this in my *plugin*'s *routes.php*:
Route::plugin('Thook/Websites', function($routes) {
$routes->fallbacks();
});

i also tried adding this to the *App/Config/routes.php*:
Routes::scope('/', function($routes) {
// ... other routes
$routes->connect('/captchas', ['plugin' => 'Thook/Websites']);
// ... some other routes
});

i'm unable to get the message described in the docs (Model not found) when 
i go to the intended URL. Instead i get Controller not found 
(App\Controller\ThookController).

i'll keep trying, but anything toward helping me understand this better 
would be hugely appreciated.
-joe


On Saturday, 30 August 2014 01:04:22 UTC-4, Joe Theuerkauf wrote:
>
> i wasn't. My mistake. However, i guess there was more to the puzzle. Even 
> after adding Plugin::loadAll() to bootstrap.php, it wasn't working.
>
> i continued to tinker, finally creating a full-blown plugin (*cake bake 
> plugin Thook/Websites*). Note the original post was just the Model 
> commands - i hadn't created the plugin before hand.
>
> i had to make some adjustments to namespaces and the composer.json path 
> strings. It's writing ./plugins/... instead of ./Plugin where bake actually 
> places the plugin's directory tree, and path separators are getting mixed 
> up. If you want more detail on that, i'll create a dummy plugin & note the 
> mix-ups. Yes, it's Windows... ;-)
>
> Whatever i did this time, it's working. i've confirmed by pulling out all 
> the old
>
> i don't know if it's because i'm switching between Cake 3 on this project 
> and Zend 1 at work, or what, but my brain is pudding. 
>
> Any idea how to get my IDE (PhpStorm) to recognize the namespaces 
> correctly, since the *src/* part of the path breaks up the PSR-0/4 
> conformity? Just curious. The app functions
>
> Now to work on hooking up the routes & controllers...
>
> Congrats on getting to beta, by the way!
> -joe
>
>
>
> On Friday, 29 August 2014 04:00:35 UTC-4, José Lorenzo wrote:
>>
>> How did you load your plugin?
>>
>> On Friday, August 29, 2014 9:32:48 AM UTC+2, Joe Theuerkauf wrote:
>>>
>>> A while ago i created this thread: 
>>> https://groups.google.com/forum/#!topic/cake-php/A5WHkiWCPd4
>>>
>>> i was trying to hook up tables from a second database, using a different 
>>> Datasource connection from *app.php*.
>>>
>>> My default is "kodiak", the other is "websites". It's a general-use set 
>>> of tables, like MimeTypes, Captcha questions, etc.
>>>
>>> i got them working by putting them in together with Table/Entity classes 
>>> from the "kodiak" database. However, i wanted to organize the class files 
>>> for these Tables/Entities away from the other stuff, and the suggestion was 
>>> to use a Plugin syntax.
>>>
>>> Cut to tonight:
>>>
>>> 1. i used the cake command line to build models within my plugin:
>>>
>>>
>>>
>>> *cake bake model Thook\Websites.Captchas --connection=websites*2. The 
>>> files were built successfully within *Plugin/Thook/Websites/src*.
>>>
>>> 3. i added
>>>
>>>
>>>
>>> *public static function defaultConnectionName() {return 'websites';}*to 
>>> each of the Table classes i built, as i had done originally under 
>>> *App/Model/Table*. i kinda feel this part should be added automatically 
>>> if *--connection* is specified on the command line, but the point is 
>>> moot.
>>>
>>> 4. i changed the line in my Controller that loads the Captchas Model 
>>> (per http://book.cakephp.org/3.0/en/plugins.html#plugin-models at the 
>>> end of that section):
>>>
>>> *$captchasTable =

Re: 3.0.x - defaultConnectionName not working in Plugin

2014-08-29 Thread Joe Theuerkauf
i wasn't. My mistake. However, i guess there was more to the puzzle. Even 
after adding Plugin::loadAll() to bootstrap.php, it wasn't working.

i continued to tinker, finally creating a full-blown plugin (*cake bake 
plugin Thook/Websites*). Note the original post was just the Model commands 
- i hadn't created the plugin before hand.

i had to make some adjustments to namespaces and the composer.json path 
strings. It's writing ./plugins/... instead of ./Plugin where bake actually 
places the plugin's directory tree, and path separators are getting mixed 
up. If you want more detail on that, i'll create a dummy plugin & note the 
mix-ups. Yes, it's Windows... ;-)

Whatever i did this time, it's working. i've confirmed by pulling out all 
the old

i don't know if it's because i'm switching between Cake 3 on this project 
and Zend 1 at work, or what, but my brain is pudding. 

Any idea how to get my IDE (PhpStorm) to recognize the namespaces 
correctly, since the *src/* part of the path breaks up the PSR-0/4 
conformity? Just curious. The app functions

Now to work on hooking up the routes & controllers...

Congrats on getting to beta, by the way!
-joe



On Friday, 29 August 2014 04:00:35 UTC-4, José Lorenzo wrote:
>
> How did you load your plugin?
>
> On Friday, August 29, 2014 9:32:48 AM UTC+2, Joe Theuerkauf wrote:
>>
>> A while ago i created this thread: 
>> https://groups.google.com/forum/#!topic/cake-php/A5WHkiWCPd4
>>
>> i was trying to hook up tables from a second database, using a different 
>> Datasource connection from *app.php*.
>>
>> My default is "kodiak", the other is "websites". It's a general-use set 
>> of tables, like MimeTypes, Captcha questions, etc.
>>
>> i got them working by putting them in together with Table/Entity classes 
>> from the "kodiak" database. However, i wanted to organize the class files 
>> for these Tables/Entities away from the other stuff, and the suggestion was 
>> to use a Plugin syntax.
>>
>> Cut to tonight:
>>
>> 1. i used the cake command line to build models within my plugin:
>>
>>
>>
>> *cake bake model Thook\Websites.Captchas --connection=websites*2. The 
>> files were built successfully within *Plugin/Thook/Websites/src*.
>>
>> 3. i added
>>
>>
>>
>> *public static function defaultConnectionName() {return 'websites';}*to 
>> each of the Table classes i built, as i had done originally under 
>> *App/Model/Table*. i kinda feel this part should be added automatically 
>> if *--connection* is specified on the command line, but the point is 
>> moot.
>>
>> 4. i changed the line in my Controller that loads the Captchas Model (per 
>> http://book.cakephp.org/3.0/en/plugins.html#plugin-models at the end of 
>> that section):
>>
>> *$captchasTable = TableRegistry::get('Thook/Websites.Captchas');*
>> i think that's the right syntax. If i try anything else similar to it, i 
>> get class-not-found errors.
>>
>> Using that syntax, i get this:
>>
>>
>> *SQLSTATE[42S02]: Base table or view not found: 1146 Table 
>> 'kodiak.captchas' doesn't exist*Error: An Internal Error Has Occurred.
>> Stack Trace
>> ROOT\vendor\cakephp\cakephp\src\Database\Schema\Collection.php line 
>> 116 → Cake\Database\Schema\Collection->_reflect(string, string, array, 
>> Cake\Database\Schema\Table)
>> ROOT\vendor\cakephp\cakephp\src\ORM\Table.php line 323 → 
>> Cake\Database\Schema\Collection->describe(string)
>> ROOT\vendor\cakephp\cakephp\src\ORM\Query.php line 136 → 
>> Cake\ORM\Table->schema()
>> ROOT\vendor\cakephp\cakephp\src\ORM\Query.php line 119 → 
>> Cake\ORM\Query->addDefaultTypes(Cake\ORM\Table)
>> ROOT\vendor\cakephp\cakephp\src\ORM\Table.php line 927 → 
>> Cake\ORM\Query->__construct(Cake\Database\Connection, Cake\ORM\Table)
>> ROOT\vendor\cakephp\cakephp\src\ORM\Table.php line 724 → 
>> Cake\ORM\Table->query()
>> APP/Controller\ContactsController.php line 65 → 
>> Cake\ORM\Table->find(string)
>> (expanded...)
>>  $termsTable = TableRegistry::get('Terms');
>>  $captchasTable = TableRegistry::get('Thook/Websites.Captchas');
>>
>> *Line 65: $captcha = $captchasTable->find('random')->first();*
>> So it brings me back to the same thing i was struggling with last time: 
>> it looks like the Table class gets loaded, but *defaultConnectionName* 
>> isn't doing its job to tell the App to use the 'websites&

3.0.x - defaultConnectionName not working in Plugin

2014-08-29 Thread Joe Theuerkauf
A while ago i created this thread: 
https://groups.google.com/forum/#!topic/cake-php/A5WHkiWCPd4

i was trying to hook up tables from a second database, using a different 
Datasource connection from *app.php*.

My default is "kodiak", the other is "websites". It's a general-use set of 
tables, like MimeTypes, Captcha questions, etc.

i got them working by putting them in together with Table/Entity classes 
from the "kodiak" database. However, i wanted to organize the class files 
for these Tables/Entities away from the other stuff, and the suggestion was 
to use a Plugin syntax.

Cut to tonight:

1. i used the cake command line to build models within my plugin:



*cake bake model Thook\Websites.Captchas --connection=websites*2. The files 
were built successfully within *Plugin/Thook/Websites/src*.

3. i added



*public static function defaultConnectionName() {return 'websites';}*to 
each of the Table classes i built, as i had done originally under 
*App/Model/Table*. i kinda feel this part should be added automatically if 
*--connection* is specified on the command line, but the point is moot.

4. i changed the line in my Controller that loads the Captchas Model (per 
http://book.cakephp.org/3.0/en/plugins.html#plugin-models at the end of 
that section):

*$captchasTable = TableRegistry::get('Thook/Websites.Captchas');*
i think that's the right syntax. If i try anything else similar to it, i 
get class-not-found errors.

Using that syntax, i get this:


*SQLSTATE[42S02]: Base table or view not found: 1146 Table 
'kodiak.captchas' doesn't exist*Error: An Internal Error Has Occurred.
Stack Trace
ROOT\vendor\cakephp\cakephp\src\Database\Schema\Collection.php line 116 
→ Cake\Database\Schema\Collection->_reflect(string, string, array, 
Cake\Database\Schema\Table)
ROOT\vendor\cakephp\cakephp\src\ORM\Table.php line 323 → 
Cake\Database\Schema\Collection->describe(string)
ROOT\vendor\cakephp\cakephp\src\ORM\Query.php line 136 → 
Cake\ORM\Table->schema()
ROOT\vendor\cakephp\cakephp\src\ORM\Query.php line 119 → 
Cake\ORM\Query->addDefaultTypes(Cake\ORM\Table)
ROOT\vendor\cakephp\cakephp\src\ORM\Table.php line 927 → 
Cake\ORM\Query->__construct(Cake\Database\Connection, Cake\ORM\Table)
ROOT\vendor\cakephp\cakephp\src\ORM\Table.php line 724 → 
Cake\ORM\Table->query()
APP/Controller\ContactsController.php line 65 → 
Cake\ORM\Table->find(string)
(expanded...)
 $termsTable = TableRegistry::get('Terms');
 $captchasTable = TableRegistry::get('Thook/Websites.Captchas');

*Line 65: $captcha = $captchasTable->find('random')->first();*
So it brings me back to the same thing i was struggling with last time: it 
looks like the Table class gets loaded, but *defaultConnectionName* isn't 
doing its job to tell the App to use the 'websites' connection instead of 
'default' (kodiak). 

*find('random')* is in a Table extension class i added, and was also 
working until i started trying the Plugin approach for the Model.

Any help?

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


Re: 3.0 - composer update failing

2014-08-13 Thread Joe Theuerkauf
Thanks for following up.

i haven't changed any Git settings, and Tortoise shows my system config for 
core.crlf is Auto.

i ran the update again this evening, and it looks like it finally went 
smoothly. No errors. Removed, installed, cloned, and rewrote the lock & 
autoload files.

Thanks for your help.
-joe


On Wednesday, 13 August 2014 10:51:34 UTC-4, José Lorenzo wrote:
>
> Have you changed the core.autocrlf config for git? It might be that after 
> cloning, git is changing the line endings in the repo
>
> On Wednesday, August 13, 2014 2:50:24 PM UTC+2, Joe Theuerkauf wrote:
>>
>> /facedesk i baffle myself sometimes...
>>
>> i deleted the directory & ran the update this morning before leaving for 
>> work. It *seems* to have updated, but i got an error during the clone 
>> process referring to a pull request. It then showed a message about 
>> attempting to download from *dist*, which appeared to be successful.
>>
>> Just in case, i ran *composer update* again, and the same thing 
>> happened, except the error referred to a different pull request.
>>
>> i'll have a closer look when i get home, but thought i'd put this up in 
>> case something went wrong & you have any additional advice. i really 
>> appreciate the help.
>> -joe
>>
>>
>>
>> On Wednesday, 13 August 2014 04:11:39 UTC-4, José Lorenzo wrote:
>>>
>>> delete the vendors/cakephp folder and run composr update again
>>>
>>> On Wednesday, August 13, 2014 4:16:44 AM UTC+2, Joe Theuerkauf wrote:
>>>>
>>>> Running *composer update* is currently failing, claiming i have local 
>>>> edits that conflict with the remote. However, i haven't done any edits to 
>>>> Cake source files. i tried discarding the "changes" so the remote could 
>>>> overwrite the files, and still got a failure.
>>>>
>>>> Getting the same problem if i go to vendor/cakephp/cakephp/src and try 
>>>> to do *git pull* (log from TortoiseGit):
>>>>
>>>> git.exe pull -v --progress "composer"
>>>>
>>>> From git://github.com/cakephp/cakephp
>>>> = [up to date]  3.0-> composer/3.0
>>>> = [up to date]  1.3-> composer/1.3
>>>> = [up to date]  2.4-> composer/2.4
>>>> = [up to date]  2.6-> composer/2.6
>>>> = [up to date]  3.0-hhvm-take2 -> composer/3.0-hhvm-take2
>>>> = [up to date]  3.0-nest-label -> composer/3.0-nest-label
>>>> = [up to date]  3.0-router-url -> composer/3.0-router-url
>>>> = [up to date]  3.0-url-helper -> composer/3.0-url-helper
>>>> = [up to date]  gh-pages   -> composer/gh-pages
>>>> = [up to date]  master -> composer/master
>>>> Updating cd5fb7e..2edcc0b
>>>> error: Your local changes to the following files would be overwritten 
>>>> by merge:
>>>> src/Console/Command/BakeShell.php
>>>> src/Console/Command/Task/SimpleBakeTask.php
>>>> src/Console/Command/Task/TestTask.php
>>>> src/Core/App.php
>>>> src/Core/Plugin.php
>>>> src/I18n/MessagesFileLoader.php
>>>> src/Network/Session.php
>>>> src/ORM/Marshaller.php
>>>> src/ORM/Table.php
>>>> src/Template/Bake/default/views/index.ctp
>>>> src/Template/Bake/default/views/view.ctp
>>>> src/TestSuite/Fixture/FixtureManager.php
>>>> tests/TestCase/Core/PluginTest.php
>>>> tests/TestCase/I18n/I18nTest.php
>>>> tests/TestCase/Network/SessionTest.php
>>>> tests/TestCase/ORM/MarshallerTest.php
>>>> Please, commit your changes or stash them before you can merge.
>>>> Aborting
>>>>
>>>>
>>>> git did not exit cleanly (exit code 1) (4337 ms @ 8/12/2014 9:57:06 PM)
>>>> 
>>>> There are 2 remotes detected when i try to pull: *composer* & *origin*. 
>>>> The *composer* remote sees there are 3.0 commits as recently as 9 
>>>> hours ago (as of writing), while *origin* says last 3.0 commit was 3 
>>>> months ago.
>>>>
>>>> *My composer.json config:*
>>>> {
>>>> "name":"cakephp/app",
>>>> "description" :"CakePHP skeleton app",
>>>> "homepage":"http://cakephp.org";,
>>>> "type":"project",
>&g

Re: 3.0 - composer update failing

2014-08-13 Thread Joe Theuerkauf
/facedesk i baffle myself sometimes...

i deleted the directory & ran the update this morning before leaving for 
work. It *seems* to have updated, but i got an error during the clone 
process referring to a pull request. It then showed a message about 
attempting to download from *dist*, which appeared to be successful.

Just in case, i ran *composer update* again, and the same thing happened, 
except the error referred to a different pull request.

i'll have a closer look when i get home, but thought i'd put this up in 
case something went wrong & you have any additional advice. i really 
appreciate the help.
-joe



On Wednesday, 13 August 2014 04:11:39 UTC-4, José Lorenzo wrote:
>
> delete the vendors/cakephp folder and run composr update again
>
> On Wednesday, August 13, 2014 4:16:44 AM UTC+2, Joe Theuerkauf wrote:
>>
>> Running *composer update* is currently failing, claiming i have local 
>> edits that conflict with the remote. However, i haven't done any edits to 
>> Cake source files. i tried discarding the "changes" so the remote could 
>> overwrite the files, and still got a failure.
>>
>> Getting the same problem if i go to vendor/cakephp/cakephp/src and try to 
>> do *git pull* (log from TortoiseGit):
>>
>> git.exe pull -v --progress "composer"
>>
>> From git://github.com/cakephp/cakephp
>> = [up to date]  3.0-> composer/3.0
>> = [up to date]  1.3-> composer/1.3
>> = [up to date]  2.4-> composer/2.4
>> = [up to date]  2.6-> composer/2.6
>> = [up to date]  3.0-hhvm-take2 -> composer/3.0-hhvm-take2
>> = [up to date]  3.0-nest-label -> composer/3.0-nest-label
>> = [up to date]  3.0-router-url -> composer/3.0-router-url
>> = [up to date]  3.0-url-helper -> composer/3.0-url-helper
>> = [up to date]  gh-pages   -> composer/gh-pages
>> = [up to date]  master -> composer/master
>> Updating cd5fb7e..2edcc0b
>> error: Your local changes to the following files would be overwritten by 
>> merge:
>> src/Console/Command/BakeShell.php
>> src/Console/Command/Task/SimpleBakeTask.php
>> src/Console/Command/Task/TestTask.php
>> src/Core/App.php
>> src/Core/Plugin.php
>> src/I18n/MessagesFileLoader.php
>> src/Network/Session.php
>> src/ORM/Marshaller.php
>> src/ORM/Table.php
>> src/Template/Bake/default/views/index.ctp
>> src/Template/Bake/default/views/view.ctp
>> src/TestSuite/Fixture/FixtureManager.php
>> tests/TestCase/Core/PluginTest.php
>> tests/TestCase/I18n/I18nTest.php
>> tests/TestCase/Network/SessionTest.php
>> tests/TestCase/ORM/MarshallerTest.php
>> Please, commit your changes or stash them before you can merge.
>> Aborting
>>
>>
>> git did not exit cleanly (exit code 1) (4337 ms @ 8/12/2014 9:57:06 PM)
>> 
>> There are 2 remotes detected when i try to pull: *composer* & *origin*. 
>> The *composer* remote sees there are 3.0 commits as recently as 9 hours 
>> ago (as of writing), while *origin* says last 3.0 commit was 3 months 
>> ago.
>>
>> *My composer.json config:*
>> {
>> "name":"cakephp/app",
>> "description" :"CakePHP skeleton app",
>> "homepage":"http://cakephp.org";,
>> "type":"project",
>> "license" :"MIT",
>> "repositories":[
>> {
>> "type"   :"package",
>> "package":{
>> "name":"openwall/phpass",
>> "version" :"0.3",
>> "dist":{
>> "url" :"
>> http://www.openwall.com/phpass/phpass-0.3.tar.gz";,
>> "type":"tar"
>> },
>> "autoload":{
>> "classmap":[
>> "PasswordHash.php"
>> ]
>> }
>> }
>> }
>> ],
>> "require" :{
>> "php":">=5.4.19",
>> "cakephp/cakephp":"3.0.*-dev",
>> "zurb/foundation"   :"dev-master",
>>
>> "tecnick.com/tcpdf" :"dev-master",
>> "mobiledetect/mobiledetectli

3.0 - composer update failing

2014-08-12 Thread Joe Theuerkauf
Running *composer update* is currently failing, claiming i have local edits 
that conflict with the remote. However, i haven't done any edits to Cake 
source files. i tried discarding the "changes" so the remote could 
overwrite the files, and still got a failure.

Getting the same problem if i go to vendor/cakephp/cakephp/src and try to 
do *git pull* (log from TortoiseGit):

git.exe pull -v --progress "composer"

>From git://github.com/cakephp/cakephp
= [up to date]  3.0-> composer/3.0
= [up to date]  1.3-> composer/1.3
= [up to date]  2.4-> composer/2.4
= [up to date]  2.6-> composer/2.6
= [up to date]  3.0-hhvm-take2 -> composer/3.0-hhvm-take2
= [up to date]  3.0-nest-label -> composer/3.0-nest-label
= [up to date]  3.0-router-url -> composer/3.0-router-url
= [up to date]  3.0-url-helper -> composer/3.0-url-helper
= [up to date]  gh-pages   -> composer/gh-pages
= [up to date]  master -> composer/master
Updating cd5fb7e..2edcc0b
error: Your local changes to the following files would be overwritten by 
merge:
src/Console/Command/BakeShell.php
src/Console/Command/Task/SimpleBakeTask.php
src/Console/Command/Task/TestTask.php
src/Core/App.php
src/Core/Plugin.php
src/I18n/MessagesFileLoader.php
src/Network/Session.php
src/ORM/Marshaller.php
src/ORM/Table.php
src/Template/Bake/default/views/index.ctp
src/Template/Bake/default/views/view.ctp
src/TestSuite/Fixture/FixtureManager.php
tests/TestCase/Core/PluginTest.php
tests/TestCase/I18n/I18nTest.php
tests/TestCase/Network/SessionTest.php
tests/TestCase/ORM/MarshallerTest.php
Please, commit your changes or stash them before you can merge.
Aborting


git did not exit cleanly (exit code 1) (4337 ms @ 8/12/2014 9:57:06 PM)

There are 2 remotes detected when i try to pull: *composer* & *origin*. The 
*composer* remote sees there are 3.0 commits as recently as 9 hours ago (as 
of writing), while *origin* says last 3.0 commit was 3 months ago.

*My composer.json config:*
{
"name":"cakephp/app",
"description" :"CakePHP skeleton app",
"homepage":"http://cakephp.org";,
"type":"project",
"license" :"MIT",
"repositories":[
{
"type"   :"package",
"package":{
"name":"openwall/phpass",
"version" :"0.3",
"dist":{
"url" 
:"http://www.openwall.com/phpass/phpass-0.3.tar.gz";,
"type":"tar"
},
"autoload":{
"classmap":[
"PasswordHash.php"
]
}
}
}
],
"require" :{
"php":">=5.4.19",
"cakephp/cakephp":"3.0.*-dev",
"zurb/foundation"   :"dev-master",

"tecnick.com/tcpdf" :"dev-master",
"mobiledetect/mobiledetectlib"  :"2.*",

"openwall/phpass":"*"
},
"require-dev" :{
"d11wtq/boris":"1.0.*"
},
"suggest" :{
"phpunit/phpunit":"Allows automated tests to be run without 
system-wide install."
},
"autoload":{
"psr-4":{
"App\\"   :"App",
"App\\Test\\" :"Test",
"":"./Plugin"
}
},
"scripts" :{
"post-install-cmd":"App\\Console\\Installer::postInstall"
}
}


The project was originally created from the Cake command line (following 
the Blog tutorial) and i've been running *composer update* on it ever 
since. Until now.

Any help? i see the Github page recommends creating new projects with the 
3.0 App skeleton, but isn't that what i already have if i created the 
project from the *cake* command? If not, what kind of hassle would i have 
trying to transfer files into a new App skeleton?

Thanks in advance...
-joe

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


Re: CakePHP 3.0.0-alpha2 released

2014-08-04 Thread Joe Theuerkauf
Quick correction: routes.php link is 404.

Should be (i think): 
*https://github.com/cakephp/app/blob/master/config/routes.php*



On Monday, 28 July 2014 03:13:14 UTC-4, José Lorenzo wrote:
>
> The CakePHP core team is proud to announce the immediate availability of 
> CakePHP 
> 3.0.0-alpha2 . 
> CakePHP 3.0.0-alpha2 is the second alpha release for CakePHP 3.0.0. In the 
> month since 3.0.0-alpha1 a few new features have been merged, and many 
> issues have been fixed.
> New Features in 3.0.0-alpha2Router Refactor and Builder Based APIs.
>
> The Router class has been re-factored internally and new methods have been 
> added to allow your routes file to stay DRYer than ever before. In addition 
> to improved methods, the performance of parsing incoming URLs has been 
> greatly improved. Router is stricter about missing routes, and will notify 
> you (via an exception) when a URL cannot be parsed or matched with the 
> connected routes.
>
> The default routes provided by CakePHP have been removed. While helpful in 
> the prototyping stages, these routes created issues with duplicate content 
> and were often not used in larger applications. In their place, a smaller 
> subset of routes is provided to help with the prototype stage of 
> application development. If you have an existing application using 3.0, you 
> will need to update your routes.php 
>  file.
> CacheHelper Removed
>
> CacheHelper has been removed from CakePHP. The core team feels that the 
> functionality this helper provided is best handled by standalone servers 
> like Varnish . While we explored building a 
> ESI based replacement for CacheHelper, there were a number of edge cases 
> that would have complicated the implementation.
> ORM Improvements
>
>- Empty associations in BelongsTo and HasOne associations no longer 
>hydrate an empty entity. Instead the association property will be null 
>.
>- Options for all the various ORM operations are now consistent.
>- You can specify a white list of fields when marshaling data out of 
>the request and into entities.
>- It is now easier to implement custom column types with the 
>_initializeSchema table hook method.
>- Query::newExpr() now accepts a SQL expression.
>- Conditions with nullable values are easier to build 
>'field IS' => $val will generate correct SQL when $val is not NULL .
>- Conditions with IN clauses work better with empty data.
>
> Other Changes
>
>- HtmlHelper and FormHelper had their $confirmMessage arguments 
>removed and replaced with confirm options.
>- Improved errors for Cells.
>- Prefixed controllers can now use prefixed layouts which will be 
>checked automatically.
>- Cookies are now read and decrypted lazily.
>- The ssl routing option is now _ssl .
>- The [method] routing option is now _method .
>- Header based route matching has been removed. It was very 
>infrequently used.
>- Router::resourceMap() has been removed. New options for 
>Router::mapResources() replace the need to have this method.
>- Bcrypt hashing has been removed from Security::hash()
>
> There are still tickets available for CakeFest 2014. You can get your 
> tickets now  to join us in Madrid for 
> exciting talks and tutorials on CakePHP and related technologies.
>
> For more details on all the changes in 3.0.0, you can consult the migration 
> guide . 
> I'd like to thank everyone who has contributed thoughts, code, 
> documentation or feedback to 3.0 so far. We are very grateful for all the 
> early adopters and their feedback. Getting issues found and fixed early is 
> a huge help.
>

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


Re: 3.0: defaultConnectionName doesn't create correct connection

2014-07-23 Thread Joe Theuerkauf
Thanks for the suggestion. i'll read up on how to do that, but don't be 
surprised if i end up back here for some clarifications. But i'll give it a 
try before bugging the group again. :)
-joe


On Wednesday, 23 July 2014 02:34:29 UTC-4, José Lorenzo wrote:
>
> I would use plugins for organizing them
>
> On Wednesday, July 23, 2014 5:33:18 AM UTC+2, Joe Theuerkauf wrote:
>>
>> Okay, i fixated on this tonight & i think i got it to work. i put 
>> CaptchasTable back in App/Model/Table, and behold the class loads correctly 
>> (i forgot to adjust the namespace in the previous message).
>>
>> However, before i do a happy dance, i'd like to know if it's *POSSIBLE* 
>> to organize my Models into subdirectories as i was attempting to do:
>>
>> Model/Table/* : My project's main DB Table classes
>> Model/Table/Websites/* : Table classes from the Websites database, so 
>> they're not cluttering up my project's main tables... 
>> Model/Table//* : Similar if i need to connect to any other 
>> databases...
>>
>> Can this be done at all?
>>
>>
>>
>>
>>
>> On Tuesday, 22 July 2014 21:26:20 UTC-4, Joe Theuerkauf wrote:
>>>
>>> José:
>>>
>>> Sorry for the delayed response. i've been getting burned out (and burned 
>>> up with the weather), so i took a day to breathe.
>>>
>>> i called $this->Captchas->defaultConnectionName() from inside the 
>>> ContactsController:
>>>
>>> public function index() {
>>>  $this->loadModel('Captchas');
>>>  // PS: i'm using the LogTrait in the class...
>>>  $this->log('defaultConnectionName: ' . 
>>> $this->Captchas->defaultConnectionName());
>>>
>>> // ...
>>> }
>>>
>>>
>>> Output in error.log:
>>>
>>> 2014-07-23 01:16:55 Error: defaultConnectionName: default
>>>
>>>
>>> Obviously, not what i was expecting. And that's the value whether i have 
>>> CaptchasTable in the main Model/Table or in Model/Table/Website.
>>>
>>> If you have further suggestions, please let me know. i know 3.0 is alpha 
>>> so i do expect some breakage. But when the documentation is so brief & 
>>> doesn't seem to work, it can be frustrating.
>>> -joe
>>>
>>>
>>> On Monday, 21 July 2014 04:08:18 UTC-4, José Lorenzo wrote:
>>>>
>>>> what is returned if you call $this->Captchas->defaultConnectionName() ?
>>>>
>>>> On Sunday, July 20, 2014 6:29:33 PM UTC+2, Joe Theuerkauf wrote:
>>>>>
>>>>> i tried this topic before, but the only response was for an older 
>>>>> version of Cake...
>>>>>
>>>>> i'm following this documentation:
>>>>>
>>>>> http://book.cakephp.org/3.0/en/orm/table-objects.html#configuring-connections
>>>>>
>>>>> i'm trying to keep a few tables that would be application-agnostic in 
>>>>> a different database. i'm not trying to create associations as mentioned 
>>>>> in 
>>>>> #3463. i just need to query independent records from these tables.
>>>>>
>>>>> Here's what i have so far:
>>>>> // Config/app.php
>>>>> $config = [
>>>>> // ...
>>>>>   'Datasources' => [
>>>>> 'default' => [
>>>>>   // Connection to this DB works.
>>>>>   'database' => 'kodiak',
>>>>> ],
>>>>> 'websites' => [
>>>>>   // Connection is identical, except different 'database' value
>>>>>   'database' => 'websites',
>>>>> ]
>>>>>   ]
>>>>> // ...
>>>>> ];
>>>>>
>>>>> // Model/Table/Websites/CapchasTable.php
>>>>> class CaptchasTable extends Table {
>>>>> public static function defaultConnectionName () {
>>>>> return 'websites';
>>>>> }
>>>>> }
>>>>>
>>>>> // Controller/ContactsController.php
>>>>> public function index () {
>>>>> $this->loadModel('Captchas');
>>>>>
>>>>> $captcha = $this->Captchas->find('all', [
>&

Re: 3.0: defaultConnectionName doesn't create correct connection

2014-07-22 Thread Joe Theuerkauf
Okay, i fixated on this tonight & i think i got it to work. i put 
CaptchasTable back in App/Model/Table, and behold the class loads correctly 
(i forgot to adjust the namespace in the previous message).

However, before i do a happy dance, i'd like to know if it's *POSSIBLE* to 
organize my Models into subdirectories as i was attempting to do:

Model/Table/* : My project's main DB Table classes
Model/Table/Websites/* : Table classes from the Websites database, so 
they're not cluttering up my project's main tables... 
Model/Table//* : Similar if i need to connect to any other databases...

Can this be done at all?





On Tuesday, 22 July 2014 21:26:20 UTC-4, Joe Theuerkauf wrote:
>
> José:
>
> Sorry for the delayed response. i've been getting burned out (and burned 
> up with the weather), so i took a day to breathe.
>
> i called $this->Captchas->defaultConnectionName() from inside the 
> ContactsController:
>
> public function index() {
>  $this->loadModel('Captchas');
>  // PS: i'm using the LogTrait in the class...
>  $this->log('defaultConnectionName: ' . 
> $this->Captchas->defaultConnectionName());
>
> // ...
> }
>
>
> Output in error.log:
>
> 2014-07-23 01:16:55 Error: defaultConnectionName: default
>
>
> Obviously, not what i was expecting. And that's the value whether i have 
> CaptchasTable in the main Model/Table or in Model/Table/Website.
>
> If you have further suggestions, please let me know. i know 3.0 is alpha 
> so i do expect some breakage. But when the documentation is so brief & 
> doesn't seem to work, it can be frustrating.
> -joe
>
>
> On Monday, 21 July 2014 04:08:18 UTC-4, José Lorenzo wrote:
>>
>> what is returned if you call $this->Captchas->defaultConnectionName() ?
>>
>> On Sunday, July 20, 2014 6:29:33 PM UTC+2, Joe Theuerkauf wrote:
>>>
>>> i tried this topic before, but the only response was for an older 
>>> version of Cake...
>>>
>>> i'm following this documentation:
>>>
>>> http://book.cakephp.org/3.0/en/orm/table-objects.html#configuring-connections
>>>
>>> i'm trying to keep a few tables that would be application-agnostic in a 
>>> different database. i'm not trying to create associations as mentioned in 
>>> #3463. i just need to query independent records from these tables.
>>>
>>> Here's what i have so far:
>>> // Config/app.php
>>> $config = [
>>> // ...
>>>   'Datasources' => [
>>> 'default' => [
>>>   // Connection to this DB works.
>>>   'database' => 'kodiak',
>>> ],
>>> 'websites' => [
>>>   // Connection is identical, except different 'database' value
>>>   'database' => 'websites',
>>> ]
>>>   ]
>>> // ...
>>> ];
>>>
>>> // Model/Table/Websites/CapchasTable.php
>>> class CaptchasTable extends Table {
>>> public static function defaultConnectionName () {
>>> return 'websites';
>>> }
>>> }
>>>
>>> // Controller/ContactsController.php
>>> public function index () {
>>> $this->loadModel('Captchas');
>>>
>>> $captcha = $this->Captchas->find('all', [
>>> 'conditions' => [],
>>> 'order' => 'RAND()',
>>> 'limit' => 1
>>> ]);
>>>
>>> // etc.
>>> }
>>>
>>> Here's the error output:
>>>
>>> SQLSTATE[42S02]: Base table or view not found: 1146 Table 
>>> *'kodiak.captchas'* doesn't exist
>>>
>>> Error: An Internal Error Has Occurred.
>>> Stack Trace
>>>
>>> ROOT\vendor\cakephp\cakephp\src\Database\Schema\Collection.php line 
>>> 113 → Cake\Database\Schema\Collection->_executeSql(string, array)
>>> ROOT\vendor\cakephp\cakephp\src\ORM\Table.php line 323 → 
>>> Cake\Database\Schema\Collection->describe(string)
>>> ROOT\vendor\cakephp\cakephp\src\ORM\Query.php line 127 → 
>>> Cake\ORM\Table->schema()
>>> ROOT\vendor\cakephp\cakephp\src\ORM\Query.php line 110 → 
>>> Cake\ORM\Query->addDefaultTypes(Cake\ORM\Table)
>>> ROOT\vendor\cakephp\cakephp\src\ORM\Table.php line 927 → 
>>> Cake\ORM\Query->__construct(Cake\Database

Re: 3.0: defaultConnectionName doesn't create correct connection

2014-07-22 Thread Joe Theuerkauf
Two addenda:

1. Does it make a difference that i'm loading a different Model that uses 
the 'default' connection *before* Captchas? i've been omitting it because i 
didn't think it was relevant. But maybe there's some failure to get the 
right defaultConnectionName() because both Models are loaded? It doesn't 
seem so at first glance, since i'm specifying $this->Captchas, but who 
knows...

2. My apologies for the jab above. i'm actually far less frustrated by 
occasional breakage from an alpha framework than i am by trying to unravel 
bugs & lack of activity in the "production" release of a popular front-end 
framework i use. Lots of other unrelated crap too. To say the least, it's 
been a long month.


On Tuesday, 22 July 2014 21:26:20 UTC-4, Joe Theuerkauf wrote:
>
> José:
>
> Sorry for the delayed response. i've been getting burned out (and burned 
> up with the weather), so i took a day to breathe.
>
> i called $this->Captchas->defaultConnectionName() from inside the 
> ContactsController:
>
> public function index() {
>  $this->loadModel('Captchas');
>  // PS: i'm using the LogTrait in the class...
>  $this->log('defaultConnectionName: ' . 
> $this->Captchas->defaultConnectionName());
>
> // ...
> }
>
>
> Output in error.log:
>
> 2014-07-23 01:16:55 Error: defaultConnectionName: default
>
>
> Obviously, not what i was expecting. And that's the value whether i have 
> CaptchasTable in the main Model/Table or in Model/Table/Website.
>
> If you have further suggestions, please let me know. i know 3.0 is alpha 
> so i do expect some breakage. But when the documentation is so brief & 
> doesn't seem to work, it can be frustrating.
> -joe
>
>
> On Monday, 21 July 2014 04:08:18 UTC-4, José Lorenzo wrote:
>>
>> what is returned if you call $this->Captchas->defaultConnectionName() ?
>>
>> On Sunday, July 20, 2014 6:29:33 PM UTC+2, Joe Theuerkauf wrote:
>>>
>>> i tried this topic before, but the only response was for an older 
>>> version of Cake...
>>>
>>> i'm following this documentation:
>>>
>>> http://book.cakephp.org/3.0/en/orm/table-objects.html#configuring-connections
>>>
>>> i'm trying to keep a few tables that would be application-agnostic in a 
>>> different database. i'm not trying to create associations as mentioned in 
>>> #3463. i just need to query independent records from these tables.
>>>
>>> Here's what i have so far:
>>> // Config/app.php
>>> $config = [
>>> // ...
>>>   'Datasources' => [
>>> 'default' => [
>>>   // Connection to this DB works.
>>>   'database' => 'kodiak',
>>> ],
>>> 'websites' => [
>>>   // Connection is identical, except different 'database' value
>>>   'database' => 'websites',
>>> ]
>>>   ]
>>> // ...
>>> ];
>>>
>>> // Model/Table/Websites/CapchasTable.php
>>> class CaptchasTable extends Table {
>>> public static function defaultConnectionName () {
>>> return 'websites';
>>> }
>>> }
>>>
>>> // Controller/ContactsController.php
>>> public function index () {
>>> $this->loadModel('Captchas');
>>>
>>> $captcha = $this->Captchas->find('all', [
>>> 'conditions' => [],
>>> 'order' => 'RAND()',
>>> 'limit' => 1
>>> ]);
>>>
>>> // etc.
>>> }
>>>
>>> Here's the error output:
>>>
>>> SQLSTATE[42S02]: Base table or view not found: 1146 Table 
>>> *'kodiak.captchas'* doesn't exist
>>>
>>> Error: An Internal Error Has Occurred.
>>> Stack Trace
>>>
>>> ROOT\vendor\cakephp\cakephp\src\Database\Schema\Collection.php line 
>>> 113 → Cake\Database\Schema\Collection->_executeSql(string, array)
>>> ROOT\vendor\cakephp\cakephp\src\ORM\Table.php line 323 → 
>>> Cake\Database\Schema\Collection->describe(string)
>>> ROOT\vendor\cakephp\cakephp\src\ORM\Query.php line 127 → 
>>> Cake\ORM\Table->schema()
>>> ROOT\vendor\cakephp\cakephp\src\ORM\Query.php line 110 → 
>>> Cake\ORM\Query->addDefaultTypes(Cake\ORM\Table)
>>>   

Re: 3.0: defaultConnectionName doesn't create correct connection

2014-07-22 Thread Joe Theuerkauf
José:

Sorry for the delayed response. i've been getting burned out (and burned up 
with the weather), so i took a day to breathe.

i called $this->Captchas->defaultConnectionName() from inside the 
ContactsController:

public function index() {
 $this->loadModel('Captchas');
 // PS: i'm using the LogTrait in the class...
 $this->log('defaultConnectionName: ' . 
$this->Captchas->defaultConnectionName());

// ...
}


Output in error.log:

2014-07-23 01:16:55 Error: defaultConnectionName: default


Obviously, not what i was expecting. And that's the value whether i have 
CaptchasTable in the main Model/Table or in Model/Table/Website.

If you have further suggestions, please let me know. i know 3.0 is alpha so 
i do expect some breakage. But when the documentation is so brief & doesn't 
seem to work, it can be frustrating.
-joe


On Monday, 21 July 2014 04:08:18 UTC-4, José Lorenzo wrote:
>
> what is returned if you call $this->Captchas->defaultConnectionName() ?
>
> On Sunday, July 20, 2014 6:29:33 PM UTC+2, Joe Theuerkauf wrote:
>>
>> i tried this topic before, but the only response was for an older version 
>> of Cake...
>>
>> i'm following this documentation:
>>
>> http://book.cakephp.org/3.0/en/orm/table-objects.html#configuring-connections
>>
>> i'm trying to keep a few tables that would be application-agnostic in a 
>> different database. i'm not trying to create associations as mentioned in 
>> #3463. i just need to query independent records from these tables.
>>
>> Here's what i have so far:
>> // Config/app.php
>> $config = [
>> // ...
>>   'Datasources' => [
>> 'default' => [
>>   // Connection to this DB works.
>>   'database' => 'kodiak',
>> ],
>> 'websites' => [
>>   // Connection is identical, except different 'database' value
>>   'database' => 'websites',
>> ]
>>   ]
>> // ...
>> ];
>>
>> // Model/Table/Websites/CapchasTable.php
>> class CaptchasTable extends Table {
>> public static function defaultConnectionName () {
>> return 'websites';
>> }
>> }
>>
>> // Controller/ContactsController.php
>> public function index () {
>> $this->loadModel('Captchas');
>>
>> $captcha = $this->Captchas->find('all', [
>> 'conditions' => [],
>> 'order' => 'RAND()',
>> 'limit' => 1
>> ]);
>>
>> // etc.
>> }
>>
>> Here's the error output:
>>
>> SQLSTATE[42S02]: Base table or view not found: 1146 Table 
>> *'kodiak.captchas'* doesn't exist
>>
>> Error: An Internal Error Has Occurred.
>> Stack Trace
>>
>> ROOT\vendor\cakephp\cakephp\src\Database\Schema\Collection.php line 
>> 113 → Cake\Database\Schema\Collection->_executeSql(string, array)
>> ROOT\vendor\cakephp\cakephp\src\ORM\Table.php line 323 → 
>> Cake\Database\Schema\Collection->describe(string)
>> ROOT\vendor\cakephp\cakephp\src\ORM\Query.php line 127 → 
>> Cake\ORM\Table->schema()
>> ROOT\vendor\cakephp\cakephp\src\ORM\Query.php line 110 → 
>> Cake\ORM\Query->addDefaultTypes(Cake\ORM\Table)
>> ROOT\vendor\cakephp\cakephp\src\ORM\Table.php line 927 → 
>> Cake\ORM\Query->__construct(Cake\Database\Connection, Cake\ORM\Table)
>> ROOT\vendor\cakephp\cakephp\src\ORM\Table.php line 724 → 
>> Cake\ORM\Table->query()
>> APP/Controller\ContactsController.php line 36 → 
>> Cake\ORM\Table->find(string, array)
>> [internal function] → App\Controller\ContactsController->index()
>> ROOT\vendor\cakephp\cakephp\src\Controller\Controller.php line 373 → 
>> ReflectionMethod->invokeArgs(App\Controller\ContactsController, array)
>> ROOT\vendor\cakephp\cakephp\src\Routing\Dispatcher.php line 115 → 
>> Cake\Controller\Controller->invokeAction()
>> ROOT\vendor\cakephp\cakephp\src\Routing\Dispatcher.php line 87 → 
>> Cake\Routing\Dispatcher->_invoke(App\Controller\ContactsController)
>> ROOT\webroot\index.php line 37 → 
>> Cake\Routing\Dispatcher->dispatch(Cake\Network\Request, 
>> Cake\Network\Response)
>>
>> It doesn't seem to matter if CaptchasTable is in Model/Table or 
>> Model/Table/Websites; loadModel('Captchas') doesn't throw errors either 
>> way. But the find() call is throwing the 

3.0: defaultConnectionName doesn't create correct connection

2014-07-20 Thread Joe Theuerkauf
i tried this topic before, but the only response was for an older version 
of Cake...

i'm following this documentation:
http://book.cakephp.org/3.0/en/orm/table-objects.html#configuring-connections

i'm trying to keep a few tables that would be application-agnostic in a 
different database. i'm not trying to create associations as mentioned in 
#3463. i just need to query independent records from these tables.

Here's what i have so far:
// Config/app.php
$config = [
// ...
  'Datasources' => [
'default' => [
  // Connection to this DB works.
  'database' => 'kodiak',
],
'websites' => [
  // Connection is identical, except different 'database' value
  'database' => 'websites',
]
  ]
// ...
];

// Model/Table/Websites/CapchasTable.php
class CaptchasTable extends Table {
public static function defaultConnectionName () {
return 'websites';
}
}

// Controller/ContactsController.php
public function index () {
$this->loadModel('Captchas');

$captcha = $this->Captchas->find('all', [
'conditions' => [],
'order' => 'RAND()',
'limit' => 1
]);

// etc.
}

Here's the error output:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 
*'kodiak.captchas'* doesn't exist

Error: An Internal Error Has Occurred.
Stack Trace

ROOT\vendor\cakephp\cakephp\src\Database\Schema\Collection.php line 113 
→ Cake\Database\Schema\Collection->_executeSql(string, array)
ROOT\vendor\cakephp\cakephp\src\ORM\Table.php line 323 → 
Cake\Database\Schema\Collection->describe(string)
ROOT\vendor\cakephp\cakephp\src\ORM\Query.php line 127 → 
Cake\ORM\Table->schema()
ROOT\vendor\cakephp\cakephp\src\ORM\Query.php line 110 → 
Cake\ORM\Query->addDefaultTypes(Cake\ORM\Table)
ROOT\vendor\cakephp\cakephp\src\ORM\Table.php line 927 → 
Cake\ORM\Query->__construct(Cake\Database\Connection, Cake\ORM\Table)
ROOT\vendor\cakephp\cakephp\src\ORM\Table.php line 724 → 
Cake\ORM\Table->query()
APP/Controller\ContactsController.php line 36 → 
Cake\ORM\Table->find(string, array)
[internal function] → App\Controller\ContactsController->index()
ROOT\vendor\cakephp\cakephp\src\Controller\Controller.php line 373 → 
ReflectionMethod->invokeArgs(App\Controller\ContactsController, array)
ROOT\vendor\cakephp\cakephp\src\Routing\Dispatcher.php line 115 → 
Cake\Controller\Controller->invokeAction()
ROOT\vendor\cakephp\cakephp\src\Routing\Dispatcher.php line 87 → 
Cake\Routing\Dispatcher->_invoke(App\Controller\ContactsController)
ROOT\webroot\index.php line 37 → 
Cake\Routing\Dispatcher->dispatch(Cake\Network\Request, 
Cake\Network\Response)

It doesn't seem to matter if CaptchasTable is in Model/Table or 
Model/Table/Websites; loadModel('Captchas') doesn't throw errors either 
way. But the find() call is throwing the error - *regardless where *
CaptchasTable* is placed*. When it's commented, the page loads fine (since 
i'm hitting this error, i haven't actually tried to USE any of the Captcha 
data in my form yet).

So the question is: why isn't defaultConnectionName setting up the 
connection to the `websites` DB? What's missing? Is it missing 
documentation & i need to do something more, or is this a bug?

i'd appreciate any help before i post this to the Github issues. 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/d/optout.


Re: Using multiple databases with defaultConnectionName

2014-07-06 Thread Joe Theuerkauf
OJ,

Thank you for the response. Unfortunately, i should have specified in the 
title or in my post that i'm working with CakePHP 3.0 alpha.

The documentation example i linked to is here:
http://book.cakephp.org/3.0/en/orm/table-objects.html#configuring-connections

My connection settings are stored with the other Datasources in 
App/Config/app.php, and the model is attempting to load, but doesn't seem 
to know it should use the other database.

i've seen other instructions using the variable you mentioned, but it 
doesn't seem to apply to v3.0.

Appreciate your time. :)



On Sunday, 6 July 2014 23:38:50 UTC-4, OJ Tibi - @ojtibi wrote:
>
> Hi, Joe.
>
> First, make sure your other database's connection settings are saved in 
> database.php
>
> Then, in your Captcha model, set the public attribute $useDbConfig to the 
> name of the settings in database.php.
>
> HTH.
>
>
> On Monday, July 7, 2014 1:18:19 AM UTC+8, Joe Theuerkauf wrote:
>>
>> Maybe i'm getting in over my head, but i'm trying to learn as much as i 
>> can...
>>
>> i'm attempting to keep a few tables in a different database. My current 
>> project will use them, but i want them to be more generally available for 
>> other projects down the road (things like mime-types, captcha questions, 
>> etc.)... i can see a tiny bit of [documentation 
>> <http://book.cakephp.org/3.0/en/orm/table-objects.html#configuring-connections>]
>>  
>> on using *defaultConnectionName* in the Table class, and i see where 
>> it's used in the [ORM/TableRegistry 
>> <https://github.com/cakephp/cakephp/blob/3.0/src/ORM/TableRegistry.php#L163>].
>>  
>> So i've set up a Datasource entry in App/Config/app.php, and my Table class 
>> is like so:
>>
>> class CaptchasTable extends Table {
>> public static function defaultConnectionName() {
>> return 'websites';
>> }
>> }
>>
>> When i load the page that calls this up, i get this:
>> SQLSTATE[42S02]: Base table or view not found: 1146 Table 
>> 'kodiak.captchas' doesn't exist
>>
>> i'm actually amazed i got that far, but i'm stuck since the 
>> *CaptchasTable* is *supposed* to connect to the other database and 
>> provide 'websites.captchas'.
>>
>> Thanks for any help.
>>
>

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


Using multiple databases with defaultConnectionName

2014-07-06 Thread Joe Theuerkauf
Maybe i'm getting in over my head, but i'm trying to learn as much as i 
can...

i'm attempting to keep a few tables in a different database. My current 
project will use them, but i want them to be more generally available for 
other projects down the road (things like mime-types, captcha questions, 
etc.)... i can see a tiny bit of [documentation 
]
 
on using *defaultConnectionName* in the Table class, and i see where it's 
used in the [ORM/TableRegistry 
]. 
So i've set up a Datasource entry in App/Config/app.php, and my Table class 
is like so:

class CaptchasTable extends Table {
public static function defaultConnectionName() {
return 'websites';
}
}

When i load the page that calls this up, i get this:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'kodiak.captchas' 
doesn't exist

i'm actually amazed i got that far, but i'm stuck since the *CaptchasTable* 
is *supposed* to connect to the other database and provide 
'websites.captchas'.

Thanks for any help.

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


3.0alpha1: Recent commit removes default Routes

2014-07-05 Thread Joe Theuerkauf
i did a Composer update last night & my project exploded. Turns out a [recent 
commit 
]
 
removed /src/Config/routes.php. Being new to programming within a 
framework, comprehending & dealing with routes is still a couple steps down 
the road for me.

So i managed to get my project working again:
1. In App/Config/routes.php i had to comment the line at the end reading
require CAKE . 'Config/routes.php';
2. After scanning the commit in the link above, found this line
Router::connect('/:controller/:action/*', [], 
['defaultRoute' => true, 
 'routeClass' => 'Cake\Routing\Route\InflectedRoute']);
and added it after the line i commented.

Now, my site is working, for now, but i know there's a lot of stuff i left 
out from the original default routes file.

My question is, based on the changes that remove the default routes, what's 
the new *Right Way* to do this? Did i miss something obvious, or should i 
be looking for new documentation somewhere?

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/d/optout.


Re: login generates malformed sql query

2010-08-31 Thread Joe Theory
Did you ever resolve this?  I am experiencing the same issue.

On Jul 23, 7:36 pm, markatto  wrote:
> On Jul 22, 1:03 pm, cricket  wrote:
>
> > This is in UsersController or AppController? I would put allow() (pass
> > it an array, not a string, btw) in the former and the other two in the
> > latter. And it should be loginRedirect, not redirectLogin.
>
> I made these changes, but I am still having the same problem.
>
> > Which DB are you using? Which version of Cake?
>
> > Try deleting everything in tmp/cache/[models|persistent] directories.
>
> I am on cake 1.3.0 and mysql. I have already tried deleting the cache
> stuff.
> Where are the columns for the query supposed to be set? I am not too
> familiar with cake internals.

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: Table name problem

2010-02-02 Thread joe-electro
Muito obrigado!

Joe

On Feb 1, 8:51 pm, Marcelo Andrade  wrote:
> On Mon, Feb 1, 2010 at 3:43 PM, joe-electro  wrote:
> > (..) How do I tell
> > Cake that this field points to the primary key of this table and not
> > of a table called "Parent_Categories"?
>
> http://book.cakephp.org/view/851/Multiple-relations-to-the-same-model
>
> Best regards.
>
> --
> MARCELO F ANDRADE
> Belem, Amazonia, Brazil
>
> "I took the red pill"

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


Table name problem

2010-02-01 Thread joe-electro
Hello, I'm relatively new to CakePHP but have read the manual through
several times and am familiar with the concepts.  I have a legacy
database that has a table in it that I don't know how to handle in
Cake so that Bake will bake everything correctly.  There's a table
called "Categories" that has the primary key 'category_id'. There is
another field in this same table called 'parent_category_id' that
stores the primary key of the category of the parent. How do I tell
Cake that this field points to the primary key of this table and not
of a table called "Parent_Categories"?

Thanks,

Joe

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: Some questions about ACL

2010-01-18 Thread Joe L
Hi Douglas, I believe by using Groups for authentication is one way to
go with it.

Firstly u could setup the permission for the GROUP as mention in
Cakephp tutorial as below
http://book.cakephp.org/view/648/Setting-up-permissions

Then you can assign the USER(s) to that GROUP.

When it comes to the admin page, you could setup an EDIT page for the
ACL table for modifying the GROUP's permission to access to different
controllers. And also setup an EDIT page USER table for modifying USER
belong to which GROUP.

Does that answer your question?



On Jan 19, 10:03 am, Joe L  wrote:
> Could I clarify, are you asking how to create an admin page to modify
> the user permissions?
>
> On Jan 19, 3:48 am, Douglas Pacheco Cardoso 
> wrote:
>
> > Hi, how are you? I'm a new membership...
>
> > Please, i want to use ACL to do control of permissions on my system.
> > I
> > understand how it works, how to check permissions and more, but i
> > don't know getting to join ideas to create one page for manage of
> > this
> > permissions.
>
> > Example:
> > I want to select the user and set for this user permissions in
> > certain
> > pages. I'll to use groups in the future, but if I have a example,
> > help
> > me much.
>
> > Anybody have some example for me? Don't need source code, only
> > ideas...
>
> > Thank you,
> > Douglas Pacheco Cardoso
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: Some questions about ACL

2010-01-18 Thread Joe L
Could I clarify, are you asking how to create an admin page to modify
the user permissions?

On Jan 19, 3:48 am, Douglas Pacheco Cardoso 
wrote:
> Hi, how are you? I'm a new membership...
>
> Please, i want to use ACL to do control of permissions on my system.
> I
> understand how it works, how to check permissions and more, but i
> don't know getting to join ideas to create one page for manage of
> this
> permissions.
>
> Example:
> I want to select the user and set for this user permissions in
> certain
> pages. I'll to use groups in the future, but if I have a example,
> help
> me much.
>
> Anybody have some example for me? Don't need source code, only
> ideas...
>
> Thank you,
> Douglas Pacheco Cardoso
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: Construct landing page correctly

2009-12-22 Thread Joe L
oh ya by the way, your website http://www.countycriminal.com/court-records
is fanstatic!!

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: Construct landing page correctly

2009-12-22 Thread Joe L
Thanks Chad,

Initially I had the same thought to have every type of events in the
same table,
but due to the nature of all these events are slightly different from
each other,
and I am planning to store the specific details for each different
type of event,
so they will need different columns/fields in the table.

For example for event such as conference, i might have special columns/
fields
to store information on the speaker and their profile
and for event such as seminar/talk, i might have special columns/
fields
to store information to see whether the seminar can be offered as
inhouse

where as event such as motor_show or exhibition, I will not need to
store information
such as speaker profile and inhouse...

Therefore in my database, I will have table for each group of events
with similar nature,
and a generic 'event' table to hold common columns/fields.

Please advise... 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


Construct landing page correctly

2009-12-22 Thread Joe L
Hi,

I am new to cakePHP and I am not sure whether this is the correct
object-oriented way to build my landing page. Please help!

I have a website that storing information on different types of
upcoming events. And I have each controller/model/database tables for
each type of my event, let's say motor_show, trade_fair...etc

In my landing page, I will display a list of upcoming events of ALL
types, therefore I need access to many tables in the page.

So I use 'views/pages/home.ctp' as my landing page. And I would call
the functions in each of the controller to retrieve the data for my
landing page use requestActions().
for eg.
requestAction('/motor_shows/displayUpcoming');?>
requestAction('/trade_fair/displayUpcoming');?>

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: jQuery & ajax pagination in 1.3

2009-12-17 Thread Joe Theory
Jquery is the only engine that seems to have issues Mark.  Thanks for
this Js helper by the way.  So nice on so many levels.

On Dec 16, 9:39 pm, mark_story  wrote:
> Yeah you need the writeBuffer() at the bottom of the view, or in your
> ajax layout. Otherwise the event scripts don't get sent along.  I'll
> have to look into the jquery issue, I thought jquery did global eval()
> on all the script blocks in an html response, but seems I might have
> been wrong.
>
> -Mark
>
> On Dec 16, 5:27 am, Dave  wrote:
>
> > I have run into issues like this as well.  For some reason sometimes when
> > content is pulled in via ajax I need to call $js->writeBuffer; at the bottom
> > of the view in the action which is called to get all of the javascript to
> > echo properly.
>
> > It kind of makes sense, if you have $js->writeBuffer at the bottom of your
> > layout, and your layout isn't refreshed, then you won't get the javascript
> > from the new view
>
> > I am not sure if this is how it is supposed to work, but that's just what
> > i've noticed
>
> > On Tue, Dec 15, 2009 at 2:21 PM, Joe Theory  wrote:
> > > I am having the same problem and can confirm that it happens
> > > specifically when using JQuery.   Using the Js Helper with Mootools
> > > works just fine.
>
> > > On Dec 14, 3:44 am, Scronkey  wrote:
> > > > I believe I know what's going on now but I'm not sure how to fix it.
>
> > > > On the first (successful) ajax call the next set of content is loaded,
> > > > including the paginator links, however the paginator links are not
> > > > successfully bound to a jQuery ajax call, therefore the next click
> > > > results in a normal page request which then results in correctly bound
> > > > events.
>
> > > > Marks post mentions the use of 'evalScripts' => true to chain the ajax
> > > > requests however this seems to have no effect with jQuery (his example
> > > > uses MooTools).
>
> > > > Is there a way I can ensure the events are rebound using jsHelper with
> > > > jQuery after the ajax call?
>
> > > 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 > >  om>For more options, visit this group at
> > >http://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: jQuery & ajax pagination in 1.3

2009-12-15 Thread Joe Theory
I am having the same problem and can confirm that it happens
specifically when using JQuery.   Using the Js Helper with Mootools
works just fine.

On Dec 14, 3:44 am, Scronkey  wrote:
> I believe I know what's going on now but I'm not sure how to fix it.
>
> On the first (successful) ajax call the next set of content is loaded,
> including the paginator links, however the paginator links are not
> successfully bound to a jQuery ajax call, therefore the next click
> results in a normal page request which then results in correctly bound
> events.
>
> Marks post mentions the use of 'evalScripts' => true to chain the ajax
> requests however this seems to have no effect with jQuery (his example
> uses MooTools).
>
> Is there a way I can ensure the events are rebound using jsHelper with
> jQuery after the ajax call?

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


Sorting pagination with HasMany and SQL Aggregation

2009-09-23 Thread Joe

in short,

Article hasMany Rating
the articles/index need to paginate and sorted with AVG(rating.score)

i found a good start in
http://groups.google.com/group/cake-php/browse_thread/thread/bece8aab31fbba72/1b27c78b0a3023d8?#1b27c78b0a3023d8

but archived, and last solution do not work at all. (cakephp 1.2.5)
my code:

class ArticlesController extends AppController {
// ...
var $paginate = array(
  'Article' => array(
'limit' => 15,
'order' => 'avg_rating DESC',
'group' => 'Article.id'
  )
);
// ...
function index() {

if (isset($this->passedArgs['sort'])) {
  if ($this->passedArgs['sort'] == 'avg_rating') {
$this->paginate['Article']['order'] = 'avg_rating '.strtoupper
($this->passedArgs['direction']);
$this->paginate['Article']['direction'] = $this->passedArgs
['direction'];
unset($this->passedArgs['sort']);
  }
}

  $this->Article->bindModel(array(
'hasOne' => array(
  'AvgRating' => array(
'className' => 'Rating',
'fields' => 'AVG(AvgRating.rating) AS avg_rating'
  )
)
  ), false);
  $this->set('articles', $this->paginate());
}
}

is there anything i can do for a more beautiful solution?
at least, i think, a little modification in paginator help can help
index controller during "reset" passedArg
--~--~-~--~~~---~--~~
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: Model validation on unit testing

2009-07-22 Thread Joe
> 'between' => array(
> 'rule' => array('between', 1, 5),
> 'message' => '1 - 5 only'
> ),

should be (between and range)

> 'between' => array(
> 'rule' => array('range', 1, 5),
> 'message' => '1 - 5 only'
> ),

for williamn's question,

put 'required'=true in the validate rule
other wise, as nth is provided, and nth is required, it just passed!!

On 7月22日, 下午4時49分, Joe  wrote:
> model/rating.php
> class Rating extends AppModel {
>
>         var $name = 'Rating';
>         var $validate = array(
>                 'score' => array(
>                         'numeric' => array(
>                     'rule' => 'numeric',
>                     'message' => 'numeric score only'
>                 ),
>                 'between' => array(
>                     'rule' => array('between', 1, 5),
>                     'message' => '1 - 5 only'
>                 ),
>             )
>         );}
>
> test/models/rating.test.php:
>         function testScoreRange() {
>             $this->data = array(
>                         'score'  => 10,
>                         'url_id'  => 10,
>             );
>             $this->Rating->create();
>             $this->Rating->set($this->data);
>             $result = $this->Rating->save();
>
>             $this->assertFalse($result);
>
>         }
>
> On 7月22日, 下午1時57分, Joe  wrote:
>
>
>
> > same here
>
> > On 7月10日, 下午5時03分, williamn  wrote:
>
> > > Hi all,
>
> > > Did this ever happened to anyone here? :)
>
> > > On Jun 7, 8:14 pm, williamn  wrote:
>
> > > > Hi all,
>
> > > > I have a simple model like below
>
> > > > class Department extends AppModel {
>
> > > >         var $name = 'Department';
> > > >         var $validate = array(
> > > >                 'code' => array('notempty'),
> > > >                 'name' => array('notempty'),
> > > >                 'abbreviation' => array('notempty'),
> > > >                 'phone_num' => array('notempty')
> > > >         );
>
> > > > }
>
> > > > and create a simpletestlike this
>
> > > > function testInvalidCreate() {
> > > >         $this->Department->create();
> > > >         $this->assertFalse($this->Department->save());
>
> > > > }
>
> > > > correct me if I'm wrong, $this->Department->save() should return false
> > > > right? but in my case it returning an array.
>
> > > > Any suggestion?
>
> > > > Thanks.
--~--~-~--~~~---~--~~
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: Model validation on unit testing

2009-07-22 Thread Joe

model/rating.php
class Rating extends AppModel {

var $name = 'Rating';
var $validate = array(
'score' => array(
'numeric' => array(
'rule' => 'numeric',
'message' => 'numeric score only'
),
'between' => array(
'rule' => array('between', 1, 5),
'message' => '1 - 5 only'
),
)
);
}
test/models/rating.test.php:
function testScoreRange() {
$this->data = array(
'score'  => 10,
'url_id'  => 10,
);
$this->Rating->create();
$this->Rating->set($this->data);
$result = $this->Rating->save();

$this->assertFalse($result);

}

On 7月22日, 下午1時57分, Joe  wrote:
> same here
>
> On 7月10日, 下午5時03分, williamn  wrote:
>
>
>
> > Hi all,
>
> > Did this ever happened to anyone here? :)
>
> > On Jun 7, 8:14 pm, williamn  wrote:
>
> > > Hi all,
>
> > > I have a simple model like below
>
> > > class Department extends AppModel {
>
> > >         var $name = 'Department';
> > >         var $validate = array(
> > >                 'code' => array('notempty'),
> > >                 'name' => array('notempty'),
> > >                 'abbreviation' => array('notempty'),
> > >                 'phone_num' => array('notempty')
> > >         );
>
> > > }
>
> > > and create a simpletestlike this
>
> > > function testInvalidCreate() {
> > >         $this->Department->create();
> > >         $this->assertFalse($this->Department->save());
>
> > > }
>
> > > correct me if I'm wrong, $this->Department->save() should return false
> > > right? but in my case it returning an array.
>
> > > Any suggestion?
>
> > > Thanks.
--~--~-~--~~~---~--~~
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: Model validation on unit testing

2009-07-21 Thread Joe

same here

On 7月10日, 下午5時03分, williamn  wrote:
> Hi all,
>
> Did this ever happened to anyone here? :)
>
> On Jun 7, 8:14 pm, williamn  wrote:
>
>
>
> > Hi all,
>
> > I have a simple model like below
>
> > class Department extends AppModel {
>
> >         var $name = 'Department';
> >         var $validate = array(
> >                 'code' => array('notempty'),
> >                 'name' => array('notempty'),
> >                 'abbreviation' => array('notempty'),
> >                 'phone_num' => array('notempty')
> >         );
>
> > }
>
> > and create a simpletestlike this
>
> > function testInvalidCreate() {
> >         $this->Department->create();
> >         $this->assertFalse($this->Department->save());
>
> > }
>
> > correct me if I'm wrong, $this->Department->save() should return false
> > right? but in my case it returning an array.
>
> > Any suggestion?
>
> > Thanks.
--~--~-~--~~~---~--~~
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: aco problems

2009-06-15 Thread Joe

ok. @1.2.3.8166 Stable @2009-06-15

far more investigation on ACL.
solved most question in previous post, but one new question:

i have to embed acl->check in every controllers(or in app_controller
beforeFilter()?)
ACL do not check the access before load the page?

below is the answer to the previous questions:

for aros, use $actsAs in models as written in the cookbook tutorial,
aros do not have alias, and groups have its model.
follow the tutorial is good enough to have a working group/user
association with aro

for aco, the building aco code in cookbook works,
and disclosed more settings and "general behavior" that do not
documented elsewhere.
for controllers based aco, just use alias but not "model" and
"foreign_id"
just use the code to generate aco, do not build it yourself/in
console.
remember to create a root "controller" node as well.

setting permission:
even more crappy. i build it in console.
use syntax like
cake acl check Group.1 Users all
as aro do not have alias, use model and foreign_id
aco use alias
then users under Group model will work.

On 6月14日, 下午9時31分, Joe  wrote:
> from the cookbook of cakephp, there is not an example of creating
> acos.
>
> how 'Weapons' is associated with controllers? var $name =
> W'eaponsController'; ?
> but i cannot get through it.
>
> and how aros is assiociated with a logged in user?
> it will find the user id in session automatically?
>
> i have
> Aro tree:
> ---
>   [8]administrator
>
> [14]User.6
>
>   [9]editor
>
>   [10]authorized
>
> [15]User.23
>
> ---
>
> when i logged in by user.6, cakephp will know i am in group 8 also?
> but "$this->Acl->deny('authorized','Users');"
> do not work

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



aco problems

2009-06-14 Thread Joe

from the cookbook of cakephp, there is not an example of creating
acos.

how 'Weapons' is associated with controllers? var $name =
W'eaponsController'; ?
but i cannot get through it.

and how aros is assiociated with a logged in user?
it will find the user id in session automatically?

i have
Aro tree:
---
  [8]administrator

[14]User.6

  [9]editor

  [10]authorized

[15]User.23

---

when i logged in by user.6, cakephp will know i am in group 8 also?
but "$this->Acl->deny('authorized','Users');"
do not work

--~--~-~--~~~---~--~~
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: Unique query

2009-04-11 Thread Joe Critchley

Hi Dave.

If your Post and User models both have a HABTM relationship to
Bookmark, then you can use the ** "unique" => true ** parameter in the
association.

This means that if it does find a duplicate record, it will override
it.

I hope this helps.

On Apr 11, 6:11 pm, "Dave Maharaj :: WidePixels.com"
 wrote:
> I am trying to query a table to determine if the record exists as I do not
> want duplicates but not sure if this is correct.
>
> $results = $this->find('first', array('conditions' =>
> array('Bookmark.user_id' => $user_id, 'Bookmark.post_id' => $post_id)));
> debug($results);
>
> so if the user_id and the post_id are in the same row then do not save the
> bookmark because it already exists.
>
> Is this right?
>
> Dave
--~--~-~--~~~---~--~~
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: Getting "5 Related" Books via multiple Genres (HABTM ) from within Book view() and without requestAction

2009-04-11 Thread Joe Critchley

You've currently got your similar() function in your
genres_controller, whereas the primary model for the query is the Book
model (as it's finding related *books*, not genres).

I believe the following would be a more scalable approach.

Place your similar() function into your Book model. (So it would
be ... $similarBooks = $this->find('all') and just
return your results).

Then call this model's function from wherever you need it, whether it
be the genres_controller:

$this->Genre->Book->similar($id);

... or your books_controller

$this->Book->similar($id);

 or even from a completely unrelated model (use sparingly)

$Book = ClassRegistry::init('Book');
$similar = $Book->similar();

It's possible that I'm missing the actual issue, but two important
points: 1) never use requestAction (as you probably know), and 2)
there should never be any variables in your views that aren't
available in your controllers, because there shouldn't be any new
variables assigned. If this is ever required, you're likely in need of
a Helper class. And yes, it would be worth looking at creating
elements for anything like "Similar books", or "5 Related Authors".
You can pass variables into elements.

I hope this helps.

On Apr 11, 5:00 pm, Mike Cook  wrote:
> In my books view.ctp, I want to have a list of 5 books that are
> related via the genres data, which has a HABTM relationship. Although
> I can do this by placing a function similar() in the
> genres_controller, I have to call it from the view with requestAction.
>
> // genres_controller.php
>   function similar($id = null) {
>     $similarbooks = $this->Genre->Book->find('all', array(
>       'contain' => array(
>         'Author' => array('fields' => array('id', 'slug')),
>       ),
>       'fields' => array('id', 'slug', 'title'),
>       'limit' => 5,
>       'order' => 'RAND()',
>     ));
>     $this->set(compact('similarbooks'));
>   }
>
> // Book view.ctp
>   $results = $this->requestAction('/genres/similar/' . $id);
>
> Of course I don't want to really use requestAction (the only place so
> far I have used it!) but I would also like to be able to bring up 5
> random books from ALL the genres the book is assigned to - at the
> moment I am just searching on one genre id.
>
> I also know that this approach is not very good if I wish to include 5
> books which are related to say, both Genre and Author.
>
> At some point down the line I would also like to include a "5 Related
> Authors" list, so I guess I need a more modular approach (would
> elements be it?) - the problem is that I am completely stumped, even
> after a week looking at this!
>
> The solution I currently have is better than nothing, but I would be
> very grateful if anyone has an idea on how I could achieve a proper
> solution.
>
> Many thanks, Mike.
--~--~-~--~~~---~--~~
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: Use another model function from an unrelated model

2009-04-08 Thread Joe Critchley

You should probably use the ClassRegistry class.

You can instantiate an unrelated model by doing the following:

$ModelName = ClassRegistry::init('ModelName');

... and then use the functions from that variable, e.g...

$ModelName->delete($id);

Hope this helps.

On Apr 8, 10:55 pm, lemp  wrote:
> I’m building a statistical application and I need to access a function
> that return reference values from a model that is unrelated with the
> model where I need this data.
>
> What is the best way to achieve this?
--~--~-~--~~~---~--~~
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: xmlHelper - serialize

2009-03-09 Thread Joe Critchley

http://api.cakephp.org/class/xml-helper#method-XmlHelperserialize

You can do the following:

$xml->serialize($yourData, array('format' => 'elements'));

On Mar 9, 7:45 pm, tobi_one  wrote:
> Hi,
>
> I'm using the xmlHelper and serialize to output an array as XML. This
> works ok, except that the outputed XML uses "attributes" 
> (http://www.w3schools.com/XML/xml_attributes.asp) instead of standard
> elements.
>
> Is there a way to change this behaviour? I see there is an option
> attribute with serialize, but unfortunately no documentation on what
> could be specified there...
>
> Cheers,
> Tobi
--~--~-~--~~~---~--~~
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 create models for complex database designs like this?

2009-03-09 Thread Joe Critchley

Would it not be better to structure it through a HABTM relationship,
using "Cast" as your 'with' model?

So, Movie HABTM Celebrity through Cast.
and Celebrity HABTM Movie through Cast.

On Mar 8, 12:40 pm, Rajesh  wrote:
> I am working on movie site. Client have movie records in following
> structure.
>
> CREATE TABLE IF NOT EXISTS `movies` (
>   `id` int(50) NOT NULL AUTO_INCREMENT,
>   `movieName` varchar(500) NOT NULL,
>   `year` int(11) DEFAULT NULL,
>   PRIMARY KEY (`id`)
> ) ENGINE=MyISAM  DEFAULT CHARSET=utf8  ;
> -- 
> CREATE TABLE IF NOT EXISTS `celebrities` (
>   `id` int(11) NOT NULL AUTO_INCREMENT,
>   `name` varchar(250) NOT NULL,
>   PRIMARY KEY (`id`)
> ) ENGINE=MyISAM  DEFAULT CHARSET=utf8  ;
> -- 
> CREATE TABLE IF NOT EXISTS `casts` (
>   `movie_id` int(50) NOT NULL,
>   `role` varchar(200) DEFAULT NULL,
>   `celebrity_id` int(11) NOT NULL DEFAULT '0',
>   KEY `movieid` (`movie_id`)
> ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
>
> As you can see movies has casts, casts table contains movie_id and
> celebrity_id. celebrities master table is for storing all master
> celebrity names.
>
> Now my problem is i have created models for movie and celebrity like
> movie hasmany cast. In movie page aim getting movie details along
> related casts. But celebrity_is is showing id instead of name how
> can i get celebrity name instead of id. Please help me.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



  1   2   >