Re: cakephp best practice

2015-06-03 Thread Tracy Floyd
If you are just looking to make it easier for them to find an option in a 
large list, I would implement something like https://select2.github.io/ 
(see the remote data section in the examples if you have too many sales 
groups to pre-populate the list on page load)

If the user needs to fill out multiple fields tin order to perform a more 
advanced search then it would depend on the overall user experience you 
want to deliver - revealing a form in the page or via a modal is definitely 
a viable ui pattern.



On Tuesday, June 2, 2015 at 3:18:19 PM UTC-4, Elton Antunes wrote:
>
> Hi there,
>
> I'm new to web development and I've been studying cakephp and I have this 
> situation where I want to know the best practice.
>
> Imagine a user creating a new Customer in the application, in the form he 
> has to choose the customer's sales group, and this table has so many 
> records, that's using a drop down list isn't a viable option.
>
> I was thinking in the user press a button, then open a modal window. This 
> new window would have a grid, with search options (for filtering the data) 
> and the user would choose one, and go back to the original form, bringing 
> back the sales group selected by the user.
>
> What's the name of this technique, and is it a good option? How to do this 
> in cakephp?
>
> Best regards
>

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


cakephp best practice

2015-06-02 Thread Elton Antunes
Hi there,

I'm new to web development and I've been studying cakephp and I have this 
situation where I want to know the best practice.

Imagine a user creating a new Customer in the application, in the form he 
has to choose the customer's sales group, and this table has so many 
records, that's using a drop down list isn't a viable option.

I was thinking in the user press a button, then open a modal window. This 
new window would have a grid, with search options (for filtering the data) 
and the user would choose one, and go back to the original form, bringing 
back the sales group selected by the user.

What's the name of this technique, and is it a good option? How to do this 
in cakephp?

Best regards

-- 
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: datetime and timezone best practice?

2015-03-22 Thread OJ Tibi - @ojtibi
Hello,

I would do something like this.

1. Make sure a timezone string is saved with the user's profile. Once user 
logs in, the timezone string can now be retrieved using the Auth component 
($this->Auth->user('timezone')).
2. Let the user enter the date you need, hopefully in a usable format.
3. Use CakeTime::toServer($dateString, $timezone) to convert the user's 
input back to UTC (which you already set your server's time to). 
$dateString should be your user's input (strtotime parseable), and 
$timezone should be the timezone string saved with your user's profile (see 
#1).
4. ...
5. Profit.

HTH.
OJ

On Friday, March 20, 2015 at 4:29:08 PM UTC+8, Andreas Witte wrote:
>
> Hello everbody,
>
> I would kindly like to attract your attention to a question I wrote on 
> stackoverflow yesterday.
>
> http://stackoverflow.com/questions/29127162/how-to-define-timezone-in-cakephp-datetime-form-object
>  
> <http://www.google.com/url?q=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F29127162%2Fhow-to-define-timezone-in-cakephp-datetime-form-object&sa=D&sntz=1&usg=AFQjCNGw8PZb5uzJc3oWqK77kC8K-PAK0w>
>
> Has anyone any best practice tutorial or any advice how to solve it?
>
> Thanks in advance and kind regards,
> Andreas
>
>

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


datetime and timezone best practice?

2015-03-20 Thread Andreas Witte
Hello everbody,

I would kindly like to attract your attention to a question I wrote on 
stackoverflow yesterday.
http://stackoverflow.com/questions/29127162/how-to-define-timezone-in-cakephp-datetime-form-object

Has anyone any best practice tutorial or any advice how to solve it?

Thanks in advance and kind regards,
Andreas

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


cakephp tests best practice

2015-01-22 Thread Alessandro Minoccheri
Hi all,
I'm writing here to understand the right iter for cakephp tests.

I mean about this issue: 
https://github.com/cakephp/cakephp/issues/5693#issuecomment-70532382

So my question is:
How to make good tests?
Because in cakephp documentation isn't explained well I think or I haven0t 
understand the best practice to create tests.

What I have done in my cakephp site:
- Created default database
- Created test database
- Populated the default database
- Exported all database and imported into the tests database with all 
records
- Started to create test
- Created fixtures with declarations of fields and records
- Created tests model that load fixtures.

I thinked that when I'm starting to test when the framework load fixtures 
delete the table of the fixtures and redraw it with field and records.
Is wrong right?
Database table are dropped after tests I have read

Ok, so what is the good way to insert my records into database tests?
Repopulate the database tests from phpmyadmin for example? But in this way 
what is the purpose of the $records array in fixtures?

What is the right iter to create a great tests workflow?

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: Best practice for changing entity in afterSave

2014-10-08 Thread Rob Cowie
OK, so I was being stupid.

I had missed adding the field to the entity $_accessible array.

I have it all working, thanks.

On Wednesday, 8 October 2014 09:15:40 UTC+1, Rob Cowie wrote:
>
> That is exactly the case. The entity returned by the save function does 
> not have the changes applied in the afterSave.
>
> I'll put an example on Github to demonstrate my problem.
>
>
>
> On Tuesday, 7 October 2014 15:20:10 UTC+1, heavyKevy wrote:
>>
>> It seems to me that the entity used to save the record in the save call 
>> is updated and available in the controller after the save call is 
>> complete...
>> Are you saying that modifications in that Entity are not showing up in 
>> the controller afterwards?
>>
>> On Monday, October 6, 2014 4:34:41 PM UTC+7, Rob Cowie wrote:
>>>
>>> Hi all, back again with another question:
>>>
>>> In our old 1.3 app, I used $this->someValue = $someData; in an afterSave 
>>> function to pass values back up to a controller.
>>>
>>> I have tried to use a $entity->set('someValue', $someData); in an 
>>> afterSave in the new cake3 table model, but this entity does not appear to 
>>> be available to me back at the controller layer. 
>>>
>>> Has any one got any pointers as to the correct way to achieve this (That 
>>> is, get a value at the controller, that has been set at the table model in 
>>> afterSave)?
>>>
>>> Thanks in advance.
>>>
>>

-- 
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: Best practice for changing entity in afterSave

2014-10-08 Thread Rob Cowie
That is exactly the case. The entity returned by the save function does not 
have the changes applied in the afterSave.

I'll put an example on Github to demonstrate my problem.



On Tuesday, 7 October 2014 15:20:10 UTC+1, heavyKevy wrote:
>
> It seems to me that the entity used to save the record in the save call is 
> updated and available in the controller after the save call is complete...
> Are you saying that modifications in that Entity are not showing up in the 
> controller afterwards?
>
> On Monday, October 6, 2014 4:34:41 PM UTC+7, Rob Cowie wrote:
>>
>> Hi all, back again with another question:
>>
>> In our old 1.3 app, I used $this->someValue = $someData; in an afterSave 
>> function to pass values back up to a controller.
>>
>> I have tried to use a $entity->set('someValue', $someData); in an 
>> afterSave in the new cake3 table model, but this entity does not appear to 
>> be available to me back at the controller layer. 
>>
>> Has any one got any pointers as to the correct way to achieve this (That 
>> is, get a value at the controller, that has been set at the table model in 
>> afterSave)?
>>
>> Thanks in advance.
>>
>

-- 
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: Best practice for changing entity in afterSave

2014-10-07 Thread heavyKevy
It seems to me that the entity used to save the record in the save call is 
updated and available in the controller after the save call is complete...
Are you saying that modifications in that Entity are not showing up in the 
controller afterwards?

On Monday, October 6, 2014 4:34:41 PM UTC+7, Rob Cowie wrote:
>
> Hi all, back again with another question:
>
> In our old 1.3 app, I used $this->someValue = $someData; in an afterSave 
> function to pass values back up to a controller.
>
> I have tried to use a $entity->set('someValue', $someData); in an 
> afterSave in the new cake3 table model, but this entity does not appear to 
> be available to me back at the controller layer. 
>
> Has any one got any pointers as to the correct way to achieve this (That 
> is, get a value at the controller, that has been set at the table model in 
> afterSave)?
>
> Thanks in advance.
>

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


Best practice for changing entity in afterSave

2014-10-06 Thread Rob Cowie
Hi all, back again with another question:

In our old 1.3 app, I used $this->someValue = $someData; in an afterSave 
function to pass values back up to a controller.

I have tried to use a $entity->set('someValue', $someData); in an afterSave 
in the new cake3 table model, but this entity does not appear to be 
available to me back at the controller layer. 

Has any one got any pointers as to the correct way to achieve this (That 
is, get a value at the controller, that has been set at the table model in 
afterSave)?

Thanks in advance.

-- 
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: Best practice to get menu array

2014-09-19 Thread Dario Savella
By the look of it what you need is a Plugin and inside the Models for the 
tables you mentioned and at least an Helper to produce the HTML output.
I recently used the MenuBuilder Plugin. You will have to add the logic to 
retrieve the menu from your Models though.

On Saturday, September 13, 2014 10:57:21 AM UTC+2, Sam Clauw wrote:
>
> I have 2 tables which hold pages information: "pages" and "cms_pages". Now 
> I want to build a menu on every website page with the records within. 
> What's the best practice for this?
>
> Should I make a behavior that loads in the "pages" and "cms_pages" model? 
> If yes, where (and how) should I make the call to that behavior? In the 
> AppModel class?
>

-- 
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: Best practice to get menu array

2014-09-18 Thread Sam Clauw
Can I bump my topic again? :)
I realy hope I'll find an answer on this one, it's all about keeping the 
MVC as clear as possible ;)

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


Best practice to get menu array

2014-09-13 Thread Sam Clauw
I have 2 tables which hold pages information: "pages" and "cms_pages". Now 
I want to build a menu on every website page with the records within. 
What's the best practice for this?

Should I make a behavior that loads in the "pages" and "cms_pages" model? 
If yes, where (and how) should I make the call to that behavior? In the 
AppModel class?

-- 
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: Best practice: using class on all pages

2014-08-14 Thread Sam Clauw
Okay, outputting an  structure with an element is indeed very 
usefull. It can appear in multiple areas on the template files. I 
understand that I should do something like:

echo $this->element('mainmanu', array(
'tree' => array(...),
'active' => array(...)
));

The tree array holds the records and should be calculated with a given 
depth.
The active array holds the parent nodes of the active node.

So far so good I guess? But what do you exactly mean with getting the data 
with a request action?
Sorry if this is a silly question :)

-- 
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 Best practice for checkboxes instead of multiselect list

2014-08-12 Thread Dieter Gribnitz
For some reason I always find the answer the second after I post a question.
Just found the MultiCheckbox widget.
This solves my issu 

-- 
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 Best practice for checkboxes instead of multiselect list

2014-08-12 Thread Dieter Gribnitz
I am trying to implement jstree for a multi select list.
I would like to use checkboxes in order to reference the id's of the 
options via javascript.
Is there and easy way to print a multi select list as checkboxes.
I see it says something about this ability in the documentation but I can't 
seem to find the correct syntax to get this to work.
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: Best practice: using class on all pages

2014-08-10 Thread thanat
I would use element for rendering and request action to get the correct 
data for menu. 

On Monday, August 11, 2014 12:26:47 AM UTC+2, Sam Clauw wrote:
>
> I want to write a class that use a left value and a depth value so it can 
> print an  output for a menu. I want it to be able in my CMS plugin 
> AND in my front-end pages. My question is: where should I put that class? 
> Some options I've been thinking on:
>
>1. Everything in AppModel.php (disadvantage: file will be too long if 
>there are other functions here).
>2. Making a behavior and call it's functions in a helper.
>
> Is one of the above options OK to use, or is there a better way to do so?
>

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


Best practice: using class on all pages

2014-08-10 Thread Sam Clauw
I want to write a class that use a left value and a depth value so it can 
print an  output for a menu. I want it to be able in my CMS plugin 
AND in my front-end pages. My question is: where should I put that class? 
Some options I've been thinking on:

   1. Everything in AppModel.php (disadvantage: file will be too long if 
   there are other functions here).
   2. Making a behavior and call it's functions in a helper.

Is one of the above options OK to use, or is there a better way to do so?

-- 
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: cake 3 - best practice to develop backend app with one or more frontend apps sharing cake lib

2014-03-30 Thread Alberto Pagliarini
I think you are right about http comunications and probably we will
introduce also a complete backend API rest to use backend data with every
type of frontend app (not only cake app).
But having the possibility to use directly backend core in your frontend
app is more flexible and you don't lose time on http requests improving the
frontend performance.

However maybe another approch could be use the same namespace for frontend
and backend app and in frontend app add to autoloader cake core and some
exposed backend directories (for example App/Model dir). In this way maybe
it doesn't need to explicit the class name. But I have to test it and I
have to think if it's a good idea.

alberto


2014-03-29 12:20 GMT+01:00 mark_story :

> What kinds of things are you thinking woud mak these kinds of situations
> easier? Plugins get you most of the way but I am guessing there are unmet
> requirements/expectations.
>
> You mention you have two separate applications. Have you considered making
> two applications that communicate over http? Separate webservices are used
> in larger organisations with great results.
>
> -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 a topic in the
> Google Groups "CakePHP" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/cake-php/MHdseZKF4ts/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.
>



-- 
-- bato ---

-- 
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: cake 3 - best practice to develop backend app with one or more frontend apps sharing cake lib

2014-03-29 Thread mark_story
What kinds of things are you thinking woud mak these kinds of situations 
easier? Plugins get you most of the way but I am guessing there are unmet 
requirements/expectations.

You mention you have two separate applications. Have you considered making two 
applications that communicate over http? Separate webservices are used in 
larger organisations with great results.

-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: cake 3 - best practice to develop backend app with one or more frontend apps sharing cake lib

2014-03-28 Thread gersonfs
Hi Alberto, 

I have this same question. I have several projects that share the same 
backend app.  It would be nice if we had in CakePHP 3 an easier and 
standardized way to do this. The backend in a separate app facilitates and 
simplifies the development of frontends. An easy way for projects with 
multiple app's.


Em terça-feira, 25 de março de 2014 20h19min20s UTC-3, bato escreveu:
>
> Hi there,
>
> I played a bit with new ORM and now I'm starting to port BEdita to Cake 3.
> BEdita is a Semantic Content Management Framework developed with cake 1.3. 
> The backend is a cake app that can manage multiple frontends data. Every 
> frontend is a cake app too that uses a set of api that are exposed from 
> backend app.
>
> Backend and frontend apps share cakephp lib and backend models, behaviors, 
> helpers are reachable from frontends since they are added to paths with 
> App::build().
>
> Now I try to figure out as reproduce the "same" situations with cake 3 and 
> I would ask some advice.
>
> I'm starting creating the backend app with composer, then I added frontend 
> app by hand beacuse I want to reuse cake core installed in backend app.
> So my directory structure is
>
>- bedita: containing app (Bedita\\ namespace) and vendor with cakephp
>- frontend-app: clean cakephp app skeleton
>
>
> ├── bedita
> │   ├── Bedita
> │   ├── Module
> │   ├── Plugin
> │   ├── Test
> │   ├── tmp
> │   ├── vendor
> │   └── webroot
> └── frontend-app
> ├── App
> ├── Plugin
> ├── Test
> ├── tmp
> ├── vendor
> └── webroot
>
> To use cake and bedita in frontend app I managed App/config/paths.php and 
> App/config/bootstrap.php
>
> In App/config/paths.php I added the path to bedita folder and modified 
> CAKE_CORE_INCLUDE_PATH to use that.
> In App/config/bootstrap.php I change composer autoload path to 
> bedita/vendor/autoload.php 
> and added to it App namespace
>
> // Use composer to load the autoloader.
> if (file_exists(BEDITA_CORE_PATH . '/vendor/autoload.php')) {
> $loader = require BEDITA_CORE_PATH . '/vendor/autoload.php';
> $loader->addPsr4('App\\', APP);
> }
>
> After that in frontend app PagesController I am able to do:
>
> $images = TableRegistry::get('Images', [
> 'className' => 'Bedita\Model\Table\ImagesTable'
> ]);
>
> The only thing I had to pay attention is how to add behavior in Bedita 
> Table objects. I had to specify the behavior className to avoid errors 
> using those Table objects in frontend app.
>
> $this->addBehavior('BeditaObject', [
> 'className' => 'Bedita\Model\Behavior\BeditaObjectBehavior'
> ]);
>
>
> So I ask you CakePHP core dev/guru if it is the right way to handle this 
> case or if you have some suggestion or advice.
>
> regards
> Alberto
>
>
>

-- 
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: cake 3 - best practice to develop backend app with one or more frontend apps sharing cake lib

2014-03-27 Thread euromark
Ah ok, well in that case it might be an approach.

Am Donnerstag, 27. März 2014 14:14:16 UTC+1 schrieb bato:
>
> Well,
>
> I think you're right, for classic simple frontend/backend app (one 
> frontend with one backend).
> But what about have two completely different frontends with different urls?
>
> Our backend handle multiple sites data and can share content between them.
> Every frontend is a completely separate project and it uses backend api to 
> get its data.
>
>
> 2014-03-27 11:50 GMT+01:00 euromark >:
>
>> Trust me, you will do yourself and everyone using your app a favor if you 
>> don't separate the frontend and backend into two apps.
>> Most of us would just use plugins and/or admin prefixing to cleanly 
>> separate the two inside the app.
>>
>> /
>> /frontend-controller/
>>
>> /admin
>> /admin/backend-controller
>>
>> Routing like this works just fine in all cases I have ever encountered. 
>> And it is what 99% of all people would expect.
>> One should not overengeneer stuff - its like shooting yourself in the leg 
>> here.
>>
>>
>> Am Mittwoch, 26. März 2014 09:57:46 UTC+1 schrieb bato:
>>>
>>> Hi Mark,
>>> thanks for the answer :)
>>> Do you intend using Plugin for backend or frontend? However the common 
>>> use case we have to handle is:
>>>
>>>
>>>- frontends and backend live on the same server and are served by 
>>>the same web server
>>>- one backend used to manage data for two or more frontends
>>>- backend and each frontends have different url. Example:
>>>   - backend: http://admin.customer-name.com 
>>>   - frontend 1: http://site1.com
>>>   - frontend 2: http://site2.org
>>>   - etc...
>>>
>>> Is it possible handle with plugins this situation?
>>>
>>> On other side we like having separate app for backend and frontends 
>>> because it give us the possibility to use different plugins for every app 
>>> and have frontend as app seems more polished.
>>> But if there is a simple way to handle it with plugins I like to know so 
>>> we can think about it.
>>>
>>>
>>> Alberto
>>>
>>>
>>>
>>> 2014-03-26 2:41 GMT+01:00 mark_story :
>>>
  Have you considered using plugins? If the 'backend' and 'frontend' 
 application run in the same process/server you could probably use plugins 
 quite nicely. If they run on separate servers it gets a bit more 
 complicated.

 By using a plugin you can use basic composer features to install the 
 backend code into the frontend one and avoid having to define the full 
 classname everywhere as you can use Plugin.Foo style class names in most 
 places (if there are className options that don't support Plugin.Class let 
 us know)

 -Mark

 On Tuesday, 25 March 2014 19:19:20 UTC-4, bato wrote:
>
> Hi there,
>
> I played a bit with new ORM and now I'm starting to port BEdita to 
> Cake 3.
> BEdita is a Semantic Content Management Framework developed with cake 
> 1.3. The backend is a cake app that can manage multiple frontends data. 
> Every frontend is a cake app too that uses a set of api that are exposed 
> from backend app.
>
> Backend and frontend apps share cakephp lib and backend models, 
> behaviors, helpers are reachable from frontends since they are added to 
> paths with App::build().
>
> Now I try to figure out as reproduce the "same" situations with cake 3 
> and I would ask some advice.
>
> I'm starting creating the backend app with composer, then I added 
> frontend app by hand beacuse I want to reuse cake core installed in 
> backend 
> app.
> So my directory structure is
>
>- bedita: containing app (Bedita\\ namespace) and vendor with 
>cakephp
>- frontend-app: clean cakephp app skeleton
>
>
> ├── bedita
> │   ├── Bedita
> │   ├── Module
> │   ├── Plugin
> │   ├── Test
> │   ├── tmp
> │   ├── vendor
> │   └── webroot
> └── frontend-app
> ├── App
> ├── Plugin
> ├── Test
> ├── tmp
> ├── vendor
> └── webroot
>
> To use cake and bedita in frontend app I managed App/config/paths.phpand 
> App/config/bootstrap.php
>
> In App/config/paths.php I added the path to bedita folder and 
> modified CAKE_CORE_INCLUDE_PATH to use that.
> In App/config/bootstrap.php I change composer autoload path to 
> bedita/vendor/autoload.php 
> and added to it App namespace
>
> // Use composer to load the autoloader.
> if (file_exists(BEDITA_CORE_PATH . '/vendor/autoload.php')) {
> $loader = require BEDITA_CORE_PATH . '/vendor/autoload.php';
> $loader->addPsr4('App\\', APP);
> }
>
> After that in frontend app PagesController I am able to do:
>
> $images = TableRegistry::get('Images', [
> 'className' => 'Bedita\Model\Table\ImagesTable'
> ]);
>
> The only thing I had to pay at

Re: cake 3 - best practice to develop backend app with one or more frontend apps sharing cake lib

2014-03-27 Thread Alberto Pagliarini
Well,

I think you're right, for classic simple frontend/backend app (one frontend
with one backend).
But what about have two completely different frontends with different urls?

Our backend handle multiple sites data and can share content between them.
Every frontend is a completely separate project and it uses backend api to
get its data.


2014-03-27 11:50 GMT+01:00 euromark :

> Trust me, you will do yourself and everyone using your app a favor if you
> don't separate the frontend and backend into two apps.
> Most of us would just use plugins and/or admin prefixing to cleanly
> separate the two inside the app.
>
> /
> /frontend-controller/
>
> /admin
> /admin/backend-controller
>
> Routing like this works just fine in all cases I have ever encountered.
> And it is what 99% of all people would expect.
> One should not overengeneer stuff - its like shooting yourself in the leg
> here.
>
>
> Am Mittwoch, 26. März 2014 09:57:46 UTC+1 schrieb bato:
>>
>> Hi Mark,
>> thanks for the answer :)
>> Do you intend using Plugin for backend or frontend? However the common
>> use case we have to handle is:
>>
>>
>>- frontends and backend live on the same server and are served by the
>>same web server
>>- one backend used to manage data for two or more frontends
>>- backend and each frontends have different url. Example:
>>   - backend: http://admin.customer-name.com
>>   - frontend 1: http://site1.com
>>   - frontend 2: http://site2.org
>>   - etc...
>>
>> Is it possible handle with plugins this situation?
>>
>> On other side we like having separate app for backend and frontends
>> because it give us the possibility to use different plugins for every app
>> and have frontend as app seems more polished.
>> But if there is a simple way to handle it with plugins I like to know so
>> we can think about it.
>>
>>
>> Alberto
>>
>>
>>
>> 2014-03-26 2:41 GMT+01:00 mark_story :
>>
>>> Have you considered using plugins? If the 'backend' and 'frontend'
>>> application run in the same process/server you could probably use plugins
>>> quite nicely. If they run on separate servers it gets a bit more
>>> complicated.
>>>
>>> By using a plugin you can use basic composer features to install the
>>> backend code into the frontend one and avoid having to define the full
>>> classname everywhere as you can use Plugin.Foo style class names in most
>>> places (if there are className options that don't support Plugin.Class let
>>> us know)
>>>
>>> -Mark
>>>
>>> On Tuesday, 25 March 2014 19:19:20 UTC-4, bato wrote:

 Hi there,

 I played a bit with new ORM and now I'm starting to port BEdita to Cake
 3.
 BEdita is a Semantic Content Management Framework developed with cake
 1.3. The backend is a cake app that can manage multiple frontends data.
 Every frontend is a cake app too that uses a set of api that are exposed
 from backend app.

 Backend and frontend apps share cakephp lib and backend models,
 behaviors, helpers are reachable from frontends since they are added to
 paths with App::build().

 Now I try to figure out as reproduce the "same" situations with cake 3
 and I would ask some advice.

 I'm starting creating the backend app with composer, then I added
 frontend app by hand beacuse I want to reuse cake core installed in backend
 app.
 So my directory structure is

- bedita: containing app (Bedita\\ namespace) and vendor with
cakephp
- frontend-app: clean cakephp app skeleton


 ├── bedita
 │   ├── Bedita
 │   ├── Module
 │   ├── Plugin
 │   ├── Test
 │   ├── tmp
 │   ├── vendor
 │   └── webroot
 └── frontend-app
 ├── App
 ├── Plugin
 ├── Test
 ├── tmp
 ├── vendor
 └── webroot

 To use cake and bedita in frontend app I managed App/config/paths.phpand
 App/config/bootstrap.php

 In App/config/paths.php I added the path to bedita folder and modified
 CAKE_CORE_INCLUDE_PATH to use that.
 In App/config/bootstrap.php I change composer autoload path to 
 bedita/vendor/autoload.php
 and added to it App namespace

 // Use composer to load the autoloader.
 if (file_exists(BEDITA_CORE_PATH . '/vendor/autoload.php')) {
 $loader = require BEDITA_CORE_PATH . '/vendor/autoload.php';
 $loader->addPsr4('App\\', APP);
 }

 After that in frontend app PagesController I am able to do:

 $images = TableRegistry::get('Images', [
 'className' => 'Bedita\Model\Table\ImagesTable'
 ]);

 The only thing I had to pay attention is how to add behavior in Bedita
 Table objects. I had to specify the behavior className to avoid errors
 using those Table objects in frontend app.

 $this->addBehavior('BeditaObject', [
 'className' => 'Bedita\Model\Behavior\BeditaObjectBehavior'
 ]);


 So I

Re: cake 3 - best practice to develop backend app with one or more frontend apps sharing cake lib

2014-03-27 Thread euromark
Trust me, you will do yourself and everyone using your app a favor if you 
don't separate the frontend and backend into two apps.
Most of us would just use plugins and/or admin prefixing to cleanly 
separate the two inside the app.

/
/frontend-controller/

/admin
/admin/backend-controller

Routing like this works just fine in all cases I have ever encountered. And 
it is what 99% of all people would expect.
One should not overengeneer stuff - its like shooting yourself in the leg 
here.


Am Mittwoch, 26. März 2014 09:57:46 UTC+1 schrieb bato:
>
> Hi Mark,
> thanks for the answer :)
> Do you intend using Plugin for backend or frontend? However the common use 
> case we have to handle is:
>
>
>- frontends and backend live on the same server and are served by the 
>same web server
>- one backend used to manage data for two or more frontends
>- backend and each frontends have different url. Example:
>   - backend: http://admin.customer-name.com 
>   - frontend 1: http://site1.com
>   - frontend 2: http://site2.org
>   - etc...
>
> Is it possible handle with plugins this situation?
>
> On other side we like having separate app for backend and frontends 
> because it give us the possibility to use different plugins for every app 
> and have frontend as app seems more polished.
> But if there is a simple way to handle it with plugins I like to know so 
> we can think about it.
>
>
> Alberto
>
>
>
> 2014-03-26 2:41 GMT+01:00 mark_story >:
>
>> Have you considered using plugins? If the 'backend' and 'frontend' 
>> application run in the same process/server you could probably use plugins 
>> quite nicely. If they run on separate servers it gets a bit more 
>> complicated.
>>
>> By using a plugin you can use basic composer features to install the 
>> backend code into the frontend one and avoid having to define the full 
>> classname everywhere as you can use Plugin.Foo style class names in most 
>> places (if there are className options that don't support Plugin.Class let 
>> us know)
>>
>> -Mark
>>
>> On Tuesday, 25 March 2014 19:19:20 UTC-4, bato wrote:
>>>
>>> Hi there,
>>>
>>> I played a bit with new ORM and now I'm starting to port BEdita to Cake 
>>> 3.
>>> BEdita is a Semantic Content Management Framework developed with cake 
>>> 1.3. The backend is a cake app that can manage multiple frontends data. 
>>> Every frontend is a cake app too that uses a set of api that are exposed 
>>> from backend app.
>>>
>>> Backend and frontend apps share cakephp lib and backend models, 
>>> behaviors, helpers are reachable from frontends since they are added to 
>>> paths with App::build().
>>>
>>> Now I try to figure out as reproduce the "same" situations with cake 3 
>>> and I would ask some advice.
>>>
>>> I'm starting creating the backend app with composer, then I added 
>>> frontend app by hand beacuse I want to reuse cake core installed in backend 
>>> app.
>>> So my directory structure is
>>>
>>>- bedita: containing app (Bedita\\ namespace) and vendor with cakephp
>>>- frontend-app: clean cakephp app skeleton
>>>
>>>
>>> ├── bedita
>>> │   ├── Bedita
>>> │   ├── Module
>>> │   ├── Plugin
>>> │   ├── Test
>>> │   ├── tmp
>>> │   ├── vendor
>>> │   └── webroot
>>> └── frontend-app
>>> ├── App
>>> ├── Plugin
>>> ├── Test
>>> ├── tmp
>>> ├── vendor
>>> └── webroot
>>>
>>> To use cake and bedita in frontend app I managed App/config/paths.phpand 
>>> App/config/bootstrap.php
>>>
>>> In App/config/paths.php I added the path to bedita folder and modified 
>>> CAKE_CORE_INCLUDE_PATH to use that.
>>> In App/config/bootstrap.php I change composer autoload path to 
>>> bedita/vendor/autoload.php 
>>> and added to it App namespace
>>>
>>> // Use composer to load the autoloader.
>>> if (file_exists(BEDITA_CORE_PATH . '/vendor/autoload.php')) {
>>> $loader = require BEDITA_CORE_PATH . '/vendor/autoload.php';
>>> $loader->addPsr4('App\\', APP);
>>> }
>>>
>>> After that in frontend app PagesController I am able to do:
>>>
>>> $images = TableRegistry::get('Images', [
>>> 'className' => 'Bedita\Model\Table\ImagesTable'
>>> ]);
>>>
>>> The only thing I had to pay attention is how to add behavior in Bedita 
>>> Table objects. I had to specify the behavior className to avoid errors 
>>> using those Table objects in frontend app.
>>>
>>> $this->addBehavior('BeditaObject', [
>>> 'className' => 'Bedita\Model\Behavior\BeditaObjectBehavior'
>>> ]);
>>>
>>>
>>> So I ask you CakePHP core dev/guru if it is the right way to handle this 
>>> case or if you have some suggestion or advice.
>>>
>>> regards
>>> Alberto
>>>
>>>
>>>  -- 
>> 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/MHdseZKF4ts/unsubscrib

Re: cake 3 - best practice to develop backend app with one or more frontend apps sharing cake lib

2014-03-26 Thread Alberto Pagliarini
Hi Mark,
thanks for the answer :)
Do you intend using Plugin for backend or frontend? However the common use
case we have to handle is:


   - frontends and backend live on the same server and are served by the
   same web server
   - one backend used to manage data for two or more frontends
   - backend and each frontends have different url. Example:
  - backend: http://admin.customer-name.com
  - frontend 1: http://site1.com
  - frontend 2: http://site2.org
  - etc...

Is it possible handle with plugins this situation?

On other side we like having separate app for backend and frontends because
it give us the possibility to use different plugins for every app and have
frontend as app seems more polished.
But if there is a simple way to handle it with plugins I like to know so we
can think about it.


Alberto



2014-03-26 2:41 GMT+01:00 mark_story :

> Have you considered using plugins? If the 'backend' and 'frontend'
> application run in the same process/server you could probably use plugins
> quite nicely. If they run on separate servers it gets a bit more
> complicated.
>
> By using a plugin you can use basic composer features to install the
> backend code into the frontend one and avoid having to define the full
> classname everywhere as you can use Plugin.Foo style class names in most
> places (if there are className options that don't support Plugin.Class let
> us know)
>
> -Mark
>
> On Tuesday, 25 March 2014 19:19:20 UTC-4, bato wrote:
>>
>> Hi there,
>>
>> I played a bit with new ORM and now I'm starting to port BEdita to Cake 3.
>> BEdita is a Semantic Content Management Framework developed with cake
>> 1.3. The backend is a cake app that can manage multiple frontends data.
>> Every frontend is a cake app too that uses a set of api that are exposed
>> from backend app.
>>
>> Backend and frontend apps share cakephp lib and backend models,
>> behaviors, helpers are reachable from frontends since they are added to
>> paths with App::build().
>>
>> Now I try to figure out as reproduce the "same" situations with cake 3
>> and I would ask some advice.
>>
>> I'm starting creating the backend app with composer, then I added
>> frontend app by hand beacuse I want to reuse cake core installed in backend
>> app.
>> So my directory structure is
>>
>>- bedita: containing app (Bedita\\ namespace) and vendor with cakephp
>>- frontend-app: clean cakephp app skeleton
>>
>>
>> ├── bedita
>> │   ├── Bedita
>> │   ├── Module
>> │   ├── Plugin
>> │   ├── Test
>> │   ├── tmp
>> │   ├── vendor
>> │   └── webroot
>> └── frontend-app
>> ├── App
>> ├── Plugin
>> ├── Test
>> ├── tmp
>> ├── vendor
>> └── webroot
>>
>> To use cake and bedita in frontend app I managed App/config/paths.phpand
>> App/config/bootstrap.php
>>
>> In App/config/paths.php I added the path to bedita folder and modified
>> CAKE_CORE_INCLUDE_PATH to use that.
>> In App/config/bootstrap.php I change composer autoload path to 
>> bedita/vendor/autoload.php
>> and added to it App namespace
>>
>> // Use composer to load the autoloader.
>> if (file_exists(BEDITA_CORE_PATH . '/vendor/autoload.php')) {
>> $loader = require BEDITA_CORE_PATH . '/vendor/autoload.php';
>> $loader->addPsr4('App\\', APP);
>> }
>>
>> After that in frontend app PagesController I am able to do:
>>
>> $images = TableRegistry::get('Images', [
>> 'className' => 'Bedita\Model\Table\ImagesTable'
>> ]);
>>
>> The only thing I had to pay attention is how to add behavior in Bedita
>> Table objects. I had to specify the behavior className to avoid errors
>> using those Table objects in frontend app.
>>
>> $this->addBehavior('BeditaObject', [
>> 'className' => 'Bedita\Model\Behavior\BeditaObjectBehavior'
>> ]);
>>
>>
>> So I ask you CakePHP core dev/guru if it is the right way to handle this
>> case or if you have some suggestion or advice.
>>
>> regards
>> Alberto
>>
>>
>>  --
> 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/MHdseZKF4ts/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.
>



-- 
-- bato ---

-- 
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:/

Re: cake 3 - best practice to develop backend app with one or more frontend apps sharing cake lib

2014-03-25 Thread mark_story
Have you considered using plugins? If the 'backend' and 'frontend' 
application run in the same process/server you could probably use plugins 
quite nicely. If they run on separate servers it gets a bit more 
complicated.

By using a plugin you can use basic composer features to install the 
backend code into the frontend one and avoid having to define the full 
classname everywhere as you can use Plugin.Foo style class names in most 
places (if there are className options that don't support Plugin.Class let 
us know)

-Mark

On Tuesday, 25 March 2014 19:19:20 UTC-4, bato wrote:
>
> Hi there,
>
> I played a bit with new ORM and now I'm starting to port BEdita to Cake 3.
> BEdita is a Semantic Content Management Framework developed with cake 1.3. 
> The backend is a cake app that can manage multiple frontends data. Every 
> frontend is a cake app too that uses a set of api that are exposed from 
> backend app.
>
> Backend and frontend apps share cakephp lib and backend models, behaviors, 
> helpers are reachable from frontends since they are added to paths with 
> App::build().
>
> Now I try to figure out as reproduce the "same" situations with cake 3 and 
> I would ask some advice.
>
> I'm starting creating the backend app with composer, then I added frontend 
> app by hand beacuse I want to reuse cake core installed in backend app.
> So my directory structure is
>
>- bedita: containing app (Bedita\\ namespace) and vendor with cakephp
>- frontend-app: clean cakephp app skeleton
>
>
> ├── bedita
> │   ├── Bedita
> │   ├── Module
> │   ├── Plugin
> │   ├── Test
> │   ├── tmp
> │   ├── vendor
> │   └── webroot
> └── frontend-app
> ├── App
> ├── Plugin
> ├── Test
> ├── tmp
> ├── vendor
> └── webroot
>
> To use cake and bedita in frontend app I managed App/config/paths.php and 
> App/config/bootstrap.php
>
> In App/config/paths.php I added the path to bedita folder and modified 
> CAKE_CORE_INCLUDE_PATH to use that.
> In App/config/bootstrap.php I change composer autoload path to 
> bedita/vendor/autoload.php 
> and added to it App namespace
>
> // Use composer to load the autoloader.
> if (file_exists(BEDITA_CORE_PATH . '/vendor/autoload.php')) {
> $loader = require BEDITA_CORE_PATH . '/vendor/autoload.php';
> $loader->addPsr4('App\\', APP);
> }
>
> After that in frontend app PagesController I am able to do:
>
> $images = TableRegistry::get('Images', [
> 'className' => 'Bedita\Model\Table\ImagesTable'
> ]);
>
> The only thing I had to pay attention is how to add behavior in Bedita 
> Table objects. I had to specify the behavior className to avoid errors 
> using those Table objects in frontend app.
>
> $this->addBehavior('BeditaObject', [
> 'className' => 'Bedita\Model\Behavior\BeditaObjectBehavior'
> ]);
>
>
> So I ask you CakePHP core dev/guru if it is the right way to handle this 
> case or if you have some suggestion or advice.
>
> regards
> Alberto
>
>
>

-- 
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 - best practice to develop backend app with one or more frontend apps sharing cake lib

2014-03-25 Thread bato
Hi there,

I played a bit with new ORM and now I'm starting to port BEdita to Cake 3.
BEdita is a Semantic Content Management Framework developed with cake 1.3. 
The backend is a cake app that can manage multiple frontends data. Every 
frontend is a cake app too that uses a set of api that are exposed from 
backend app.

Backend and frontend apps share cakephp lib and backend models, behaviors, 
helpers are reachable from frontends since they are added to paths with 
App::build().

Now I try to figure out as reproduce the "same" situations with cake 3 and 
I would ask some advice.

I'm starting creating the backend app with composer, then I added frontend 
app by hand beacuse I want to reuse cake core installed in backend app.
So my directory structure is

   - bedita: containing app (Bedita\\ namespace) and vendor with cakephp
   - frontend-app: clean cakephp app skeleton
   

├── bedita
│   ├── Bedita
│   ├── Module
│   ├── Plugin
│   ├── Test
│   ├── tmp
│   ├── vendor
│   └── webroot
└── frontend-app
├── App
├── Plugin
├── Test
├── tmp
├── vendor
└── webroot

To use cake and bedita in frontend app I managed App/config/paths.php and 
App/config/bootstrap.php

In App/config/paths.php I added the path to bedita folder and modified 
CAKE_CORE_INCLUDE_PATH to use that.
In App/config/bootstrap.php I change composer autoload path to 
bedita/vendor/autoload.php 
and added to it App namespace

// Use composer to load the autoloader.
if (file_exists(BEDITA_CORE_PATH . '/vendor/autoload.php')) {
$loader = require BEDITA_CORE_PATH . '/vendor/autoload.php';
$loader->addPsr4('App\\', APP);
}

After that in frontend app PagesController I am able to do:

$images = TableRegistry::get('Images', [
'className' => 'Bedita\Model\Table\ImagesTable'
]);

The only thing I had to pay attention is how to add behavior in Bedita 
Table objects. I had to specify the behavior className to avoid errors 
using those Table objects in frontend app.

$this->addBehavior('BeditaObject', [
'className' => 'Bedita\Model\Behavior\BeditaObjectBehavior'
]);


So I ask you CakePHP core dev/guru if it is the right way to handle this 
case or if you have some suggestion or advice.

regards
Alberto


-- 
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: Staying DRY best practice?

2014-03-17 Thread designv...@gmail.com
Check out the CRUD plugin: https://github.com/FriendsOfCake/crud

On Sunday, 16 March 2014 12:39:58 UTC, Harold Putman wrote:
>
> I've noticed that my controller methods and views for admin_edit, 
> admin_add, edit, add have a lot of overlapping code. What is the best 
> practice for organizing my code so there is not so much duplication. Do you 
> create an Element for the body of the editing form? Share views between 
> admin and normal routes?
>
> I'm curious how other people are handling this in Cake 2.x 
>

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


Staying DRY best practice?

2014-03-16 Thread Harold Putman
I've noticed that my controller methods and views for admin_edit, 
admin_add, edit, add have a lot of overlapping code. What is the best 
practice for organizing my code so there is not so much duplication. Do you 
create an Element for the body of the editing form? Share views between 
admin and normal routes?

I'm curious how other people are handling this in Cake 2.x 

-- 
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: Best Practice Question - Components

2013-11-06 Thread Reuben Helms
I would say that calculations, and verification of amounts would be perfect
functionality to place on the model.  You wouldn't normally need a
controller to determine the sum of items in an order, so why put it in a
controller.

For a shopping cart, you still might use a model to store the cart contents
and cart items.  You might query the cart to see what the total value is.
 This is not a calculation that the controller would need to make, so you
wouldn't need to do it in a component either.  All business logic for an
entity should stay with the entity, and the model is the perfect place for
that.

What you might put in the component is functionality to load a cart that is
attached to the session, or clear the cart from the session, if the user
requests it, or save cart modifications to the session at the end the
controller lifecycle.

Interesting to note, in CakePHP 3.0, the model will be split between an
Entity and a Table.  The Table will take care of the schema, and typical
database/CRUD operations, while the Entity will concentrate more on the
business logic side of things.

Regards
Reuben Helms


On Thu, Nov 7, 2013 at 10:08 AM, Kristen M  wrote:

> Yeah, the point of the exercise is to do things the "Cake Way" and take
> advantage of all things automagical and Cake. ;)
>
> After puzzling over the docs for a bit and realizing it's not bad form to
> have a controller use multiple models, I decided that splitting the
> existing classes into a model and a component was probably the "correct"
> solution. The model handles all the data, while the component contains
> common functions all controllers that use the model will need, like
> calculations and verification of amounts.
>
>
>
>
>  --
> 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/M6i0tin0b5Q/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/groups/opt_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/groups/opt_out.


Re: Best Practice Question - Components

2013-11-06 Thread Kristen M
Yeah, the point of the exercise is to do things the "Cake Way" and take 
advantage of all things automagical and Cake. ;) 

After puzzling over the docs for a bit and realizing it's not bad form to 
have a controller use multiple models, I decided that splitting the 
existing classes into a model and a component was probably the "correct" 
solution. The model handles all the data, while the component contains 
common functions all controllers that use the model will need, like 
calculations and verification of amounts. 




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

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


Re: Best Practice Question - Components

2013-11-05 Thread Reuben
If you have existing class that work, then you could include them as Vendor 
code, and have your controllers call their find and save functions.

However, doing things the CakePHP way, you'll probably want to convert 
those classes to Models, rather than Components. Models are where your 
business logic and validation rules go.

I used to think that anything required by more than one controller should 
go into a component, but I'm thinking that components are for things that 
need to plug into the controller lifecycle.

On Wednesday, 6 November 2013 06:03:19 UTC+10, Kristen M wrote:
>
> I'm not a new programmer (I'd say advanced beginner/intermediate) but I'm 
> quite new to Cake and MVC in general. 
>
> I've decided best way to learn CakePHP and MVC is to take an existing 
> (functional, live) project and port it to Cake for kicks. Get the grand 
> tour of all the basics. 
>
> In my existing project I have a number of utility classes that are used by 
> the other classes. 2 of them are an Item class and a Banking class. Item 
> obviously contains all the information about a user's inventory, plus 
> handles updating/deducting items, as well as using items. Banking does just 
> that- tracks a user's currency and handles transactions. Banking is used 
> between the Shop systems, Item is used by Shop and various action classes. 
> So I need a way to share their functionality between all the various other 
> controllers that require them. 
>
> Simple example would be the user wants to buy an item from the shop, have 
> to verify the item is in stock, the item's price, that the player has the 
> currency to pay for it, deliver the item, deduct the payment and deduct the 
> item from shop inventory. While a different Controller (say, Toll Bridge) 
> needs the Banking functions to verify the user has the funds to pay the 
> toll, then debit the transaction.
>
> It SOUNDS like what I need to do is to create Banking & Item Components, 
> then the other controllers can make use of them as needed. However, this 
> would also require including various queries to chat with the database. The 
> CakePHP example on Components only shows a simple math operation with 
> passed params, and says nothing about if using Components as little 
> "bundles" of functionality that involve their own validations and database 
> interactions (although this is strongly implied) There is some conversation 
> on the 'net that what actually needs to happen is Banking and Item should 
> be controllers, and they get imported as needed. 
>
> What's the best way to go about 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/groups/opt_out.


Best Practice Question - Components

2013-11-05 Thread Kristen M
I'm not a new programmer (I'd say advanced beginner/intermediate) but I'm 
quite new to Cake and MVC in general. 

I've decided best way to learn CakePHP and MVC is to take an existing 
(functional, live) project and port it to Cake for kicks. Get the grand 
tour of all the basics. 

In my existing project I have a number of utility classes that are used by 
the other classes. 2 of them are an Item class and a Banking class. Item 
obviously contains all the information about a user's inventory, plus 
handles updating/deducting items, as well as using items. Banking does just 
that- tracks a user's currency and handles transactions. Banking is used 
between the Shop systems, Item is used by Shop and various action classes. 
So I need a way to share their functionality between all the various other 
controllers that require them. 

Simple example would be the user wants to buy an item from the shop, have 
to verify the item is in stock, the item's price, that the player has the 
currency to pay for it, deliver the item, deduct the payment and deduct the 
item from shop inventory. While a different Controller (say, Toll Bridge) 
needs the Banking functions to verify the user has the funds to pay the 
toll, then debit the transaction.

It SOUNDS like what I need to do is to create Banking & Item Components, 
then the other controllers can make use of them as needed. However, this 
would also require including various queries to chat with the database. The 
CakePHP example on Components only shows a simple math operation with 
passed params, and says nothing about if using Components as little 
"bundles" of functionality that involve their own validations and database 
interactions (although this is strongly implied) There is some conversation 
on the 'net that what actually needs to happen is Banking and Item should 
be controllers, and they get imported as needed. 

What's the best way to go about 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/groups/opt_out.


Re: Best practice for Helpers

2013-07-16 Thread Tilen Majerle
Second way. Because you can modify returned data before print/echo.

--
Lep pozdrav, Tilen Majerle
http://majerle.eu


2013/7/16 David Suna 

> As a best practice, should a helper output content or return the content
> to the View?
>
> In other words, should the call to the helper be:
> $this->MyHelper->someMethod($DataForHelper);
>
> or
>
> echo $this->MyHelper->someMethod($DataForHelper);
>
> Most of the built in helpers seem to prefer the latter form.  Is this just
> a style issue or is there a preferred way?
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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

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




Best practice for Helpers

2013-07-16 Thread David Suna
As a best practice, should a helper output content or return the content to 
the View?

In other words, should the call to the helper be:
$this->MyHelper->someMethod($DataForHelper);

or

echo $this->MyHelper->someMethod($DataForHelper);

Most of the built in helpers seem to prefer the latter form.  Is this just 
a style issue or is there a preferred way?

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

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




Best practice: Record associated to one or all

2013-05-13 Thread LDSign
Hi

What is the best practice to store records which are either related to one 
parent OR to all parents?

Related to one is clear (set parent_id to id), but which method is the 
better approach:

Set parent_id to 0 to make the record available to all parents or set it to 
"null" and make a "global switch" (tinyint 0/1)?

In real life a document can belong to one company OR (not at the same time) 
to all companies.

What would you do?

Thanks,
Frank

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Best practice to call "cake schema update" without shell

2013-01-29 Thread LDSign
The hoster is 1&1 (Business Pro Shared Host). Ive already tried
accessing the shell via ssh, but it seems Ive no right for that.

I would like to call "cake schema update" on a scheme I have uploaded
to the production/presentation server which is currently in testing
state (so db changes are common). In an optimum way, I would to
migrate the db within the admin-interface with a simple click.

Do you have any hint how I could accomplish this on the given 1&1
host?

Thanks,
Frank



On Jan 29, 10:51 am, euromark  wrote:
> It can. If you got sufficient rights to do that (executable rights for this
> user - www-data probably).
> But I am not sure if thats a very good idea.
> Why not providing shell access here?
>
> Am Dienstag, 29. Januar 2013 05:59:51 UTC+1 schrieb LDSign:
>
>
>
>
>
>
>
>
>
> > Hi
>
> > I would like to call a shell command on a prdouction server without
> > shell access. Whats the best practice of doing that? Can a shell-
> > command being called from a controller?
>
> > Thank you,
> > Frank

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Best practice to call "cake schema update" without shell

2013-01-29 Thread euromark
It can. If you got sufficient rights to do that (executable rights for this 
user - www-data probably).
But I am not sure if thats a very good idea.
Why not providing shell access here?


Am Dienstag, 29. Januar 2013 05:59:51 UTC+1 schrieb LDSign:
>
> Hi 
>
> I would like to call a shell command on a prdouction server without 
> shell access. Whats the best practice of doing that? Can a shell- 
> command being called from a controller? 
>
> Thank you, 
> Frank 
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Best practice to call "cake schema update" without shell

2013-01-28 Thread LDSign
Hi

I would like to call a shell command on a prdouction server without
shell access. Whats the best practice of doing that? Can a shell-
command being called from a controller?

Thank you,
Frank

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Best practice for naming ACOs in Cake?

2013-01-10 Thread LDSign
Hi

Ive implemented a complete ACL-Solution in my app. I am using an 
administration form for acl-management (allow/deny) which I am building 
directly "on-the-fly" (from the aco-table).

So now, I would like to make this "acl-form" accessible to some groups with 
non-technical knowledge. Of course displaying the "default" method aliases 
to the user is not so self-explanatory for everyone. I would like to add a 
real name and a description.

What do you think were I should store this information for the aco? 
Modifying/extend the cake aco-table? Or in a related table? Which is most 
cake-like? In an optimum way the description and the name is related to the 
translateable behaviour to offer different languages.

Has somebody done this already?

Thanks for your input!

Regards,
Frank

-- 
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Best practice for EXTERNAL api?

2013-01-07 Thread Ma'moon
http://book.cakephp.org/2.0/en/models/datasources.html
Check out the example usage of "FarAwaySource"


On Mon, Jan 7, 2013 at 9:59 AM, marcus33cz  wrote:

> Hi all,
>
> I have several external APIs which I'd like to use - such as this one:
> http://www.pinnaclesports.com/apimanual/commands.aspx
>
> The scripts I want to create will use the HttpSocket class (to get the
> data via API) and some model classes such as Match (to save the data in my
> DB).
> The scripts should be run by CRON (and I guess it should be accessible
> manually as well).
>
> Now the question is *where in the structure of cakePHP should I put my
> scripts that get data from the API and save them?*
> *(I think it is not exactly a plugin and I don't want to create another
> model either - because all my models are mapped to a DB table and the API
> wouldn't be.)*
>
> Thanks a lot!
>
> --
> 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 post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Best practice for EXTERNAL api?

2013-01-07 Thread marcus33cz
Hi all,

I have several external APIs which I'd like to use - such as this 
one: http://www.pinnaclesports.com/apimanual/commands.aspx

The scripts I want to create will use the HttpSocket class (to get the data 
via API) and some model classes such as Match (to save the data in my DB).
The scripts should be run by CRON (and I guess it should be accessible 
manually as well).

Now the question is *where in the structure of cakePHP should I put my 
scripts that get data from the API and save them?*
*(I think it is not exactly a plugin and I don't want to create another 
model either - because all my models are mapped to a DB table and the API 
wouldn't be.)*

Thanks a lot!

-- 
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Carousel as an element - best practice?

2012-12-09 Thread lowpass
I often set up my images table with model & foreign_key columns. The
Image model looks like:

public $hasOne = array(
'Thumbnail' => array(
'ClassName' => 'Portfolio',
'foreignKey' => 'image_id',
'dependent' => true
)
);

public $belongsTo = array(
'Book' => array(
'className' => 'Book',
'foreignKey' => false,
'conditions' => array(
'Image.model' => 'Book',
'Image.foreign_key = Book.id'
),
'dependent' => true
)
// etc.

Book model, for example:

public $hasMany = array( // could also be $hasOne
'Image' => array(
'className' => 'Image',
'foreignKey' => 'foreign_key',
'conditions' => array(
'Image.model' => 'Book'
),
'dependent' => true
)
);

With this schema, we could create an action in ImagesController:

public function foo($model, $fk, $order, $limit) {
// let's keep the controller lean
return $this->Image->foo($model, $fk, $order, $limit);
}

Image:

public function foo($model, $fk, $order, $limit)
{
return $this->find(
'all',
array(
'conditions' => array(
$this->alias.'.model' => $model,
$this->alias.'.foreign_key' => $fk
),
'order' => $order,
'limit' => $limit
)
);
}

So your carousel element could simply call requestAction() on a single
controller action. (Just remember to cache the element!)

One issue I see right off the bat is that you want to order your User
pics by rating. I presume that's User.rating -- that would add some
complexity which I'm not sure how to address.

Another issue might be if you want to link to the User or Article
itself, rather than just pop up an enlarged image. That is, it'd be a
problem if you're using non-standard routes. If you get to a given
User with '/users/view/:id' and an Article with '/articles/view/:id'
then you're golden, because the element has all the info it needs to
construct the links. But if you're using something like '/users/:slug'
you've got more problems.

On Sun, Dec 9, 2012 at 11:51 AM, marcus33cz  wrote:
> Hi all,
>
> first of all I must say cakePHP is amazing how everything works
> automagically. :-) (I'm still learning but once I've learned enough, I'll be
> happy to help others.)
>
> Now I'm wondering about best practice for a CAROUSEL - basically a piece of
> website with rotating images
>
> . Let's say I want to:
> --- a carousel that can display different models and entries from the
> database (e.g. "latest 3 articles", "top 5 players", "top 3 most active
> teams")
> --- this carousel should be reusable and universal
> (I don't care about the javascript, I already have that)
>
> How would you do it? My idea is:
> --- create an element (carousel.ctp in View/Elements)
> --- allow to pass some parameters to the carousel element
> --- include this element in different views with different parameters
> --- the element would then loop through the parameters and display something
> according to them
>
> So for example:
>
> In one view:
>>
>> $this->element('carousel',
>> array(
>> 'model' => "articles",
>> 'limit' => 3,
>> 'order' => "created DESC"
>>  )
>> );
>
>
> In another view:
>>
>> $this->element('carousel',
>> array(
>> 'model' => "users",
>> 'limit' => 5,
>> 'order' => "rating DESC"
>>  )
>> );
>
>
> My question is --- should the carousel element really do the work (e.g.
> getting last 3 articles)?
> Shouldn't that be in some controller --- and if yes what one (I want to
> avoid any duplicities)
>
> Thanks a lot!
>
> --
> 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 post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

-- 
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Carousel as an element - best practice?

2012-12-09 Thread marcus33cz
Hi all,

first of all I must say cakePHP is amazing how everything works 
automagically. :-) (I'm still learning but once I've learned enough, I'll 
be happy to help others.)

Now I'm wondering about *best practice for a CAROUSEL - basically a piece 
of website with rotating images*

. Let's say I want to:
--- a carousel that can display different models and entries from the 
database (e.g. "latest 3 articles", "top 5 players", "top 3 most active 
teams")
--- this carousel should be reusable and universal
(I don't care about the javascript, I already have that)

How would you do it? My idea is:
--- create an element (carousel.ctp in View/Elements)
--- allow to pass some parameters to the carousel element
--- include this element in different views with different parameters
--- the element would then loop through the parameters and display 
something according to them

So for example:

In one view:

> $this->element('carousel',
> array(
> 'model' => "articles",
> 'limit' => 3,
> 'order' => "created DESC"
>  )
> );
>
 
In another view: 

> $this->element('carousel',
> array(
> 'model' => "users",
> 'limit' => 5,
> 'order' => "rating DESC"
>  )
> );


*My question is --- should the carousel element really do the work (e.g. 
getting last 3 articles)?*
*Shouldn't that be in some controller --- and if yes what one (I want to 
avoid any duplicities)*

Thanks a lot!

-- 
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Best Practice to display data in layout or view

2012-08-11 Thread Mark Wratten
Option 2. is fine for simple stuff, i.e. grab a bunch of data from the 
database and render it, but if there is any complexity to the logic, then 
you end up loading your helpers with application logic, which in a pure MVC 
world belongs in a controller or component. So in that case, requestAction 
would be the purest approach but suffers the overhead of re-initializing 
the environment each time. Ideally, there would be some middle ground 
approach, which currently you have to roll yourself, by instantiating a new 
controller and calling the appropriate method yourself.

Mark

On Saturday, August 11, 2012 2:33:33 AM UTC-4, Sanjeev Divekar wrote:
>
> Hello,
>
> What is the best practice to display data e.g. list of products, events, 
> news in layout?
>
> 1. Element - which requires to call requestAction() and also calls 
> beforeFilter from AppController each time
> 2. Helper - need to use Model class in helper
>
> Regards,
>

-- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: Best Practice to display data in layout or view

2012-08-11 Thread Tilen Majerle
i'm using second option. Model can be created with
ClassRegistry::init('ModelName'); to get model instance :)
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/8/11 sanjeev 

> Hello,
>
> What is the best practice to display data e.g. list of products, events,
> news in layout?
>
> 1. Element - which requires to call requestAction() and also calls
> beforeFilter from AppController each time
> 2. Helper - need to use Model class in helper
>
> Regards,
>
> --
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>
>

-- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Best Practice to display data in layout or view

2012-08-10 Thread sanjeev
Hello,

What is the best practice to display data e.g. list of products, events, 
news in layout?

1. Element - which requires to call requestAction() and also calls 
beforeFilter from AppController each time
2. Helper - need to use Model class in helper

Regards,

-- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: Cakephp 2.x best practice when adding/editing content?

2012-08-03 Thread bujanga
Validation redundancy. When save is called, the data passed to it in
the first parameter is validated using CakePHP validation mechanism.
Read more on Models -> Saving your data.

Also, the validation errors are already available to the view so no
need to set them. Try bake and see what it does to get a better feel
of the cake way.

Gary

On Fri, Aug 3, 2012 at 1:43 PM, MetZ  wrote:
> Hi Mark..
>
> - Setting validation errors to view to display them in an element => You
> need to correct: Error message 1, Error message 2, Error message 3 => Need
> it ;)
> - __('some text', true) => For translation strings, not sure why I started
> to use the TRUE, but I think it is because of not beeing able to only have
> __('some text') inside the strings (Suggestion??)
>
> And for the validation Redundancy ? what exactly do you mean?
> I am validating in models => and pushing messages to the view (not using the
> error => true on my form fields, all are set to false and display the
> validation messages in element as explained before.
>
> And regarding baking.. Have never used it..  =) Any good tutorials on it? I
> need to use terminal right?
>
> I am developing on my development VPS server, not local, but have terminal
> access..
>
> Thanks for your time!
> -Tom
>
>
> kl. 20:05:19 UTC+2 fredag 3. august 2012 skrev euromark følgende:
>>
>> for starters, take out the validation redundancy
>> why setting the errors to the view? also not necessary
>> also, in 2.x your __() looks differently (arguments usually are not "true"
>> but replacement strings)
>>
>> why dont you use baking? it would display a better output than you
>> currently have
>>
>>
>>
>> Am Freitag, 3. August 2012 17:43:52 UTC+2 schrieb MetZ:
>>>
>>> Yes, I understand what you are doing :)
>>> Have a couple of those myself..
>>>
>>> But my question is (perhaps not clear enough), the best practice for a
>>> function like add and edit.
>>>
>>> I am thinking about:
>>> if ($this->request->is('post')) {
>>> $this->User->set($this->request->data);
>>> if ($this->User->validates()) {
>>> 
>>>
>>> Those things inside the function. Like,, what approach/setup would you
>>> use on cake 2.x to talk with the db and make things happen :)
>>>
>>> I am just wondering if I am doing it 100% correct, as I can not find any
>>> good tutorials on it anywhere..
>>>
>>> Here is my add function as is today, any pointers?
>>>
>>> public function admin_add() {
>>> $this->set('title_for_layout', __('Add new role',true));
>>> if ($this->request->is('post')) {
>>> $this->Role->set($this->request->data);
>>> if ($this->Role->validates()) {
>>> if ($this->Role->save($this->request->data)) {
>>> $this->Session->setFlash(__('New role created.',true),
>>> 'admin/flash/success');
>>> $this->redirect(array('action' => 'index'));
>>> } else {
>>> $this->Session->setFlash(__('Could not create role, please try
>>> again.',true), 'admin/flash/error');
>>> }
>>> } else {
>>> // Didn't validate
>>> }
>>> }
>>> $this->set('errors', $this->Role->validationErrors);
>>> }
>>>
>>> -Tom
>>>
>>>
>>>
>>> kl. 13:35:30 UTC+2 fredag 3. august 2012 skrev SoulRaven følgende:
>>>>
>>>> i use a single method, add/edit even if is user or admin, the difference
>>>> between add/edit is that on edit you have the ID set, or in parameter or in
>>>> $this->data
>>>>
>>>> admin_editpost($id = null){
>>>>if(is_null($id){
>>>>//something
>>>>}
>>>> }
>>>>
>>>> i guess you understand
>>>>
>>>> vineri, 3 august 2012, 11:41:01 UTC+3, MetZ a scris:
>>>>>
>>>>> Hi all..
>>>>>
>>>>> I am in the process of migrate one of my apps fra 1.3 to cakephp 2.x
>>>>> and I am wondering, what are the best practices for the new framework?
>>>>> AND YES, I have read the documents/book :)
>>>>>
>>>>> I am just wondering how you do it, so I can compare my work and see if
>>>>> I am heading in th

Re: Cakephp 2.x best practice when adding/editing content?

2012-08-03 Thread MetZ
Hi Mark.. 

- Setting validation errors to view to display them in an element => You 
need to correct: Error message 1, Error message 2, Error message 3 => Need 
it ;)
- __('some text', true) => For translation strings, not sure why I started 
to use the TRUE, but I think it is because of not beeing able to only have 
__('some text') inside the strings (Suggestion??)

And for the validation Redundancy ? what exactly do you mean? 
I am validating in models => and pushing messages to the view (not using 
the error => true on my form fields, all are set to false and display the 
validation messages in element as explained before.

And regarding baking.. Have never used it..  =) Any good tutorials on it? I 
need to use terminal right? 

I am developing on my development VPS server, not local, but have terminal 
access.. 

Thanks for your time!
-Tom


kl. 20:05:19 UTC+2 fredag 3. august 2012 skrev euromark følgende:
>
> for starters, take out the validation redundancy
> why setting the errors to the view? also not necessary 
> also, in 2.x your __() looks differently (arguments usually are not "true" 
> but replacement strings)
>
> why dont you use baking? it would display a better output than you 
> currently have
>
>
>
> Am Freitag, 3. August 2012 17:43:52 UTC+2 schrieb MetZ:
>>
>> Yes, I understand what you are doing :) 
>> Have a couple of those myself.. 
>>
>> But my question is (perhaps not clear enough), the best practice for a 
>> function like add and edit.
>>
>> I am thinking about:
>> if ($this->request->is('post')) {
>> $this->User->set($this->request->data);
>> if ($this->User->validates()) {
>> 
>>
>> Those things inside the function. Like,, what approach/setup would you 
>> use on cake 2.x to talk with the db and make things happen :)
>>
>> I am just wondering if I am doing it 100% correct, as I can not find any 
>> good tutorials on it anywhere..
>>
>> Here is my add function as is today, any pointers?
>>
>> public function admin_add() {
>> $this->set('title_for_layout', __('Add new role',true));
>> if ($this->request->is('post')) {
>> $this->Role->set($this->request->data);
>> if ($this->Role->validates()) {
>> if ($this->Role->save($this->request->data)) {
>> $this->Session->setFlash(__('New role created.',true), 
>> 'admin/flash/success');
>> $this->redirect(array('action' => 'index'));
>> } else {
>> $this->Session->setFlash(__('Could not create role, please try 
>> again.',true), 'admin/flash/error');
>> }
>> } else {
>> // Didn't validate
>> }
>> }
>> $this->set('errors', $this->Role->validationErrors);
>> }
>>
>> -Tom
>>
>>
>>
>> kl. 13:35:30 UTC+2 fredag 3. august 2012 skrev SoulRaven følgende:
>>>
>>> i use a single method, add/edit even if is user or admin, 
>>> the difference between add/edit is that on edit you have the ID set, or in 
>>> parameter or in $this->data
>>>
>>> admin_editpost($id = null){
>>>    if(is_null($id){
>>>//something
>>>}
>>> }
>>>
>>> i guess you understand
>>>
>>> vineri, 3 august 2012, 11:41:01 UTC+3, MetZ a scris:
>>>>
>>>> Hi all..
>>>>
>>>> I am in the process of migrate one of my apps fra 1.3 to cakephp 2.x  
>>>> and I am wondering, what are the best practices for the new framework?
>>>> AND YES, I have read the documents/book :)
>>>>
>>>> I am just wondering how you do it, so I can compare my work and see if 
>>>> I am heading in the right direction with my app.
>>>>
>>>> So if anyone could give me an idea about a couple simple add/edit 
>>>> functions, and how the best practice for this, I would appreciate it :)
>>>>
>>>> like:
>>>>
>>>> admin_users_add() {
>>>> }
>>>>
>>>> admin_users_edit() {
>>>> }
>>>>
>>>> and other regular functions you might have an example for.
>>>>
>>>> Thanks all!
>>>> Awesome!
>>>>
>>>> -Tom
>>>>
>>>

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Cakephp 2.x best practice when adding/editing content?

2012-08-03 Thread euromark
for starters, take out the validation redundancy
why setting the errors to the view? also not necessary 
also, in 2.x your __() looks differently (arguments usually are not "true" 
but replacement strings)

why dont you use baking? it would display a better output than you 
currently have



Am Freitag, 3. August 2012 17:43:52 UTC+2 schrieb MetZ:
>
> Yes, I understand what you are doing :) 
> Have a couple of those myself.. 
>
> But my question is (perhaps not clear enough), the best practice for a 
> function like add and edit.
>
> I am thinking about:
> if ($this->request->is('post')) {
> $this->User->set($this->request->data);
> if ($this->User->validates()) {
> 
>
> Those things inside the function. Like,, what approach/setup would you use 
> on cake 2.x to talk with the db and make things happen :)
>
> I am just wondering if I am doing it 100% correct, as I can not find any 
> good tutorials on it anywhere..
>
> Here is my add function as is today, any pointers?
>
> public function admin_add() {
> $this->set('title_for_layout', __('Add new role',true));
> if ($this->request->is('post')) {
> $this->Role->set($this->request->data);
> if ($this->Role->validates()) {
> if ($this->Role->save($this->request->data)) {
> $this->Session->setFlash(__('New role created.',true), 
> 'admin/flash/success');
> $this->redirect(array('action' => 'index'));
> } else {
> $this->Session->setFlash(__('Could not create role, please try 
> again.',true), 'admin/flash/error');
> }
> } else {
> // Didn't validate
> }
> }
> $this->set('errors', $this->Role->validationErrors);
> }
>
> -Tom
>
>
>
> kl. 13:35:30 UTC+2 fredag 3. august 2012 skrev SoulRaven følgende:
>>
>> i use a single method, add/edit even if is user or admin, 
>> the difference between add/edit is that on edit you have the ID set, or in 
>> parameter or in $this->data
>>
>> admin_editpost($id = null){
>>if(is_null($id){
>>//something
>>}
>> }
>>
>> i guess you understand
>>
>> vineri, 3 august 2012, 11:41:01 UTC+3, MetZ a scris:
>>>
>>> Hi all..
>>>
>>> I am in the process of migrate one of my apps fra 1.3 to cakephp 2.x  
>>> and I am wondering, what are the best practices for the new framework?
>>> AND YES, I have read the documents/book :)
>>>
>>> I am just wondering how you do it, so I can compare my work and see if I 
>>> am heading in the right direction with my app.
>>>
>>> So if anyone could give me an idea about a couple simple add/edit 
>>> functions, and how the best practice for this, I would appreciate it :)
>>>
>>> like:
>>>
>>> admin_users_add() {
>>> }
>>>
>>> admin_users_edit() {
>>> }
>>>
>>> and other regular functions you might have an example for.
>>>
>>> Thanks all!
>>> Awesome!
>>>
>>> -Tom
>>>
>>

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Cakephp 2.x best practice when adding/editing content?

2012-08-03 Thread MetZ
Yes, I understand what you are doing :) 
Have a couple of those myself.. 

But my question is (perhaps not clear enough), the best practice for a 
function like add and edit.

I am thinking about:
if ($this->request->is('post')) {
$this->User->set($this->request->data);
if ($this->User->validates()) {


Those things inside the function. Like,, what approach/setup would you use 
on cake 2.x to talk with the db and make things happen :)

I am just wondering if I am doing it 100% correct, as I can not find any 
good tutorials on it anywhere..

Here is my add function as is today, any pointers?

public function admin_add() {
$this->set('title_for_layout', __('Add new role',true));
if ($this->request->is('post')) {
$this->Role->set($this->request->data);
if ($this->Role->validates()) {
if ($this->Role->save($this->request->data)) {
$this->Session->setFlash(__('New role created.',true), 
'admin/flash/success');
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('Could not create role, please try 
again.',true), 'admin/flash/error');
}
} else {
// Didn't validate
}
}
$this->set('errors', $this->Role->validationErrors);
}

-Tom



kl. 13:35:30 UTC+2 fredag 3. august 2012 skrev SoulRaven følgende:
>
> i use a single method, add/edit even if is user or admin, 
> the difference between add/edit is that on edit you have the ID set, or in 
> parameter or in $this->data
>
> admin_editpost($id = null){
>if(is_null($id){
>//something
>}
> }
>
> i guess you understand
>
> vineri, 3 august 2012, 11:41:01 UTC+3, MetZ a scris:
>>
>> Hi all..
>>
>> I am in the process of migrate one of my apps fra 1.3 to cakephp 2.x  and 
>> I am wondering, what are the best practices for the new framework?
>> AND YES, I have read the documents/book :)
>>
>> I am just wondering how you do it, so I can compare my work and see if I 
>> am heading in the right direction with my app.
>>
>> So if anyone could give me an idea about a couple simple add/edit 
>> functions, and how the best practice for this, I would appreciate it :)
>>
>> like:
>>
>> admin_users_add() {
>> }
>>
>> admin_users_edit() {
>> }
>>
>> and other regular functions you might have an example for.
>>
>> Thanks all!
>> Awesome!
>>
>> -Tom
>>
>

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Cakephp 2.x best practice when adding/editing content?

2012-08-03 Thread SoulRaven
i use a single method, add/edit even if is user or admin, 
the difference between add/edit is that on edit you have the ID set, or in 
parameter or in $this->data

admin_editpost($id = null){
   if(is_null($id){
   //something
   }
}

i guess you understand

vineri, 3 august 2012, 11:41:01 UTC+3, MetZ a scris:
>
> Hi all..
>
> I am in the process of migrate one of my apps fra 1.3 to cakephp 2.x  and 
> I am wondering, what are the best practices for the new framework?
> AND YES, I have read the documents/book :)
>
> I am just wondering how you do it, so I can compare my work and see if I 
> am heading in the right direction with my app.
>
> So if anyone could give me an idea about a couple simple add/edit 
> functions, and how the best practice for this, I would appreciate it :)
>
> like:
>
> admin_users_add() {
> }
>
> admin_users_edit() {
> }
>
> and other regular functions you might have an example for.
>
> Thanks all!
> Awesome!
>
> -Tom
>

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Cakephp 2.x best practice when adding/editing content?

2012-08-03 Thread MetZ
Hi all..

I am in the process of migrate one of my apps fra 1.3 to cakephp 2.x  and I 
am wondering, what are the best practices for the new framework?
AND YES, I have read the documents/book :)

I am just wondering how you do it, so I can compare my work and see if I am 
heading in the right direction with my app.

So if anyone could give me an idea about a couple simple add/edit 
functions, and how the best practice for this, I would appreciate it :)

like:

admin_users_add() {
}

admin_users_edit() {
}

and other regular functions you might have an example for.

Thanks all!
Awesome!

-Tom

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Routes vs Type checking for Action Parameters, best practice?

2012-06-28 Thread Kamisama
"Why do that in two places?"

Because it does not do the same thing.

You always have to validate the $id in the controller, since as already 
said, the $id can be a perfect integer, but does not exist in the database.

I assume your example in the router file will be like that :

Router::connect('/books/view/:id', array('controller'=>'books', 
'action'=>'view'), array('pass' => array('id'), 'id' => '[0-9]+?'));

There's no benefits of enforcing a numeric validation on the ID in this 
case. But if you have routes like that :

Router::connect('/books/:id', array('controller'=>'books', 
'action'=>'view'), array('pass' => array('id'), 'id' => '[0-9]+?'));
Router::connect('/books/:action', array('controller'=>'books', 
'action'=>'add'));

making sure the id is numeric is necessary, else the second route will 
never be read, and all your url like "books/add", or whatever will be 
redirect to the view action.

Type validation in the routes are to redirect the flow to the right action 
in the right controller, for the routes that can be ambiguous. 

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Routes vs Type checking for Action Parameters, best practice?

2012-06-28 Thread Poyan Nabati
"I think you're not using routes in their purest form (to route stuff in 
the right way - rather than error trapping". 

Thing is, if you haven't supplied an integer, then there's really no 
matching action for the URL you've requested. I think that's completely in 
line with the purpose of routes. 

That is, if you supply a non-integer, then you haven't really matched any 
existing action, so you're redirected to an error or a default page.

Since PHP doesn't really have strict typing, maybe I could settle for "if 
you haven't passed the right number of parameters, there's no matching 
action".

"Why do that in two places?"

I think it could result in cleaner code since you can be sure of the type 
and amount of input you receive in each action.

Don't you agree?

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Routes vs Type checking for Action Parameters, best practice?

2012-06-28 Thread Dr. Tarique Sani
Apart from what Jeremy said you should also remember that routes are
expensive. Use them wisely

Tarique

On Thu, Jun 28, 2012 at 5:36 PM, Jeremy Burns | Class Outfit
 wrote:
> I disagree. I think you're not using routes in their purest form (to route



-- 
=
PHP for E-Biz: http://sanisoft.com
=

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Routes vs Type checking for Action Parameters, best practice?

2012-06-28 Thread Jeremy Burns | Class Outfit
I disagree. I think you're not using routes in their purest form (to route 
stuff in the right way - rather than error trapping) and even if it passes you 
still need to check the validity in the controller and redirect if necessary. 
Why do that in two places? And what happens in the router if a non-integer is 
passed?

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 28 Jun 2012, at 12:58:36, Poyan Nabati wrote:

> That's another type of error though. It's something have to handle in your 
> application but I don't see the relation to my OP. 
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>  
>  
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Routes vs Type checking for Action Parameters, best practice?

2012-06-28 Thread Poyan Nabati
That's another type of error though. It's something have to handle in your 
application but I don't see the relation to my OP. 

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Routes vs Type checking for Action Parameters, best practice?

2012-06-28 Thread Jeremy Burns | Class Outfit
What happens if you pass an $id that is an integer but that $id doesn't exist 
in the books table?

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 28 Jun 2012, at 11:26:40, Poyan Nabati wrote:

> Lets say I have a controller Books with an action view() defined as follows: 
> 
> class BooksController extends AppController {
> public function view($id) {
> // something
> }
> }
> 
> Let's assume that $id is supposed to be of a numeric type. 
> 
> I see two options; 
> 
> 1) Setup the route so that it only connects for instance books/view/{integer} 
> to  Books->view($id)
> 2) Have general routing like the defaults in CakePHP and include code in 
> view() to make sure that $id is set and is numeric. 
> 
> Which is better practice? 
> 
> In my view I think the former is cleaner and less magicky. This is something 
> I enjoyed working with the Play Framwork, that you explicitly had to connect 
> a route to each action. 
> 
> What is your opinion?
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>  
>  
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Routes vs Type checking for Action Parameters, best practice?

2012-06-28 Thread Poyan Nabati
Lets say I have a controller Books with an action view() defined as 
follows: 

class BooksController extends AppController {

public function view($id) {

// something

}

}

Let's assume that $id is supposed to be of a numeric type. 

I see two options; 

1) Setup the route so that it only connects for instance 
books/view/{integer} to  Books->view($id)
2) Have general routing like the defaults in CakePHP and include code in 
view() to make sure that $id is set and is numeric. 

Which is better practice? 

In my view I think the former is cleaner and less magicky. This is 
something I enjoyed working with the Play Framwork, that you explicitly had 
to connect a route to each action. 

What is your opinion?

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Looking for MVC & CakePHP Best practice doc, examples for Med to large sites

2012-06-08 Thread McBuck DGAF
While is best practice to start with you data architecture, Cake does
have certain requirements to keep in mind for when you do get around
to code generating.  These are worth mentioning, even if they seem
academic.

* Obviously, you want to follow Cake's naming conventions for tables
and fields. 
http://book.cakephp.org/2.0/en/getting-started/cakephp-conventions.html#model-and-database-conventions

* Cake requires requires a single-field primary key (by convention,
named "id").  This should be either an auto-incrementing integer or
UUID.

* Cake cannot work with composite primary keys, so you always have the
"id" field described above.

* The linking table for many-to-many relations should be named
properly ("tableA_tableB," with the tables in alphabetic order) and
does NOT require an id field, although you can (and maybe should) add
one.  This allows you to skip the trouble of creating model files for
these linking tables in your app.  If you plan on saving any other
data in the linking table, then you will need to have an id field and
create a model file for the table.

I can't think of any others, but if you follow these it will ease your
path with Cake when it comes time actually crunch the code.

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Looking for MVC & CakePHP Best practice doc, examples for Med to large sites

2012-06-07 Thread Justin Edwards
If you take a look at bakingplate, they have lots of submodules from
various people that you cans see their work.  You can also click on Network
on a project on github and see other people's forks and additions.

https://github.com/ProLoser/BakingPlate



On Thu, Jun 7, 2012 at 7:59 AM, bs28723  wrote:

> On 6/6/2012 10:19 PM, Justin Edwards [via CakePHP] wrote:
> >
> > For development as you go along,  you'd naturally take your controller
> > methods and turn them into components where you'd see they'd need to
> > be reused, the same with helpers.
> exactly. I have already started doing this on my project.  Looks like
> this is a natural progression. Good to know.
> > You'll naturally have lots of DUH moments and feel like a moron as you
> > learn, that's what learning is all about.   A man isn't worth his salt
> > unless he doesn't appreciate the grind and the discipline.
> >
> I like learning, I just get frustrated when I want to know more, and I
> can't find the information quickly.  But I think your idea of getting
> code from github may be a great idea.  Is there an easy way to search
> and see what is out there?  Seems pretty random.
>
> Thanks,
> bill
>
>
> --
> View this message in context: Re: Looking for MVC & CakePHP Best practice
> doc, examples for Med to large 
> sites<http://cakephp.1045679.n5.nabble.com/Looking-for-MVC-CakePHP-Best-practice-doc-examples-for-Med-to-large-sites-tp5708484p5708628.html>
> Sent from the CakePHP mailing list 
> archive<http://cakephp.1045679.n5.nabble.com/>at Nabble.com.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Looking for MVC & CakePHP Best practice doc, examples for Med to large sites

2012-06-07 Thread bs28723
 something that does not exist
>>>>> online, but only
>>>>> in a few folks heads.  :-) But maybe some parts of this
>>>>>     exists. You
>>>>> never know unless you ask..
>>>>>
>>>>> I am quickly learning a lot about MVC architecture and
>>>>> CakePHP over the
>>>>> last couple months. The cookbook, lots of trial and error,
>>>>> and this
>>>>> group are helping me learn - so thanks! But, I am finding
>>>>> myself using
>>>>> simple examples to learn or implement something.  Then as
>>>>> it scales,
>>>>> realize that I should have done this with a helper,
>>>>> behavior or
>>>>> component.  And now, I have to go back and redesign this,
>>>>> to do it
>>>>> correctly. Great that I am learning, but this is delaying
>>>>> my project. Sigh.
>>>>>
>>>>> So, I am looking for more advanced examples, tutorials, or
>>>>> best
>>>>> practices to "hopefully" allow me to skip over some of the
>>>>> basic
>>>>> learning curve and get right to an architecture that will
>>>>> support a
>>>>> medium to large site with lots of capabilities.
>>>>>
>>>>> Am I asking for too much?  :-)
>>>>> Any suggestions on where to get this advanced information
>>>>> or education I
>>>>> am looking for?
>>>>>
>>>>> Thanks,
>>>>> bill
>>>>>
>>>>> 
>>>>> 
>>>>> View this message in context: Looking for MVC & CakePHP
>>>>> Best practice doc, examples for Med to large sites
>>>>> 
>>>>> <http://cakephp.1045679.n5.nabble.com/Looking-for-MVC-CakePHP-Best-practice-doc-examples-for-Med-to-large-sites-tp5708484.html>
>>>>> Sent from the CakePHP mailing list archive
>>>>> <http://cakephp.1045679.n5.nabble.com/> at Nabble.com
>>>>> <http://Nabble.com>.
>>>>>     -- 
>>>>>
>>>>> -- 
>>>>> Our newest site for the community: CakePHP Video Tutorials 
>>>>> http://tv.cakephp.org <http://tv.cakephp.org/>
>>>>> Check out the new CakePHP Questions site http://ask.cakephp.org 
>>>>> <http://ask.cakephp.org/> and help others with their CakePHP 
>>>>> related questions.
>>>>>
>>>>>
>>>>> To unsubscribe from this group, send email to
>>>>> [hidden email]  
>>>>> For more options, visit this group at 
>>>>> http://groups.google.com/group/cake-php
>>>>
>>>>
>>>> -- 
>>>> Our newest site for the community: CakePHP Video Tutorials 
>>>> http://tv.cakephp.org <http://tv.cakephp.org/>
>>>> Check out the new CakePHP Questions site http://ask.cakephp.org 
>>>> <http://ask.cakephp.org/> and help others with their CakePHP 
>>>> related questions.
>>>>
>>>>
>>>> To unsubscribe from this group, send email to
>>>> [hidden email]  For 
>>>> more options, visit this group at 
>>>> http://groups.google.com/group/cake-php
>>>
>>> -- 
>>> Our newest site for the community: CakePHP Video Tutorials 
>>> http://tv.cakephp.org
>>> Check out the new CakePHP Questions site http://ask.cakephp.org and 
>>> help others with their CakePHP related questions.
>>>
>>>
>>> To unsubscribe from this group, send email to
>>> [hidden email]  For 
>>> more options, visit this group at 
>>> http://groups.google.com/group/cake-php
>>>
>>>
>>> 
>>> If you reply to this email, your message will be added to the 
>>> discussion below:
>>> http://cakephp.1045679.n5.nabble.com/Looking-for-MVC-CakePHP-Best-practice-doc-examples-for-Med-to-large-sites-tp5708484p5708597.html
>>>  
>>>
>>> To start 

Re: Looking for MVC & CakePHP Best practice doc, examples for Med to large sites

2012-06-07 Thread bs28723

On 6/6/2012 11:22 PM, John Hardy [via CakePHP] wrote:
> i dont usually reply to messages but this one slapped me in the face.
>
Not sure what you mean by this - but I hope is was not bad - LOL
Thanks for the help and suggestions.


--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Looking-for-MVC-CakePHP-Best-practice-doc-examples-for-Med-to-large-sites-tp5708484p5708629.html
Sent from the CakePHP mailing list archive at Nabble.com.

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Looking for MVC & CakePHP Best practice doc, examples for Med to large sites

2012-06-07 Thread bs28723
On 6/6/2012 10:19 PM, Justin Edwards [via CakePHP] wrote:
>
> For development as you go along,  you'd naturally take your controller 
> methods and turn them into components where you'd see they'd need to 
> be reused, the same with helpers.
exactly. I have already started doing this on my project.  Looks like 
this is a natural progression. Good to know.
> You'll naturally have lots of DUH moments and feel like a moron as you 
> learn, that's what learning is all about.   A man isn't worth his salt 
> unless he doesn't appreciate the grind and the discipline.
>
I like learning, I just get frustrated when I want to know more, and I 
can't find the information quickly.  But I think your idea of getting 
code from github may be a great idea.  Is there an easy way to search 
and see what is out there?  Seems pretty random.

Thanks,
bill



--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Looking-for-MVC-CakePHP-Best-practice-doc-examples-for-Med-to-large-sites-tp5708484p5708628.html
Sent from the CakePHP mailing list archive at Nabble.com.

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Looking for MVC & CakePHP Best practice doc, examples for Med to large sites

2012-06-07 Thread Steve Found
 nodes.

My database architecture is horizontally scaled between 1 master, 3 
slaves, 1 session server, and 1 data warehouse server.


I run a cluster of two memcached servers.

Do I have shitty code in my site, you're damn right I do. But its 
getting the job done, and keeping food on peoples tables.
I can always go back with a better strategy to handle it later. but 
there is much more good code in there too.


You suffer from second system effect. Read the mythical man month. it 
will help you.



On Jun 6, 2012, at 8:37 AM, Steve Found wrote:

Yes, I have the eBook of this that I bought from Apress. I believe 
it is for cake 1.3 ?


Although well worthy of a read, I felt there was a lot of wheel 
re-invention going on. For example, they implement their own tree 
handling code for categories when there is already a perfectly 
satisfactory TreeBehavior class in Cake and they did not really 
explain why they felt the need to do this. They also concentrate a 
lot on the use of elements.


To talk about the original question, the way cake works IMHO is to 
distribute logic between all three of Behavior, Component and Helper 
classes with behaviors extending models, Components extending 
controllers and Helpers extending views. The best analogy I can 
think of for these is the C++ multiple inheritance concept where 
functions are added to the classes to give them more methods. For 
example a model with both Tree and Containable behaviours is both of 
those things in addition to being a model.


To have a concept, say for example you wanted an edit box that 
plugged into junit's autocompletion, you may well write a plugin 
that contained all three of behaviours, components and helpers to 
achieve what you want.


Good examples of this can be found in the CakeDC github repository 
and I think this is a good a repository as any to see good Cake 
coding practises.


https://github.com/CakeDC

Hope this is of some help,

Steve (Ratty)


On 06/06/12 03:28, bs28723 wrote:

anyone familiar with this book?


  Practical CakePHP Projects (Expert's Voice in Web
  Development) by Richard Miller, John Omokore and Kai Chan
  (Dec 4, 2008)


or other books that provide good examples of the
Fat Model, Skinny controller  Concept?

On Sunday, June 3, 2012 9:04:26 AM UTC-4, ibejohn818 wrote:

Fat model, skinny controller.
Separation of presentation and data

A couple Core concepts in building a mote maintainable app.
However nothing is ever 100 perfect for all situations, learn
from writing your own shitty code and do not get caught in the
spiral of over engineering. Keep it simple and clever.

On Jun 2, 2012 11:18 AM, "bs28723"   wrote:

I am probably looking for something that does not exist
online, but only
in a few folks heads.  :-) But maybe some parts of this
exists. You
never know unless you ask..

I am quickly learning a lot about MVC architecture and
CakePHP over the
last couple months. The cookbook, lots of trial and error,
and this
group are helping me learn - so thanks! But, I am finding
myself using
simple examples to learn or implement something.  Then as
it scales,
realize that I should have done this with a helper,
behavior or
component.  And now, I have to go back and redesign this,
to do it
correctly. Great that I am learning, but this is delaying
my project. Sigh.

So, I am looking for more advanced examples, tutorials, or
best
practices to "hopefully" allow me to skip over some of the
basic
learning curve and get right to an architecture that will
support a
medium to large site with lots of capabilities.

Am I asking for too much?  :-)
Any suggestions on where to get this advanced information
or education I
am looking for?

Thanks,
bill

----
View this message in context: Looking for MVC & CakePHP
Best practice doc, examples for Med to large sites

<http://cakephp.1045679.n5.nabble.com/Looking-for-MVC-CakePHP-Best-practice-doc-examples-for-Med-to-large-sites-tp5708484.html>
Sent from the CakePHP mailing list archive
<http://cakephp.1045679.n5.nabble.com/> at Nabble.com
<http://Nabble.com>.
-- 


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



To unsubscribe from this group, send email to
[hidden email]  For 
more options, visit this group at 
http://groups.google.com/group/cake-php



--
Our newest

Re: Looking for MVC & CakePHP Best practice doc, examples for Med to large sites

2012-06-06 Thread John Hardy
ices for cake, it's not needed, it's MVC, ORM etc. It's computer 
>> science and software engineering.
>> 
>> My site serves over 1 Million pages a day, over 600k in videos.
>> 
>> I have over 90 models shared between two domains ( admin and site )
>> 
>> Hundreds of controllers, hundreds of views.
>> 
>> I load balance between 8 16gb nodes.
>> 
>> My database architecture is horizontally scaled between 1 master, 3 slaves, 
>> 1 session server, and 1 data warehouse server.
>> 
>> I run a cluster of two memcached servers.
>> 
>> Do I have shitty code in my site, you're damn right I do. But its getting 
>> the job done, and keeping food on peoples tables.
>> I can always go back with a better strategy to handle it later. but there is 
>> much more good code in there too.
>> 
>> You suffer from second system effect. Read the mythical man month. it will 
>> help you.
>> 
>> 
>> 
>> On Jun 6, 2012, at 8:37 AM, Steve Found wrote:
>> 
>>> Yes, I have the eBook of this that I bought from Apress. I believe it is 
>>> for cake 1.3 ?
>>> 
>>> Although well worthy of a read, I felt there was a lot of wheel 
>>> re-invention going on. For example, they implement their own tree handling 
>>> code for categories when there is already a perfectly satisfactory 
>>> TreeBehavior class in Cake and they did not really explain why they felt 
>>> the need to do this. They also concentrate a lot on the use of elements.
>>> 
>>> To talk about the original question, the way cake works IMHO is to 
>>> distribute logic between all three of Behavior, Component and Helper 
>>> classes with behaviors extending models, Components extending controllers 
>>> and Helpers extending views. The best analogy I can think of for these is 
>>> the C++ multiple inheritance concept where functions are added to the 
>>> classes to give them more methods. For example a model with both Tree and 
>>> Containable behaviours is both of those things in addition to being a model.
>>> 
>>> To have a concept, say for example you wanted an edit box that plugged into 
>>> junit's autocompletion, you may well write a plugin that contained all 
>>> three of behaviours, components and helpers to achieve what you want.
>>> 
>>> Good examples of this can be found in the CakeDC github repository and I 
>>> think this is a good a repository as any to see good Cake coding practises. 
>>> 
>>> https://github.com/CakeDC
>>> 
>>> Hope this is of some help,
>>> 
>>> Steve (Ratty)
>>> 
>>> 
>>> On 06/06/12 03:28, bs28723 wrote:
>>>> 
>>>> anyone familiar with this book?
>>>> 
>>>> Practical CakePHP Projects (Expert's Voice in Web Development) by Richard 
>>>> Miller, John Omokore and Kai Chan (Dec 4, 2008)
>>>> 
>>>> 
>>>> or other books that provide good examples of the 
>>>> Fat Model, Skinny controller  Concept?
>>>> 
>>>> On Sunday, June 3, 2012 9:04:26 AM UTC-4, ibejohn818 wrote:
>>>> Fat model, skinny controller.
>>>> Separation of presentation and data
>>>> 
>>>> A couple Core concepts in building a mote maintainable app.
>>>> However nothing is ever 100 perfect for all situations, learn from writing 
>>>> your own shitty code and do not get caught in the spiral of over   
>>>> engineering. Keep it simple and clever.
>>>> 
>>>> On Jun 2, 2012 11:18 AM, "bs28723"   wrote:
>>>> I am probably looking for something that does not exist online, but only 
>>>> in a few folks heads.  :-) But maybe some parts of this exists. You 
>>>> never know unless you ask.. 
>>>> 
>>>> I am quickly learning a lot about MVC architecture and CakePHP over the 
>>>> last couple months. The cookbook, lots of trial and error, and this 
>>>> group are helping me learn - so thanks! But, I am finding myself using 
>>>> simple examples to learn or implement something.  Then as it scales, 
>>>> realize that I should have done this with a helper, behavior or 
>>>> component.  And now, I have to go back and redesign this, to do it 
>>>> correctly. Great that I am learning, but this is delaying my project. 
>>>> Sigh. 
>>>> 
>>>> So, I am looking for more advanced examples, tutorials, or best 
>>

Re: Looking for MVC & CakePHP Best practice doc, examples for Med to large sites

2012-06-06 Thread Justin Edwards
 the framework.
>
>  It can handle a large infrastructure. You've already searched, there are
> no best practices for cake, it's not needed, it's MVC, ORM etc. It's
> computer science and software engineering.
>
>  My site serves over 1 Million pages a day, over 600k in videos.
>
>  I have over 90 models shared between two domains ( admin and site )
>
>  Hundreds of controllers, hundreds of views.
>
>  I load balance between 8 16gb nodes.
>
>  My database architecture is horizontally scaled between 1 master, 3
> slaves, 1 session server, and 1 data warehouse server.
>
>  I run a cluster of two memcached servers.
>
>  Do I have shitty code in my site, you're damn right I do. But its
> getting the job done, and keeping food on peoples tables.
> I can always go back with a better strategy to handle it later. but there
> is much more good code in there too.
>
>  You suffer from second system effect. Read the mythical man month. it
> will help you.
>
>
>  On Jun 6, 2012, at 8:37 AM, Steve Found wrote:
>
>  Yes, I have the eBook of this that I bought from Apress. I believe it is
> for cake 1.3 ?
>
> Although well worthy of a read, I felt there was a lot of wheel
> re-invention going on. For example, they implement their own tree handling
> code for categories when there is already a perfectly satisfactory
> TreeBehavior class in Cake and they did not really explain why they felt
> the need to do this. They also concentrate a lot on the use of elements.
>
> To talk about the original question, the way cake works IMHO is to
> distribute logic between all three of Behavior, Component and Helper
> classes with behaviors extending models, Components extending controllers
> and Helpers extending views. The best analogy I can think of for these is
> the C++ multiple inheritance concept where functions are added to the
> classes to give them more methods. For example a model with both Tree and
> Containable behaviours is both of those things in addition to being a model.
>
> To have a concept, say for example you wanted an edit box that plugged
> into junit's autocompletion, you may well write a plugin that contained all
> three of behaviours, components and helpers to achieve what you want.
>
> Good examples of this can be found in the CakeDC github repository and I
> think this is a good a repository as any to see good Cake coding practises.
>
> https://github.com/CakeDC
>
> Hope this is of some help,
>
> Steve (Ratty)
>
>
> On 06/06/12 03:28, bs28723 wrote:
>
> anyone familiar with this book?
>
>  Practical CakePHP Projects (Expert's Voice in Web Development) by
> Richard Miller, John Omokore and Kai Chan (Dec 4, 2008)
>
> or other books that provide good examples of the
> Fat Model, Skinny controller  Concept?
>
> On Sunday, June 3, 2012 9:04:26 AM UTC-4, ibejohn818 wrote:
>>
>> Fat model, skinny controller.
>> Separation of presentation and data
>>
>> A couple Core concepts in building a mote maintainable app.
>> However nothing is ever 100 perfect for all situations, learn from
>> writing your own shitty code and do not get caught in the spiral of over
>> engineering. Keep it simple and clever.
>> On Jun 2, 2012 11:18 AM, "bs28723"   wrote:
>>
>>> I am probably looking for something that does not exist online, but only
>>> in a few folks heads.  :-) But maybe some parts of this exists. You
>>> never know unless you ask..
>>>
>>> I am quickly learning a lot about MVC architecture and CakePHP over the
>>> last couple months. The cookbook, lots of trial and error, and this
>>> group are helping me learn - so thanks! But, I am finding myself using
>>> simple examples to learn or implement something.  Then as it scales,
>>> realize that I should have done this with a helper, behavior or
>>> component.  And now, I have to go back and redesign this, to do it
>>> correctly. Great that I am learning, but this is delaying my project.
>>> Sigh.
>>>
>>> So, I am looking for more advanced examples, tutorials, or best
>>> practices to "hopefully" allow me to skip over some of the basic
>>> learning curve and get right to an architecture that will support a
>>> medium to large site with lots of capabilities.
>>>
>>> Am I asking for too much?  :-)
>>> Any suggestions on where to get this advanced information or education I
>>> am looking for?
>>>
>>> Thanks,
>>> bill
>>>
>>> --
>>> View this message in context: Looking for MV

Re: Looking for MVC & CakePHP Best practice doc, examples for Med to large sites

2012-06-06 Thread bs28723
ribute logic between all three of Behavior, Component and Helper 
>> classes with behaviors extending models, Components extending 
>> controllers and Helpers extending views. The best analogy I can think 
>> of for these is the C++ multiple inheritance concept where functions 
>> are added to the classes to give them more methods. For example a 
>> model with both Tree and Containable behaviours is both of those 
>> things in addition to being a model.
>>
>> To have a concept, say for example you wanted an edit box that 
>> plugged into junit's autocompletion, you may well write a plugin that 
>> contained all three of behaviours, components and helpers to achieve 
>> what you want.
>>
>> Good examples of this can be found in the CakeDC github repository 
>> and I think this is a good a repository as any to see good Cake 
>> coding practises.
>>
>> https://github.com/CakeDC
>>
>> Hope this is of some help,
>>
>> Steve (Ratty)
>>
>>
>> On 06/06/12 03:28, bs28723 wrote:
>>> anyone familiar with this book?
>>>
>>>
>>>   Practical CakePHP Projects (Expert's Voice in Web Development)
>>>   by Richard Miller, John Omokore and Kai Chan (Dec 4, 2008)
>>>
>>>
>>> or other books that provide good examples of the
>>> Fat Model, Skinny controller  Concept?
>>>
>>> On Sunday, June 3, 2012 9:04:26 AM UTC-4, ibejohn818 wrote:
>>>
>>> Fat model, skinny controller.
>>> Separation of presentation and data
>>>
>>> A couple Core concepts in building a mote maintainable app.
>>> However nothing is ever 100 perfect for all situations, learn
>>> from writing your own shitty code and do not get caught in the
>>> spiral of over engineering. Keep it simple and clever.
>>>
>>> On Jun 2, 2012 11:18 AM, "bs28723"   wrote:
>>>
>>> I am probably looking for something that does not exist
>>> online, but only
>>> in a few folks heads.  :-) But maybe some parts of this
>>> exists. You
>>> never know unless you ask..
>>>
>>> I am quickly learning a lot about MVC architecture and
>>> CakePHP over the
>>> last couple months. The cookbook, lots of trial and error,
>>> and this
>>> group are helping me learn - so thanks! But, I am finding
>>> myself using
>>> simple examples to learn or implement something.  Then as it
>>> scales,
>>> realize that I should have done this with a helper, behavior or
>>> component.  And now, I have to go back and redesign this, to
>>> do it
>>> correctly. Great that I am learning, but this is delaying my
>>> project. Sigh.
>>>
>>> So, I am looking for more advanced examples, tutorials, or best
>>> practices to "hopefully" allow me to skip over some of the
>>> basic
>>> learning curve and get right to an architecture that will
>>> support a
>>> medium to large site with lots of capabilities.
>>>
>>> Am I asking for too much?  :-)
>>> Any suggestions on where to get this advanced information or
>>> education I
>>> am looking for?
>>>
>>> Thanks,
>>> bill
>>>
>>> 
>>> 
>>> View this message in context: Looking for MVC & CakePHP Best
>>> practice doc, examples for Med to large sites
>>> 
>>> <http://cakephp.1045679.n5.nabble.com/Looking-for-MVC-CakePHP-Best-practice-doc-examples-for-Med-to-large-sites-tp5708484.html>
>>> Sent from the CakePHP mailing list archive
>>> <http://cakephp.1045679.n5.nabble.com/> at Nabble.com
>>> <http://Nabble.com>.
>>> -- 
>>>
>>> -- 
>>> Our newest site for the community: CakePHP Video Tutorials 
>>> http://tv.cakephp.org <http://tv.cakephp.org/>
>>> Check out the new CakePHP Questions site http://ask.cakephp.org 
>>> <http://ask.cakephp.org/> and help others with their CakePHP related 
>>> questions.
>>>
>>>
>>> To unsubscribe from this group, send email to
>>> [hidden email]  For 
&

Re: Looking for MVC & CakePHP Best practice doc, examples for Med to large sites

2012-06-06 Thread bs28723
My apology if I offended anyone.  I have written and rewritten my share 
of bad code. I have probably even posted a few examples of my bad code 
in this group. I was just trying to see if this was the right forum for 
an architecture discussion.
Mike - I saw your apology and it was not needed. It was probably my 
fault for trying to make a joke or bad humor that did not play well in a 
posting. I have been know to step in it and put my foot in my mouth from 
time to time.  Sorry.

You and John make an important point about the data. I agree and 
understand your point.  But I am obviously not asking the question 
right, so let me rethink this.

Thanks for taking the time to respond.
Bill

On 6/6/2012 10:50 AM, Michael Gaiser [via CakePHP] wrote:
> Bill, you might want to avoid insulting those users who ask "shitty 
> code questions" while in the same post asking for their help...
>
> You are looking for hangups in cakephp where your database setup will 
> differ due to limitations with the framework. To this point, I have 
> only experienced a direct relationship between the quality of your 
> database setup and your final product and the ease at which you can 
> bring it to completion. Cake offers many different ways to handle the 
> same situation, be it auto-magic or manual. The quote at the end of 
> John's link <http://lwn.net/Articles/193245/> was in fact correct and 
> should point you towards the idea that if you want the most optimal 
> use of your time, spend it on your data architecture because once that 
> is solid, cake can handle the rest.
>
> While I am sure that everyone here has their own opinions on what 
> constitutes a good database setup, it might also not be the proper 
> forum for such a discussion to the degree you are looking for as a 
> MySQL forum might get you closer to your goal.
>
> On the other hand, if you have some shitty code questions to ask, we 
> would be happy to help.
>
> ~Michael --
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and 
> help others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [hidden email]  For 
> more options, visit this group at http://groups.google.com/group/cake-php
>
>
> 
> If you reply to this email, your message will be added to the 
> discussion below:
> http://cakephp.1045679.n5.nabble.com/Looking-for-MVC-CakePHP-Best-practice-doc-examples-for-Med-to-large-sites-tp5708484p5708593.html
>  
>
> To start a new topic under CakePHP, email 
> ml-node+s1045679n125572...@n5.nabble.com
> To unsubscribe from CakePHP, click here 
> <http://cakephp.1045679.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1255722&code=YmlsbC5zdG9sdHpAYm9vc3RlcndlYnNvbHV0aW9ucy5jb218MTI1NTcyMnwtNTU0NTk2MTUy>.
> NAML 
> <http://cakephp.1045679.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>  
>


--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Looking-for-MVC-CakePHP-Best-practice-doc-examples-for-Med-to-large-sites-tp5708484p5708604.html
Sent from the CakePHP mailing list archive at Nabble.com.

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Looking for MVC & CakePHP Best practice doc, examples for Med to large sites

2012-06-06 Thread Michael Gaiser
Yeah, I see it now. Apologies to Bill.

To be fair to Bill Michael, it was Johns responses to the initial question
> that mentioned "Shitty Code" and "Shitty Data" ...  I think Bill may have
> been making a point in much the same way as you have :)
>
>

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Looking for MVC & CakePHP Best practice doc, examples for Med to large sites

2012-06-06 Thread Steve Found
Yes, I have the eBook of this that I bought from Apress. I believe it is 
for cake 1.3 ?


Although well worthy of a read, I felt there was a lot of wheel 
re-invention going on. For example, they implement their own tree 
handling code for categories when there is already a perfectly 
satisfactory TreeBehavior class in Cake and they did not really explain 
why they felt the need to do this. They also concentrate a lot on the 
use of elements.


To talk about the original question, the way cake works IMHO is to 
distribute logic between all three of Behavior, Component and Helper 
classes with behaviors extending models, Components extending 
controllers and Helpers extending views. The best analogy I can think of 
for these is the C++ multiple inheritance concept where functions are 
added to the classes to give them more methods. For example a model with 
both Tree and Containable behaviours is both of those things in addition 
to being a model.


To have a concept, say for example you wanted an edit box that plugged 
into junit's autocompletion, you may well write a plugin that contained 
all three of behaviours, components and helpers to achieve what you want.


Good examples of this can be found in the CakeDC github repository and I 
think this is a good a repository as any to see good Cake coding practises.


https://github.com/CakeDC

Hope this is of some help,

Steve (Ratty)


On 06/06/12 03:28, bs28723 wrote:

anyone familiar with this book?

<http://www.amazon.com/Practical-CakePHP-Projects-Experts-Development/dp/143021578X/ref=sr_1_5?s=books&ie=UTF8&qid=1338949396&sr=1-5> 




  Practical CakePHP Projects (Expert's Voice in Web Development)
  by Richard Miller, John Omokore and Kai Chan (Dec 4, 2008)


or other books that provide good examples of the
Fat Model, Skinny controller  Concept?

On Sunday, June 3, 2012 9:04:26 AM UTC-4, ibejohn818 wrote:

Fat model, skinny controller.
Separation of presentation and data

A couple Core concepts in building a mote maintainable app.
However nothing is ever 100 perfect for all situations, learn from
writing your own shitty code and do not get caught in the spiral
of over engineering. Keep it simple and clever.

On Jun 2, 2012 11:18 AM, "bs28723"   wrote:

I am probably looking for something that does not exist
online, but only
in a few folks heads.  :-) But maybe some parts of this
exists. You
never know unless you ask..

I am quickly learning a lot about MVC architecture and CakePHP
over the
last couple months. The cookbook, lots of trial and error, and
this
group are helping me learn - so thanks! But, I am finding
myself using
simple examples to learn or implement something.  Then as it
scales,
realize that I should have done this with a helper, behavior or
component.  And now, I have to go back and redesign this, to
do it
correctly. Great that I am learning, but this is delaying my
project. Sigh.

So, I am looking for more advanced examples, tutorials, or best
practices to "hopefully" allow me to skip over some of the basic
learning curve and get right to an architecture that will
support a
medium to large site with lots of capabilities.

Am I asking for too much?  :-)
Any suggestions on where to get this advanced information or
education I
am looking for?

Thanks,
bill


View this message in context: Looking for MVC & CakePHP Best
practice doc, examples for Med to large sites

<http://cakephp.1045679.n5.nabble.com/Looking-for-MVC-CakePHP-Best-practice-doc-examples-for-Med-to-large-sites-tp5708484.html>
Sent from the CakePHP mailing list archive
<http://cakephp.1045679.n5.nabble.com/> at Nabble.com.
-- 


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



To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this 
group at http://groups.google.com/group/cake-php


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



To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Looking for MVC & CakePHP Best practice doc, examples for Med to large sites

2012-06-06 Thread Steve Found

On 06/06/12 15:48, Michael Gaiser wrote:
Bill, you might want to avoid insulting those users who ask "shitty 
code questions" while in the same post asking for their help...


You are looking for hangups in cakephp where your database setup will 
differ due to limitations with the framework. To this point, I have 
only experienced a direct relationship between the quality of your 
database setup and your final product and the ease at which you can 
bring it to completion. Cake offers many different ways to handle the 
same situation, be it auto-magic or manual. The quote at the end of 
John's link  was in fact correct and 
should point you towards the idea that if you want the most optimal 
use of your time, spend it on your data architecture because once that 
is solid, cake can handle the rest.


While I am sure that everyone here has their own opinions on what 
constitutes a good database setup, it might also not be the proper 
forum for such a discussion to the degree you are looking for as a 
MySQL forum might get you closer to your goal.


On the other hand, if you have some shitty code questions to ask, we 
would be happy to help.


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



To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this 
group at http://groups.google.com/group/cake-php
To be fair to Bill Michael, it was Johns responses to the initial 
question that mentioned "Shitty Code" and "Shitty Data" ...  I think 
Bill may have been making a point in much the same way as you have :)


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



To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Looking for MVC & CakePHP Best practice doc, examples for Med to large sites

2012-06-06 Thread Michael Gaiser
Bill, you might want to avoid insulting those users who ask "shitty code
questions" while in the same post asking for their help...

You are looking for hangups in cakephp where your database setup will
differ due to limitations with the framework. To this point, I have only
experienced a direct relationship between the quality of your database
setup and your final product and the ease at which you can bring it to
completion. Cake offers many different ways to handle the same situation,
be it auto-magic or manual. The quote at the end of John's
linkwas in fact correct and should
point you towards the idea that if you want
the most optimal use of your time, spend it on your data architecture
because once that is solid, cake can handle the rest.

While I am sure that everyone here has their own opinions on what
constitutes a good database setup, it might also not be the proper forum
for such a discussion to the degree you are looking for as a MySQL forum
might get you closer to your goal.

On the other hand, if you have some shitty code questions to ask, we would
be happy to help.

~Michael

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Looking for MVC & CakePHP Best practice doc, examples for Med to large sites

2012-06-06 Thread bs28723

Maybe I asked the wrong question initially, maybe this is not the right 
group for this, but I was trying to get a discussion among CakePHP 
experts to raise my level of expertise.  I learn a lot from high level 
architectural discussions (must be the computer architect in me, I like 
to know how to do something and some of the why behind it).

 From my understanding of CakePHP there is more of a link between the 
data architecture and the framework than most people think. While the 
framework should be able to model any data architecture, no matter how 
badly architected, it also seems that a good understanding of the 
framework assumptions and relationships is just as important.  In some 
cases it may make sense to tweak the data architecture to take 
advantages of the framework.  If you were doing this without a 
framework, you might not make those same changes.  (sorry, I can't think 
of a good example off the top of my head).At least for me, this is 
why I would like to see and have more discussions on not only the what 
to do, but some of the how and why.

Maybe I am alone in this kind of thinking. Maybe everyone else just 
wants a quick answer to shitty code questions, but I would rather do 
things right the first time - call me crazy.


On 6/5/2012 10:37 PM, John Hardy [via CakePHP] wrote:
> That book is four years old and probably covers a revision of the code 
> that is long passed it's prime.
>
> Focus on the integrity of your data, you can always rewrite bad code, 
> but it's much more difficult to transform shitty data.
>
> Read the bottom of this post by Torvalds, Words to engineer by….
>
>
> http://lwn.net/Articles/193245/
>
>
> On Jun 5, 2012, at 7:28 PM, bs28723 wrote:
>
>> anyone familiar with this book?
>>
>> <http://www.amazon.com/Practical-CakePHP-Projects-Experts-Development/dp/143021578X/ref=sr_1_5?s=books&ie=UTF8&qid=1338949396&sr=1-5>
>>  
>>
>>
>>
>>   Practical CakePHP Projects (Expert's Voice in Web Development)
>>   by Richard Miller, John Omokore and Kai Chan (Dec 4, 2008)
>>
>>
>> or other books that provide good examples of the
>> Fat Model, Skinny controller  Concept?
>>
>> On Sunday, June 3, 2012 9:04:26 AM UTC-4, ibejohn818 wrote:
>>
>> Fat model, skinny controller.
>> Separation of presentation and data
>>
>> A couple Core concepts in building a mote maintainable app.
>> However nothing is ever 100 perfect for all situations, learn
>> from writing your own shitty code and do not get caught in the
>> spiral of over engineering. Keep it simple and clever.
>>
>> On Jun 2, 2012 11:18 AM, "bs28723"   wrote:
>>
>> I am probably looking for something that does not exist
>> online, but only
>> in a few folks heads.  :-) But maybe some parts of this
>> exists. You
>> never know unless you ask..
>>
>> I am quickly learning a lot about MVC architecture and
>> CakePHP over the
>> last couple months. The cookbook, lots of trial and error,
>> and this
>> group are helping me learn - so thanks! But, I am finding
>> myself using
>> simple examples to learn or implement something.  Then as it
>> scales,
>> realize that I should have done this with a helper, behavior or
>> component.  And now, I have to go back and redesign this, to
>> do it
>> correctly. Great that I am learning, but this is delaying my
>> project. Sigh.
>>
>> So, I am looking for more advanced examples, tutorials, or best
>> practices to "hopefully" allow me to skip over some of the basic
>> learning curve and get right to an architecture that will
>> support a
>> medium to large site with lots of capabilities.
>>
>> Am I asking for too much?  :-)
>> Any suggestions on where to get this advanced information or
>> education I
>> am looking for?
>>
>> Thanks,
>> bill
>>
>> 
>> 
>> View this message in context: Looking for MVC & CakePHP Best
>> practice doc, examples for Med to large sites
>> 
>> <http://cakephp.1045679.n5.nabble.com/Looking-for-MVC-CakePHP-Best-practice-doc-examples-for-Med-to-large-sites-tp5708484.html>
>> Sent from the CakePHP mailing list archive
>> <http://cakephp.1045679.n5.nabble.com/> at Nab

Re: Looking for MVC & CakePHP Best practice doc, examples for Med to large sites

2012-06-05 Thread John Hardy
That book is four years old and probably covers a revision of the code that is 
long passed it's prime.

Focus on the integrity of your data, you can always rewrite bad code, but it's 
much more difficult to transform shitty data.

Read the bottom of this post by Torvalds, Words to engineer by….


http://lwn.net/Articles/193245/


On Jun 5, 2012, at 7:28 PM, bs28723 wrote:

> anyone familiar with this book?
> 
> Practical CakePHP Projects (Expert's Voice in Web Development) by Richard 
> Miller, John Omokore and Kai Chan (Dec 4, 2008)
> 
> 
> or other books that provide good examples of the 
> Fat Model, Skinny controller  Concept?
> 
> On Sunday, June 3, 2012 9:04:26 AM UTC-4, ibejohn818 wrote:
> Fat model, skinny controller.
> Separation of presentation and data
> 
> A couple Core concepts in building a mote maintainable app.
> However nothing is ever 100 perfect for all situations, learn from writing 
> your own shitty code and do not get caught in the spiral of over engineering. 
> Keep it simple and clever.
> 
> On Jun 2, 2012 11:18 AM, "bs28723"   wrote:
> I am probably looking for something that does not exist online, but only 
> in a few folks heads.  :-) But maybe some parts of this exists. You 
> never know unless you ask.. 
> 
> I am quickly learning a lot about MVC architecture and CakePHP over the 
> last couple months. The cookbook, lots of trial and error, and this 
> group are helping me learn - so thanks! But, I am finding myself using 
> simple examples to learn or implement something.  Then as it scales, 
> realize that I should have done this with a helper, behavior or 
> component.  And now, I have to go back and redesign this, to do it 
> correctly. Great that I am learning, but this is delaying my project. Sigh. 
> 
> So, I am looking for more advanced examples, tutorials, or best 
> practices to "hopefully" allow me to skip over some of the basic 
> learning curve and get right to an architecture that will support a 
> medium to large site with lots of capabilities. 
> 
> Am I asking for too much?  :-) 
> Any suggestions on where to get this advanced information or education I 
> am looking for? 
> 
> Thanks, 
> bill 
> 
> View this message in context: Looking for MVC & CakePHP Best practice doc, 
> examples for Med to large sites
> Sent from the CakePHP mailing list archive at Nabble.com.
> 
> -- 
> 
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>  
>  
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Looking for MVC & CakePHP Best practice doc, examples for Med to large sites

2012-06-05 Thread bs28723
anyone familiar with this book?

<http://www.amazon.com/Practical-CakePHP-Projects-Experts-Development/dp/143021578X/ref=sr_1_5?s=books&ie=UTF8&qid=1338949396&sr=1-5>
 
 Practical CakePHP Projects (Expert's Voice in Web Development) by Richard 
Miller, John Omokore and Kai Chan (Dec 4, 2008) 

or other books that provide good examples of the 
Fat Model, Skinny controller  Concept?

On Sunday, June 3, 2012 9:04:26 AM UTC-4, ibejohn818 wrote:
>
> Fat model, skinny controller.
> Separation of presentation and data
>
> A couple Core concepts in building a mote maintainable app.
> However nothing is ever 100 perfect for all situations, learn from writing 
> your own shitty code and do not get caught in the spiral of over 
> engineering. Keep it simple and clever.
> On Jun 2, 2012 11:18 AM, "bs28723"   wrote:
>
>> I am probably looking for something that does not exist online, but only 
>> in a few folks heads.  :-) But maybe some parts of this exists. You 
>> never know unless you ask.. 
>>
>> I am quickly learning a lot about MVC architecture and CakePHP over the 
>> last couple months. The cookbook, lots of trial and error, and this 
>> group are helping me learn - so thanks! But, I am finding myself using 
>> simple examples to learn or implement something.  Then as it scales, 
>> realize that I should have done this with a helper, behavior or 
>> component.  And now, I have to go back and redesign this, to do it 
>> correctly. Great that I am learning, but this is delaying my project. 
>> Sigh. 
>>
>> So, I am looking for more advanced examples, tutorials, or best 
>> practices to "hopefully" allow me to skip over some of the basic 
>> learning curve and get right to an architecture that will support a 
>> medium to large site with lots of capabilities. 
>>
>> Am I asking for too much?  :-) 
>> Any suggestions on where to get this advanced information or education I 
>> am looking for? 
>>
>> Thanks, 
>> bill 
>>
>> --
>> View this message in context: Looking for MVC & CakePHP Best practice 
>> doc, examples for Med to large 
>> sites<http://cakephp.1045679.n5.nabble.com/Looking-for-MVC-CakePHP-Best-practice-doc-examples-for-Med-to-large-sites-tp5708484.html>
>> Sent from the CakePHP mailing list 
>> archive<http://cakephp.1045679.n5.nabble.com/>at Nabble.com.
>>
>> -- 
>>
>>  

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Looking for MVC & CakePHP Best practice doc, examples for Med to large sites

2012-06-03 Thread John Hardy
Fat model, skinny controller.
Separation of presentation and data

A couple Core concepts in building a mote maintainable app.
However nothing is ever 100 perfect for all situations, learn from writing
your own shitty code and do not get caught in the spiral of over
engineering. Keep it simple and clever.
On Jun 2, 2012 11:18 AM, "bs28723" 
wrote:

> I am probably looking for something that does not exist online, but only
> in a few folks heads.  :-) But maybe some parts of this exists. You
> never know unless you ask..
>
> I am quickly learning a lot about MVC architecture and CakePHP over the
> last couple months. The cookbook, lots of trial and error, and this
> group are helping me learn - so thanks! But, I am finding myself using
> simple examples to learn or implement something.  Then as it scales,
> realize that I should have done this with a helper, behavior or
> component.  And now, I have to go back and redesign this, to do it
> correctly. Great that I am learning, but this is delaying my project.
> Sigh.
>
> So, I am looking for more advanced examples, tutorials, or best
> practices to "hopefully" allow me to skip over some of the basic
> learning curve and get right to an architecture that will support a
> medium to large site with lots of capabilities.
>
> Am I asking for too much?  :-)
> Any suggestions on where to get this advanced information or education I
> am looking for?
>
> Thanks,
> bill
>
> --
> View this message in context: Looking for MVC & CakePHP Best practice
> doc, examples for Med to large 
> sites<http://cakephp.1045679.n5.nabble.com/Looking-for-MVC-CakePHP-Best-practice-doc-examples-for-Med-to-large-sites-tp5708484.html>
> Sent from the CakePHP mailing list 
> archive<http://cakephp.1045679.n5.nabble.com/>at Nabble.com.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Looking for MVC & CakePHP Best practice doc, examples for Med to large sites

2012-06-02 Thread bs28723
I am probably looking for something that does not exist online, but only 
in a few folks heads.  :-) But maybe some parts of this exists. You 
never know unless you ask..

I am quickly learning a lot about MVC architecture and CakePHP over the 
last couple months. The cookbook, lots of trial and error, and this 
group are helping me learn - so thanks! But, I am finding myself using 
simple examples to learn or implement something.  Then as it scales, 
realize that I should have done this with a helper, behavior or 
component.  And now, I have to go back and redesign this, to do it 
correctly. Great that I am learning, but this is delaying my project. Sigh.

So, I am looking for more advanced examples, tutorials, or best 
practices to "hopefully" allow me to skip over some of the basic 
learning curve and get right to an architecture that will support a 
medium to large site with lots of capabilities.

Am I asking for too much?  :-)
Any suggestions on where to get this advanced information or education I 
am looking for?

Thanks,
bill


--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Looking-for-MVC-CakePHP-Best-practice-doc-examples-for-Med-to-large-sites-tp5708484.html
Sent from the CakePHP mailing list archive at Nabble.com.

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Github or SVN Settings Best Practice - Commercial Project based on CakePHP

2012-04-03 Thread park
Hi all,

I've been doing commercial projects based on CakePHP since 1.1 on SVN. I 
don't think we followed the best practice though:

   - We keep the entire cake directory within the SVN repo. Yes, with the 
   Cake core. So whenever a new version of Cake is released, we've got to 
   replace the entire Cake core in our repo.
   - We use SVN+deployment services such as Beanstalk and Springloops. That 
   means the staging and production apps on the server are maintained 
   completely by SFTP deployment.

We're looking to make some changes for the better now:

   1. We want to keep the SFTP deployment feature.
   2. We're considering to migrate to Github, so that we have the branch 
   feature.
   3. We want to pull and deployment new releases of Cake in a more 
   convenient manner.


Any suggestions or best practices are most welcome. Many thanks.

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


dealing with multicolumn unique indexes... best practice?

2012-01-19 Thread Ernesto
Hi all

What's the most Cake-ish way to deal with multicolumn unique indexes?

let me explain:

i have two models *Material HABTM Mix*.
I must keep track of some addtional infos (% of material for each mix) in 
the join table so, as stated in the cookbook, i scomposed the relationship 
in *2x hasMany*.
*Material hasMany MaterialMix hasMany Mix*.
here comes the problem: *each material can only be in a mix one time*.
so the combination between *materials_mixes.material_id* and *
materials_mixes.mix_id* must be unique.
how can i do that?

Note: the *combination* of field values must be unique, not the value itself

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best practice output a Dynamic menu

2011-12-12 Thread Perry
you can define a protected variable $showMenu = true in AppController, and
for those controllers who don't need menu, set this vairable to false

and in beforeRender method check this variable to output or not.

On Mon, Dec 12, 2011 at 7:08 PM, MetZ  wrote:

> ;)
>
> That was what I thought about helpers yes..
>
> Helper => will be used to generate the menu
>
> You would suggest to pull the menu + links fra database in
> app_controller beforerender, might work fine not using component for
> this.
>
> As I do not need to get the menues on every page, how would you
> suggest to only use the menu database retrival when needed?
>
> using if this params controller= controller ? or something like that?
> or do you know of a better way ?
>
> Thanks for all help and suggestions this far!
>
> -Tom
>
>
> On 12 Des, 07:17, Perry  wrote:
> > helpers should not get data directly, and I remember cakephp doesn't
> > suggest get data in components neither( i cant' find the refer), why not
> > get menu data in AppController's beforeRender method?
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Sun, Dec 11, 2011 at 8:16 PM, MetZ  wrote:
> >
> > > Hi.
> >
> > > I am storing my menues and links(tree behavior) in database. I am
> > > using several themes for the system, and hardcoding menues manuallly
> > > foreach theme is not an option.
> >
> > > I have no problem outputting the menues and links with a component and
> > > helper in my themes, but i am simply wodering about the best practice
> > > to do this?
> >
> > > Example, get menues and links from db in component, generate menu
> > > output with helper.
> >
> > > Or should i do all this in the helper?
> >
> > > Thanks!
> >
> > > tom
> >
> > > On Dec 8, 11:42 pm, Perry  wrote:
> > > > why consider components and helpers?
> >
> > > > do you store your menu structures in database? why not just treat it
> as a
> > > > data and output it directly in layout?
> >
> > > > On Fri, Dec 9, 2011 at 9:31 AM, MetZ  wrote:
> > > > > Hi all!
> >
> > > > > I am looking for a couple of suggestions.
> >
> > > > > I am currently working on a tree menu part of my app, where
> > > > > administrators can create menues, add links to the menues and move
> the
> > > > > links up and down in the tree.
> >
> > > > > Now, I am looking how to output this menu with links on the
> frontend.
> >
> > > > > Any suggestions on how I should proceed in this?
> >
> > > > > Currently, I am getting my menues and links in a component, I am
> > > > > initializing the "getmenues" function in component from
> > > > > app_controller.php.
> >
> > > > > And in my views, I call a helper to build the menu ul li li /ul
> >
> > > > > Do I need to use a component for this task? Or can I just include
> > > > > everything in the helper? the database calls I mean?
> >
> > > > > I have noe experience with helpers and components from before, so
> > > > > please be gentle with me ;)
> >
> > > > > Thanks for any and all help on this issue!!
> >
> > > > > BTW: Cake  1.3.13
> >
> > > > > -Tom
> >
> > > > > --
> > > > > Our newest site for the community: CakePHP Video Tutorials
> > > > >http://tv.cakephp.org
> > > > > Check out the new CakePHP Questions
> sitehttp://ask.cakephp.organdhelp
> > > > > others with their CakePHP related questions.
> >
> > > > > To unsubscribe from this group, send email to
> > > > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> > > group
> > > > > athttp://groups.google.com/group/cake-php
> >
> > > > --
> > > > Perry | 彭琪http://pengqi.me
> >
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > > others with their CakePHP related questions.
> >
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> group
> > > athttp://groups.google.com/group/cake-php
> >
> > --
> > Perry | 彭琪http://pengqi.me
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>



-- 
Perry | 彭琪
http://pengqi.me

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best practice output a Dynamic menu

2011-12-12 Thread euromark
such components may get their data automatically
that's what some are for, after all :)

even a helper may use data passed down form the controller/component
automatically.
at least in 2.0 - with $_View being officially available now.



On 12 Dez., 12:08, MetZ  wrote:
> ;)
>
> That was what I thought about helpers yes..
>
> Helper => will be used to generate the menu
>
> You would suggest to pull the menu + links fra database in
> app_controller beforerender, might work fine not using component for
> this.
>
> As I do not need to get the menues on every page, how would you
> suggest to only use the menu database retrival when needed?
>
> using if this params controller= controller ? or something like that?
> or do you know of a better way ?
>
> Thanks for all help and suggestions this far!
>
> -Tom
>
> On 12 Des, 07:17, Perry  wrote:
>
>
>
>
>
>
>
> > helpers should not get data directly, and I remember cakephp doesn't
> > suggest get data in components neither( i cant' find the refer), why not
> > get menu data in AppController's beforeRender method?
>
> > On Sun, Dec 11, 2011 at 8:16 PM, MetZ  wrote:
>
> > > Hi.
>
> > > I am storing my menues and links(tree behavior) in database. I am
> > > using several themes for the system, and hardcoding menues manuallly
> > > foreach theme is not an option.
>
> > > I have no problem outputting the menues and links with a component and
> > > helper in my themes, but i am simply wodering about the best practice
> > > to do this?
>
> > > Example, get menues and links from db in component, generate menu
> > > output with helper.
>
> > > Or should i do all this in the helper?
>
> > > Thanks!
>
> > > tom
>
> > > On Dec 8, 11:42 pm, Perry  wrote:
> > > > why consider components and helpers?
>
> > > > do you store your menu structures in database? why not just treat it as 
> > > > a
> > > > data and output it directly in layout?
>
> > > > On Fri, Dec 9, 2011 at 9:31 AM, MetZ  wrote:
> > > > > Hi all!
>
> > > > > I am looking for a couple of suggestions.
>
> > > > > I am currently working on a tree menu part of my app, where
> > > > > administrators can create menues, add links to the menues and move the
> > > > > links up and down in the tree.
>
> > > > > Now, I am looking how to output this menu with links on the frontend.
>
> > > > > Any suggestions on how I should proceed in this?
>
> > > > > Currently, I am getting my menues and links in a component, I am
> > > > > initializing the "getmenues" function in component from
> > > > > app_controller.php.
>
> > > > > And in my views, I call a helper to build the menu ul li li /ul
>
> > > > > Do I need to use a component for this task? Or can I just include
> > > > > everything in the helper? the database calls I mean?
>
> > > > > I have noe experience with helpers and components from before, so
> > > > > please be gentle with me ;)
>
> > > > > Thanks for any and all help on this issue!!
>
> > > > > BTW: Cake  1.3.13
>
> > > > > -Tom
>
> > > > > --
> > > > > Our newest site for the community: CakePHP Video Tutorials
> > > > >http://tv.cakephp.org
> > > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > > > others with their CakePHP related questions.
>
> > > > > To unsubscribe from this group, send email to
> > > > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> > > group
> > > > > athttp://groups.google.com/group/cake-php
>
> > > > --
> > > > Perry | 彭琪http://pengqi.me
>
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > > athttp://groups.google.com/group/cake-php
>
> > --
> > Perry | 彭琪http://pengqi.me

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best practice output a Dynamic menu

2011-12-12 Thread MetZ
;)

That was what I thought about helpers yes..

Helper => will be used to generate the menu

You would suggest to pull the menu + links fra database in
app_controller beforerender, might work fine not using component for
this.

As I do not need to get the menues on every page, how would you
suggest to only use the menu database retrival when needed?

using if this params controller= controller ? or something like that?
or do you know of a better way ?

Thanks for all help and suggestions this far!

-Tom


On 12 Des, 07:17, Perry  wrote:
> helpers should not get data directly, and I remember cakephp doesn't
> suggest get data in components neither( i cant' find the refer), why not
> get menu data in AppController's beforeRender method?
>
>
>
>
>
>
>
>
>
> On Sun, Dec 11, 2011 at 8:16 PM, MetZ  wrote:
>
> > Hi.
>
> > I am storing my menues and links(tree behavior) in database. I am
> > using several themes for the system, and hardcoding menues manuallly
> > foreach theme is not an option.
>
> > I have no problem outputting the menues and links with a component and
> > helper in my themes, but i am simply wodering about the best practice
> > to do this?
>
> > Example, get menues and links from db in component, generate menu
> > output with helper.
>
> > Or should i do all this in the helper?
>
> > Thanks!
>
> > tom
>
> > On Dec 8, 11:42 pm, Perry  wrote:
> > > why consider components and helpers?
>
> > > do you store your menu structures in database? why not just treat it as a
> > > data and output it directly in layout?
>
> > > On Fri, Dec 9, 2011 at 9:31 AM, MetZ  wrote:
> > > > Hi all!
>
> > > > I am looking for a couple of suggestions.
>
> > > > I am currently working on a tree menu part of my app, where
> > > > administrators can create menues, add links to the menues and move the
> > > > links up and down in the tree.
>
> > > > Now, I am looking how to output this menu with links on the frontend.
>
> > > > Any suggestions on how I should proceed in this?
>
> > > > Currently, I am getting my menues and links in a component, I am
> > > > initializing the "getmenues" function in component from
> > > > app_controller.php.
>
> > > > And in my views, I call a helper to build the menu ul li li /ul
>
> > > > Do I need to use a component for this task? Or can I just include
> > > > everything in the helper? the database calls I mean?
>
> > > > I have noe experience with helpers and components from before, so
> > > > please be gentle with me ;)
>
> > > > Thanks for any and all help on this issue!!
>
> > > > BTW: Cake  1.3.13
>
> > > > -Tom
>
> > > > --
> > > > Our newest site for the community: CakePHP Video Tutorials
> > > >http://tv.cakephp.org
> > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > > others with their CakePHP related questions.
>
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> > group
> > > > athttp://groups.google.com/group/cake-php
>
> > > --
> > > Perry | 彭琪http://pengqi.me
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php
>
> --
> Perry | 彭琪http://pengqi.me

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best practice output a Dynamic menu

2011-12-11 Thread Perry
helpers should not get data directly, and I remember cakephp doesn't
suggest get data in components neither( i cant' find the refer), why not
get menu data in AppController's beforeRender method?

On Sun, Dec 11, 2011 at 8:16 PM, MetZ  wrote:

>
> Hi.
>
> I am storing my menues and links(tree behavior) in database. I am
> using several themes for the system, and hardcoding menues manuallly
> foreach theme is not an option.
>
> I have no problem outputting the menues and links with a component and
> helper in my themes, but i am simply wodering about the best practice
> to do this?
>
> Example, get menues and links from db in component, generate menu
> output with helper.
>
> Or should i do all this in the helper?
>
> Thanks!
>
> tom
>
> On Dec 8, 11:42 pm, Perry  wrote:
> > why consider components and helpers?
> >
> > do you store your menu structures in database? why not just treat it as a
> > data and output it directly in layout?
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Fri, Dec 9, 2011 at 9:31 AM, MetZ  wrote:
> > > Hi all!
> >
> > > I am looking for a couple of suggestions.
> >
> > > I am currently working on a tree menu part of my app, where
> > > administrators can create menues, add links to the menues and move the
> > > links up and down in the tree.
> >
> > > Now, I am looking how to output this menu with links on the frontend.
> >
> > > Any suggestions on how I should proceed in this?
> >
> > > Currently, I am getting my menues and links in a component, I am
> > > initializing the "getmenues" function in component from
> > > app_controller.php.
> >
> > > And in my views, I call a helper to build the menu ul li li /ul
> >
> > > Do I need to use a component for this task? Or can I just include
> > > everything in the helper? the database calls I mean?
> >
> > > I have noe experience with helpers and components from before, so
> > > please be gentle with me ;)
> >
> > > Thanks for any and all help on this issue!!
> >
> > > BTW: Cake  1.3.13
> >
> > > -Tom
> >
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > > others with their CakePHP related questions.
> >
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> group
> > > athttp://groups.google.com/group/cake-php
> >
> > --
> > Perry | 彭琪http://pengqi.me
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>



-- 
Perry | 彭琪
http://pengqi.me

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best practice output a Dynamic menu

2011-12-11 Thread MetZ

Hi.

I am storing my menues and links(tree behavior) in database. I am
using several themes for the system, and hardcoding menues manuallly
foreach theme is not an option.

I have no problem outputting the menues and links with a component and
helper in my themes, but i am simply wodering about the best practice
to do this?

Example, get menues and links from db in component, generate menu
output with helper.

Or should i do all this in the helper?

Thanks!

tom

On Dec 8, 11:42 pm, Perry  wrote:
> why consider components and helpers?
>
> do you store your menu structures in database? why not just treat it as a
> data and output it directly in layout?
>
>
>
>
>
>
>
>
>
> On Fri, Dec 9, 2011 at 9:31 AM, MetZ  wrote:
> > Hi all!
>
> > I am looking for a couple of suggestions.
>
> > I am currently working on a tree menu part of my app, where
> > administrators can create menues, add links to the menues and move the
> > links up and down in the tree.
>
> > Now, I am looking how to output this menu with links on the frontend.
>
> > Any suggestions on how I should proceed in this?
>
> > Currently, I am getting my menues and links in a component, I am
> > initializing the "getmenues" function in component from
> > app_controller.php.
>
> > And in my views, I call a helper to build the menu ul li li /ul
>
> > Do I need to use a component for this task? Or can I just include
> > everything in the helper? the database calls I mean?
>
> > I have noe experience with helpers and components from before, so
> > please be gentle with me ;)
>
> > Thanks for any and all help on this issue!!
>
> > BTW: Cake  1.3.13
>
> > -Tom
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php
>
> --
> Perry | 彭琪http://pengqi.me

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best practice output a Dynamic menu

2011-12-08 Thread Perry
why consider components and helpers?

do you store your menu structures in database? why not just treat it as a
data and output it directly in layout?

On Fri, Dec 9, 2011 at 9:31 AM, MetZ  wrote:

> Hi all!
>
> I am looking for a couple of suggestions.
>
> I am currently working on a tree menu part of my app, where
> administrators can create menues, add links to the menues and move the
> links up and down in the tree.
>
> Now, I am looking how to output this menu with links on the frontend.
>
> Any suggestions on how I should proceed in this?
>
> Currently, I am getting my menues and links in a component, I am
> initializing the "getmenues" function in component from
> app_controller.php.
>
> And in my views, I call a helper to build the menu ul li li /ul
>
> Do I need to use a component for this task? Or can I just include
> everything in the helper? the database calls I mean?
>
> I have noe experience with helpers and components from before, so
> please be gentle with me ;)
>
> Thanks for any and all help on this issue!!
>
> BTW: Cake  1.3.13
>
> -Tom
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>



-- 
Perry | 彭琪
http://pengqi.me

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Best practice output a Dynamic menu

2011-12-08 Thread MetZ
Hi all!

I am looking for a couple of suggestions.

I am currently working on a tree menu part of my app, where
administrators can create menues, add links to the menues and move the
links up and down in the tree.

Now, I am looking how to output this menu with links on the frontend.

Any suggestions on how I should proceed in this?

Currently, I am getting my menues and links in a component, I am
initializing the "getmenues" function in component from
app_controller.php.

And in my views, I call a helper to build the menu ul li li /ul

Do I need to use a component for this task? Or can I just include
everything in the helper? the database calls I mean?

I have noe experience with helpers and components from before, so
please be gentle with me ;)

Thanks for any and all help on this issue!!

BTW: Cake  1.3.13

-Tom

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best Practice (import, used, class registry)

2011-10-27 Thread majna
Shortest one :)

$Model = ClassRegistry::init([Plugin].[Model]);

or 

$posts = ClassRegistry::init('Blog.Post')->find('all');

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Best Practice (import, used, class registry)

2011-10-27 Thread zuha
Not really sure why there are 3+ ways to do the same thing in CakePHP but 
what is the best standard (future proof) way to link models which aren't 
inherently (hard coded) related.

App::import('Model', [Plugin].[Model]);
$Model = new [ModelClass];

App::uses([Plugin].[Model], 'Model');
$Model = new [ModelClass];

$Model = ClassRegistry::init([Plugin].[Model]);

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Exceptions, best practice

2011-10-24 Thread flosky
Thanks for the reply.
Does that mean that I don't neccessarily need a custom Exception
handler for my own Exceptions if I catch them myself?

-flosky

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Exceptions, best practice

2011-10-24 Thread José Lorenzo
The exception handler is a last resource mechanism. You should always use a 
try catch unless you think than presenting an error page to the user is the 
best thing to do. otherwise, if you can handle the exception and recover 
from it, you should do so.

There are very clever ways of using the exception handler to recover from 
exceptions,although I would suggest using try catch when possible.

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Exceptions, best practice

2011-10-24 Thread flosky
Hi everyone,

I am going to rewrite my app with cake 2.0 and want to make sure I
understand everything before I start. I just read the chapter on
Exceptions and want to clearify some things.

1) Even though I could use try / catch within my app, it is
recommended to use the build in Exception handler or renderer.

2) If I add my own Exceptions, I also need to use a custom Exception
handler as the default handler doesn't know what to do with my custom
Exceptions.

Can you please say if these statements are right or wrong and if
wrong, why.

Thank you
-flosky

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: element vs controller vs component vs helper Best Practice suggestions

2011-10-15 Thread Marcus James
Hi Tom,

Making an element will speed up your application, you can easily call the
function in the element by using

requestAction('your_controller/your_function');

foreach($data as $record){


your html code goes here

}?>


in your function instead of setting data you just need to return it.

like

function myfunction()
{
$users = $this->User->findAll();

return $uses;
}


By doing this your application will be fast

Enjoy

Marcus

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


element vs controller vs component vs helper Best Practice suggestions

2011-10-14 Thread MetZ
Hi all.

I am not sure how to proceed. I want to display google analytics chart
in my dashboard.

I have in my user_controller.php admin_dashboard function:
all google analytics blablabla
to retrieve the data for the view trough GA api.
I am calling a config file (uname + pass), and a model + datasources
file in this ga function.

In my view I output it just fine, as is, but slow :(

Now, my question is, to speed this process up when visiting dashboard
(today, it takes time to load, because the controller retrieves all
the data for the GA output to view before displaying the dashboard).

I was thinking of:
- Make a separate function (admin_ga)
- make element and requestaction that function
- cache the element/requestaction

- ajax call some view/element to speed things up?

Or something like that.

I am not sure what would be the best practice/approach on this!

Any suggestions??

Thanks for all input on this... Awesome ;)

-Tom

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best practice? Building a search string with multiple options

2011-10-06 Thread majna
You can use "named params", as in https://github.com/CakeDC/search

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Best practice? Building a search string with multiple options

2011-10-06 Thread heohni
Hi,

I have a search where you can select various filters.
I wonder how I should build the params to pass them to the search
function.

I currently use this way:

/search/cat:x/ => category:id
/search/city/ber:x or /cityreg/x => city/suburb:id
/search/price:x/ => price:from value
/search/ref:x/ => search for a reference number

My question now is: Is this ok? But depending on the user he can
select these options in a un-sorted order, so I never now and what
place is which param - (the user can select just one filter or all 4)
means I have to work with regex to find the right string and value.

Or is there a better, easier way?
I look forward to learn from you guys!!

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best practice for pending/approved flag for comments in a blog

2011-10-06 Thread Austin Pickett
Have you tried using disqus plugin? It works rather smoothly.
On Oct 6, 2011 10:13 AM, "Jeremy Burns | Class Outfit" <
jeremybu...@classoutfit.com> wrote:
> You might want to consider a field for the id of the reviewer, something
to indicate their decision (they might decline it) and the time/date of that
decision.
>
> Jeremy Burns
> Class Outfit
>
> Tel: +44 (0) 208 123 3822
> Mob: +44 (0) 7973 481949
> Skype: jeremy_burns
> http://www.classoutfit.com
>
> On 6 Oct 2011, at 15:08, Boyan Penev wrote:
>
>> Thank you both for the useful help.
>>
>> Regards,
>>
>> Boyan
>>
>> On Thu, Oct 6, 2011 at 3:36 PM, euromark 
wrote:
>>> it seems a simply boolean (tinyint 1) is enough in your case
>>>
>>>
>>> On 6 Okt., 15:14, Zaky Katalan-Ezra  wrote:
 You can review CakeDC comments pluginhttps://github.com/CakeDC/comments







 On Wed, Oct 5, 2011 at 11:02 AM, Boyan  wrote:
> Hello,

> I am trying to develop a blog- like application with Cakephp and have
> a rather general question.
> The comments for each post should be first reviewed by the author of
> the post, before becoming visible (Comment belongsTo Article, Comment
> belongsTo User, Post belongsTo User)

> So my question is- what would be the best way to go about it? Would a
> boolean flag in the sql table for the comments suffice? And if so- is
> it secure enough? Or should I rather use ACL? Or maybe a completely
> different approach?

> Thank you,

> Boyan

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

> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this
group
> athttp://groups.google.com/group/cake-php
>>>
>>> --
>>> Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
>>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.
>>>
>>>
>>> To unsubscribe from this group, send email to
>>> cake-php+unsubscr...@googlegroups.com For more options, visit this group
at http://groups.google.com/group/cake-php
>>>
>>
>> --
>> Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.
>>
>>
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit this group
at http://groups.google.com/group/cake-php
>
> --
> Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
at http://groups.google.com/group/cake-php

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best practice for pending/approved flag for comments in a blog

2011-10-06 Thread Jeremy Burns | Class Outfit
You might want to consider a field for the id of the reviewer, something to 
indicate their decision (they might decline it) and the time/date of that 
decision.

Jeremy Burns
Class Outfit

Tel: +44 (0) 208 123 3822
Mob: +44 (0) 7973 481949
Skype: jeremy_burns
http://www.classoutfit.com

On 6 Oct 2011, at 15:08, Boyan Penev wrote:

> Thank you both for the useful help.
> 
> Regards,
> 
> Boyan
> 
> On Thu, Oct 6, 2011 at 3:36 PM, euromark  wrote:
>> it seems a simply boolean (tinyint 1) is enough in your case
>> 
>> 
>> On 6 Okt., 15:14, Zaky Katalan-Ezra  wrote:
>>> You can review CakeDC comments pluginhttps://github.com/CakeDC/comments
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> On Wed, Oct 5, 2011 at 11:02 AM, Boyan  wrote:
 Hello,
>>> 
 I am trying to develop a blog- like application with Cakephp and have
 a rather general question.
 The comments for each post should be first reviewed by the author of
 the post, before becoming visible (Comment belongsTo Article, Comment
 belongsTo User, Post belongsTo User)
>>> 
 So my question is- what would be the best way to go about it? Would a
 boolean flag in the sql table for the comments suffice? And if so- is
 it secure enough? Or should I rather use ACL? Or maybe a completely
 different approach?
>>> 
 Thank you,
>>> 
 Boyan
>>> 
 --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
 others with their CakePHP related questions.
>>> 
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 athttp://groups.google.com/group/cake-php
>> 
>> --
>> Our newest site for the community: CakePHP Video Tutorials 
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
>> others with their CakePHP related questions.
>> 
>> 
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
>> http://groups.google.com/group/cake-php
>> 
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
> 
> 
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best practice for pending/approved flag for comments in a blog

2011-10-06 Thread Boyan Penev
Thank you both for the useful help.

Regards,

Boyan

On Thu, Oct 6, 2011 at 3:36 PM, euromark  wrote:
> it seems a simply boolean (tinyint 1) is enough in your case
>
>
> On 6 Okt., 15:14, Zaky Katalan-Ezra  wrote:
>> You can review CakeDC comments pluginhttps://github.com/CakeDC/comments
>>
>>
>>
>>
>>
>>
>>
>> On Wed, Oct 5, 2011 at 11:02 AM, Boyan  wrote:
>> > Hello,
>>
>> > I am trying to develop a blog- like application with Cakephp and have
>> > a rather general question.
>> > The comments for each post should be first reviewed by the author of
>> > the post, before becoming visible (Comment belongsTo Article, Comment
>> > belongsTo User, Post belongsTo User)
>>
>> > So my question is- what would be the best way to go about it? Would a
>> > boolean flag in the sql table for the comments suffice? And if so- is
>> > it secure enough? Or should I rather use ACL? Or maybe a completely
>> > different approach?
>>
>> > Thank you,
>>
>> > Boyan
>>
>> > --
>> > Our newest site for the community: CakePHP Video Tutorials
>> >http://tv.cakephp.org
>> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
>> > others with their CakePHP related questions.
>>
>> > To unsubscribe from this group, send email to
>> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
>> > athttp://groups.google.com/group/cake-php
>
> --
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php
>

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best practice for pending/approved flag for comments in a blog

2011-10-06 Thread euromark
it seems a simply boolean (tinyint 1) is enough in your case


On 6 Okt., 15:14, Zaky Katalan-Ezra  wrote:
> You can review CakeDC comments pluginhttps://github.com/CakeDC/comments
>
>
>
>
>
>
>
> On Wed, Oct 5, 2011 at 11:02 AM, Boyan  wrote:
> > Hello,
>
> > I am trying to develop a blog- like application with Cakephp and have
> > a rather general question.
> > The comments for each post should be first reviewed by the author of
> > the post, before becoming visible (Comment belongsTo Article, Comment
> > belongsTo User, Post belongsTo User)
>
> > So my question is- what would be the best way to go about it? Would a
> > boolean flag in the sql table for the comments suffice? And if so- is
> > it secure enough? Or should I rather use ACL? Or maybe a completely
> > different approach?
>
> > Thank you,
>
> > Boyan
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


  1   2   3   4   >