Re: Cakephp and Asterisk

2012-06-06 Thread luca capra

I used it with ajam and phpsip

Il 07/06/2012 06:06, hamed hosseini ha scritto:

thanks,but i must use cakephp for create some  project like *FusionPBX*
--
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


Associative model validation fails, but does not report.

2012-06-06 Thread Michael Gaiser
So I have a form in my domains/add view. All the domain input fields
save their data just fine when the form is submitted. The problem is
that there is another field (Characters.0.character_id) that is to
save its data to an hasMany associated join model (CharactersDomain).
In the CharactersDomain model I have added a validation rule to the
"character_id" which I have set to always fail for testing purposes.
When I use saveAll to save the Domain data and the associated
character_id in the CharactersDomain the Domain record is saved to the
database but the CharactersDomain record is not (because the
validation failed).

So I have 2 questions:

1: I thought saveAll was only to save the data if all the validations
passed. Why was the Domain record saved if the CharactersDomain record
failed its validation?
2: When the CharactersDomain fails, I want it to display its error
message on the Characters.0.character_id input. Why did it not show
the error?

-- 
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 and Asterisk

2012-06-06 Thread hamed hosseini
thanks,but i must use cakephp for create some  project like *FusionPBX*

-- 
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: custom model validation question

2012-06-06 Thread Michael Gaiser
ok. i figured it out. The models being saved can be accessed in the
validation rule through $this->data.

On Wed, Jun 6, 2012 at 10:29 AM, Michael Gaiser  wrote:
> I guess my question is: How do you get access to all the other
> associated data that is being saved? I can set it up so I catch it
> before the save happens, but it feels kind of hacky and does not make
> use of the field error message 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-06 Thread John Hardy
No hard feelings dude. the system was actually built by one person, myself.
Its hard to find good web developers nowadays, they are too enamored with 
plugins and unit testing that they don't get anything on the screen. couple 
that with feature creep and you end up as myself, frustrated. i dont usually 
reply to messages but this one slapped me in the face. as long as your app 
works, then you're 90% there.

best thing to do is always explain to yourself what the purpose of your 
controller is, if you cant explain it in a single paragraph, you may be 
bloating it with too much functionality.

mvc should be seen and a design pattern that perpetuates the separation of 
concerns. 
ie: if you feel you need to instantiate a model in a view, then your merging 
concerns, if you feel you need a helper in a controller, you're merging 
concerns.

follow the rules that have been laid out even if it seems to be more abstract 
and takes a little more effort. you'll end up with more portable system.

database design is an art, you'll never get it 100 percent correct. just 
normalize as much as you can and dont be afraid to have a model with a dozen 
relationships. its always easier to merge data that break it apart

Sent from my iPhone

On Jun 6, 2012, at 6:46 PM, bs28723  wrote:

> Thanks John. I am familiar with the mythical man month - good stuff!
> 
> You, Michael and Steve, got me to re-look at what I was really trying to ask. 
> I think my questions are really more about "really" understanding MVC and ORM 
> than cake.  Cake is just the code that implements MVC.  While I understand 
> what MVC is and does. I can define it, and I can write simple applications 
> using it. (fat model, skinny controller) - I am not  confident in all my 
> architecture decisions and able explain all my choices. I feel like I am 
> still guessing, testing, and reworking things all the time.  To me, there is 
> a big difference between good code architecture and well written code.  right 
> now, I am trying to make sure that I am putting the code in the right spot.  
> It may be crappy code, but at least it is in the model or controller where it 
> belongs.  Maybe some day I can fix the crappy code.  But I want to avoid 
> putting  great code in the wrong place and end up with a crappy system. I am 
> not sure that I am explaining this any better, but my knowledge gap is the 
> MVC architecture. The data model is probably good for now. I am sure someone 
> could improve it, I don't claim to be perfect, it will probably grow and 
> change over time anyway. But it is some of the MVC expertise that I am 
> looking to learn.
> 
> An analogy that I can came up with is, that I think I am walking in terms of 
> MVC and Cake, and I want to start jogging or running.  But maybe, I am really 
> still crawling and I need to keep working, and coding, and testing, and 
> reworking, to learn to walk, before I can run. I think I am a fast learner 
> and I have learned everything that I can get my hands on, but I need more.  I 
> feel like a young Jedi wanting to learn more and more, so I can become a 
> Master sooner.  Or maybe it is because I am 53, I have been designing 
> projects and the last real programming I did was on an Unix System V device 
> driver 20 years ago and this ORM stuff is a little Greek. Not to mention that 
> all these young kids are picking this up in seconds, and I just want to keep 
> up. LOL
> 
> John, you should be very proud of the system you built below.  I spent 5 
> years doing system architecture for AT&T, helping people design architectures 
> like the one you describe below. For us it was standard, but a lot of people 
> probably don't understand the capability or the complexity behind a scalable 
> DB architecture with clustered servers with masters and slaves.  This is a 
> great testament to you and your team, and to Cake that it can handle this 
> large project.
> 
> Thanks again to you, Michael & Steve. I think I am going to try to learn more 
> about MVC and ORB.  Hopefully, I can find some things to help be learn to 
> run, but if not, I will just keep writing coded, learning, rewriting and 
> learn it over time.
> 
> Bill
> 
> On 6/6/2012 11:41 AM, John Hardy [via CakePHP] wrote:
>> 
>> A computer architect should just look at what cake does.
>> 
>> It bootstraps request into and MVC architecture. It has a built in ORM, and 
>> some injection points to customize and manipulate data throughout the 
>> request.
>> 
>> Cake is not gonna make you or break you, if your site it built shitty, it's 
>> not because of 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, hundre

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

2012-06-06 Thread Justin Edwards
I've managed heavy sites too.  The young ones don't learn the things as
fast as you'd think.  They can google examples and copy and paste things,
but they make a lot of mistakes because they don't learn the "why" or how
software and hardware systems interact.

You'll get your pace up once you have lots of your own examples that you've
figured out how to do on your own, and then can glance back at.I read
cake's code, read everyone else's code on github, and tinker with other
frameworks.   There are so many good things out there that others have
done, and if what someone else made isn't quite what you need, take their
code as inspiration.To me the only thing that's really lacking is very
many good (more advanced) examples of ajax scenarios with 2.x.

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.   For scaling to larger sites you'd really
want to debug and see where your bottle necks are and design appropriately
for the bottleneck.If you've been around that block enough times you
can foresee all of the bottlenecks you will have.

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.

On Wed, Jun 6, 2012 at 8:46 PM, bs28723  wrote:

> Thanks John. I am familiar with the mythical man month - good stuff!
>
> You, Michael and Steve, got me to re-look at what I was really trying to
> ask. I think my questions are really more about "really" understanding MVC
> and ORM than cake.  Cake is just the code that implements MVC.  While I
> understand what MVC is and does. I can define it, and I can write simple
> applications using it. (fat model, skinny controller) - I am not  confident
> in all my architecture decisions and able explain all my choices. I feel
> like I am still guessing, testing, and reworking things all the time.  To
> me, there is a big difference between good code architecture and well
> written code.  right now, I am trying to make sure that I am putting the
> code in the right spot.  It may be crappy code, but at least it is in the
> model or controller where it belongs.  Maybe some day I can fix the crappy
> code.  But I want to avoid putting  great code in the wrong place and end
> up with a crappy system. I am not sure that I am explaining this any
> better, but my knowledge gap is the MVC architecture. The data model is
> probably good for now. I am sure someone could improve it, I don't claim to
> be perfect, it will probably grow and change over time anyway. But it is
> some of the MVC expertise that I am looking to learn.
>
> An analogy that I can came up with is, that I think I am walking in terms
> of MVC and Cake, and I want to start jogging or running.  But maybe, I am
> really still crawling and I need to keep working, and coding, and testing,
> and reworking, to learn to walk, before I can run. I think I am a fast
> learner and I have learned everything that I can get my hands on, but I
> need more.  I feel like a young Jedi wanting to learn more and more, so I
> can become a Master sooner.  Or maybe it is because I am 53, I have been
> designing projects and the last real programming I did was on an Unix
> System V device driver 20 years ago and this ORM stuff is a little Greek.
> Not to mention that all these young kids are picking this up in seconds,
> and I just want to keep up. LOL
>
> John, you should be very proud of the system you built below.  I spent 5
> years doing system architecture for AT&T, helping people design
> architectures like the one you describe below. For us it was standard, but
> a lot of people probably don't understand the capability or the complexity
> behind a scalable DB architecture with clustered servers with masters and
> slaves.  This is a great testament to you and your team, and to Cake that
> it can handle this large project.
>
> Thanks again to you, Michael & Steve. I think I am going to try to learn
> more about MVC and ORB.  Hopefully, I can find some things to help be learn
> to run, but if not, I will just keep writing coded, learning, rewriting and
> learn it over time.
>
> Bill
>
>
> On 6/6/2012 11:41 AM, John Hardy [via CakePHP] wrote:
>
> A computer architect should just look at what cake does.
>
>  It bootstraps request into and MVC architecture. It has a built in ORM,
> and some injection points to customize and manipulate data throughout the
> request.
>
>  Cake is not gonna make you or break you, if your site it built shitty,
> it's not because of 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 be

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

2012-06-06 Thread bs28723
Thanks John. I am familiar with the mythical man month - good stuff!

You, Michael and Steve, got me to re-look at what I was really trying to 
ask. I think my questions are really more about "really" understanding 
MVC and ORM than cake.  Cake is just the code that implements MVC.  
While I understand what MVC is and does. I can define it, and I can 
write simple applications using it. (fat model, skinny controller) - I 
am not  confident in all my architecture decisions and able explain all 
my choices. I feel like I am still guessing, testing, and reworking 
things all the time.  To me, there is a big difference between good code 
architecture and well written code.  right now, I am trying to make sure 
that I am putting the code in the right spot.  It may be crappy code, 
but at least it is in the model or controller where it belongs.  Maybe 
some day I can fix the crappy code.  But I want to avoid putting  great 
code in the wrong place and end up with a crappy system. I am not sure 
that I am explaining this any better, but my knowledge gap is the MVC 
architecture. The data model is probably good for now. I am sure someone 
could improve it, I don't claim to be perfect, it will probably grow and 
change over time anyway. But it is some of the MVC expertise that I am 
looking to learn.

An analogy that I can came up with is, that I think I am walking in 
terms of MVC and Cake, and I want to start jogging or running.  But 
maybe, I am really still crawling and I need to keep working, and 
coding, and testing, and reworking, to learn to walk, before I can run. 
I think I am a fast learner and I have learned everything that I can get 
my hands on, but I need more.  I feel like a young Jedi wanting to learn 
more and more, so I can become a Master sooner.  Or maybe it is because 
I am 53, I have been designing projects and the last real programming I 
did was on an Unix System V device driver 20 years ago and this ORM 
stuff is a little Greek. Not to mention that all these young kids are 
picking this up in seconds, and I just want to keep up. LOL

John, you should be very proud of the system you built below.  I spent 5 
years doing system architecture for AT&T, helping people design 
architectures like the one you describe below. For us it was standard, 
but a lot of people probably don't understand the capability or the 
complexity behind a scalable DB architecture with clustered servers with 
masters and slaves.  This is a great testament to you and your team, and 
to Cake that it can handle this large project.

Thanks again to you, Michael & Steve. I think I am going to try to learn 
more about MVC and ORB.  Hopefully, I can find some things to help be 
learn to run, but if not, I will just keep writing coded, learning, 
rewriting and learn it over time.

Bill

On 6/6/2012 11:41 AM, John Hardy [via CakePHP] wrote:
> A computer architect should just look at what cake does.
>
> It bootstraps request into and MVC architecture. It has a built in 
> ORM, and some injection points to customize and manipulate data 
> throughout the request.
>
> Cake is not gonna make you or break you, if your site it built shitty, 
> it's not because of 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 

Re: Cakephp and Asterisk

2012-06-06 Thread Justin Edwards
IMHO it'd be better to look at freeswitch.
http://wiki.fusionpbx.com/index.php/Main_Page  If you are intent on
asterisk though,  I would suggest not using PHP, and using ruby instead.
http://adhearsion.com/

If you're looking for actual public switched telephony over actual phone
lines, I might recommend other things as well.   http://www.twilio.com/
https://www.tropo.com/home.jsp

If you are intent on PHP because of familiarity I'd use twilio and check
out openvbx http://www.openvbx.org/

On Wed, Jun 6, 2012 at 9:33 AM, hoss7  wrote:

> *hi i am new in  Asterisk ,i need some tutorial or some sample code or
> some source for learn how can i join Cakephp and  **Asterisk.*
> *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
>

-- 
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
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  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 
> .
> 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: I'm coming from Rails 3.2. There are some specific things I'd know how to do in CakePHP 2.0. Can someone help me?

2012-06-06 Thread stork
One more thing about migrations - yes, CakePHP does have builtin shell for 
database schema dump/restore 
http://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html
 
but mentioned CakeDC migrations plugin is better.

And - welcome in CakePHP community! :-)

-- 
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: I'm coming from Rails 3.2. There are some specific things I'd know how to do in CakePHP 2.0. Can someone help me?

2012-06-06 Thread stork
- Package management - for libs/vendors/plugins - git submodules

- Migrations - mainly for database schema/content changes, but also for 
filesystem changes dependent on application version (migration does have 
before() and after() callbacks) - https://github.com/CakeDC/migrations

- Automated Deployment - whatever is required (Capistrano, Ant, make...), 
but I prefer pure git & console shells/tasks executed from git hooks

- Assets compression  - https://github.com/markstory/asset_compress

- Workers and Background Jobs - 
http://book.cakephp.org/2.0/en/console-and-shells.html

- Namespaces for controllers - 
http://book.cakephp.org/2.0/en/development/routing.html#prefix-routing

- Access model methods from view - combination of helpers, 
http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#creating-custom-find-types
 
and http://book.cakephp.org/2.0/en/models/virtual-fields.html
I prefer to not call models from views/elements/layouts/helpers, but it is 
easy to obtain model instance from  ClassRegistry anywhere in application 
code.

- Chaining model scopes - either build $options (conditions, fields, order, 
recursive, contains...) dynamically, or custom find() type

- Tests - http://book.cakephp.org/2.0/en/development/testing.html - mostly 
through web interface, sometimes also from git hooks and TestShell 
http://book.cakephp.org/2.0/en/development/testing.html#running-tests-from-command-line

-- 
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: Custom views for errors in CakePHP 2.1

2012-06-06 Thread driz
Any updates on this please?

Thank you



On Tuesday, June 5, 2012 9:37:11 PM UTC+1, driz wrote:
>
> I've been trying to create some custom views for the errors in my cake 
> app. As I'm using v2.1 I have presumed I need to use the Exception Handler.
>
> What I have done so far is:
>
> *App::uses('ExceptionRenderer', 'Error');
>
> class AppExceptionRenderer extends ExceptionRenderer {
> public function notFound($error) {
> $this->controller->layout = null; 
> $this->controller->render('/Errors/error404');
> }
> }*
>
> However all I get is a blank page... I'm guess that this is the wrong way 
> to do this?
>
> Also I've noticed that if I call a 404 using throw new NotFoundException 
> it will call the code above, but if I type in a bad url then it will call 
> the default exception handler... Any ideas why this is happening? I was 
> under the impression they used the same system?
>
> I call the ExceptionRenderer using:
>
> *Configure::write('Exception', array(
> 'handler' => 'ErrorHandler::handleException',
> 'renderer' => 'AppExceptionRenderer',
> 'log' => true
> ));*

-- 
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: I'm coming from Rails 3.2. There are some specific things I'd know how to do in CakePHP 2.0. Can someone help me?

2012-06-06 Thread randy
Hey Bruno,


I can answer some of these with some of my experience. I don't have much
experience in Rails but I try to keep up with what's happening in that camp.

Packages: Personally, for plugins and libs, I use git submodules. There are
pitfalls there, but it works and since I'm the only one that owns the code,
I just work through them.

Migrations: I believe Cake supports migrations but have not used them much.
I believe it works similar to Rails.

Automated Deploys: I've read that people use Cap for PHP deployments. Cap
seems pretty flexible and can be used outside the Rails domain. There's
also things like ant and Phing but haven't looked into this just yet (but
seriously need to)

Asset Compression: Yes. Via plugin written Mark Story (
https://github.com/markstory/asset_compress) It works pretty well and
supports CDNs. Also supports things like coffee script and lesscss.

Workers, etc: Cake has a Task/Shell framework that allows you create, well,
tasks and shell programs you can run from cron or wherever. Beyond that,
you can add event handlers/listeners to respond to custom events in Cake's
Event system (http://book.cakephp.org/2.0/en/core-libraries/events.html)
which is new in 2.1. Then there's things like Gearman and Beanstalkd
(neither of which I have exposure to but the concept sounds interesting)

Skipping some points...  Testing: PHPUnit is the framework used by CakePHP
2+
http://book.cakephp.org/2.0/en/development/testing.html

Like you said, there's many ways to skin a cat, but these are some off the
top of my head.

Cheers!
randy



On Wed, Jun 6, 2012 at 8:19 AM, Bruno Dias  wrote:

> Hi guys. My intention is not to make comparisons or discuss which
> framework is better. I know the power from both CakePHP and Rails. I'm
> sure that there's a way to do similar things in both of them.
>
> So, this is the situation: in Rails framework, I'm used to do
> somethings that I'd like to do on CakePHP (some of them I haven't
> found on the documentation).
>
> They are:
>
> - Package management
> In Rails, I have the "Gemfile" file, where I write the version of each
> "gem" used in the application. If I want to upgrade or downgrade, I
> change the version and run the "bundle update" command. How do you
> update plugins? Do you use tools like GIT to checkout each one to
> newer versions?
>
> - Migrations
> When I need to change the database, I create a empty "migration" file
> through the console command "rails generate migration". Then, in the
> generated file, I add the changes, like
> "rename_column :users, :address, :location". After that, I run "rake
> db:migrate" and the database is migrated. How to do that on CakePHP?
>
> - Automated Deployment
> Deployment in Rails can be made automated using the "Capistrano" ruby
> gem. Basically, I run "cap production deploy" in the command line.
> Then, based on the instructions on the "deploy.rb" file, it logs into
> the server(s), clone the newest version of the code from the git
> repository, and backups the current release, so I can rollback. It
> also can create symlinks for "shared" folders (like user uploads),
> recompile the assets, run pending migrations, install new
> dependencies, restart some server processes, restart the application
> itself, and can execute other command line tasks. Is there something
> similar on CakePHP?
>
> - Assets compression
> In Rails, when I'm in production mode, the CSS and JS assets are
> automatically compiled into single files, and regenerated after each
> deployment. That's a native feature in Rails 3.1+. Is that possible on
> CakePHP?
>
> - Workers and Background Jobs
> Rails can use a gem called "delayed_job" to enqueue tasks to be
> executed in background by "workers", like sending an e-mail after user
> signup, for example. How do you do that?
>
> - Namespaces for controllers
> If I want to create an admin interface, or a web service (using the
> "api" namespace, for example), or a "mobile" namespace, I just create
> the respective folders on the "controllers" folder. Then, I put the
> controllers there and create the routes to access them. What's the
> best way to do that on Cake?
>
> - Access model methods from view
> It seems that CakePHP return an associative array when I grab data
> from the database, and not the true "objects". So, I can not access
> the model methods.
> Let's suppose my UserModel class provides a method called "age" that
> calculates the user current age based on his birthday. In Rails, I
> could do this on the view: <%= @user.age %>. I need to create a view
> helper for doing that on Cake? Like  >calc_user_age($user); ?> (or something like that) ?
> Another situation: Let's suppose I want to get the last comment from a
> user, and within the comment, insert a link to the related post using
> the post title.
> In Rails I would do something like @user.comments.last.post.title to
> get the post title. How could I do that in Cake, without using that
> "recursive=3" feature that gets lots 

I'm coming from Rails 3.2. There are some specific things I'd know how to do in CakePHP 2.0. Can someone help me?

2012-06-06 Thread Bruno Dias
Hi guys. My intention is not to make comparisons or discuss which
framework is better. I know the power from both CakePHP and Rails. I'm
sure that there's a way to do similar things in both of them.

So, this is the situation: in Rails framework, I'm used to do
somethings that I'd like to do on CakePHP (some of them I haven't
found on the documentation).

They are:

- Package management
In Rails, I have the "Gemfile" file, where I write the version of each
"gem" used in the application. If I want to upgrade or downgrade, I
change the version and run the "bundle update" command. How do you
update plugins? Do you use tools like GIT to checkout each one to
newer versions?

- Migrations
When I need to change the database, I create a empty "migration" file
through the console command "rails generate migration". Then, in the
generated file, I add the changes, like
"rename_column :users, :address, :location". After that, I run "rake
db:migrate" and the database is migrated. How to do that on CakePHP?

- Automated Deployment
Deployment in Rails can be made automated using the "Capistrano" ruby
gem. Basically, I run "cap production deploy" in the command line.
Then, based on the instructions on the "deploy.rb" file, it logs into
the server(s), clone the newest version of the code from the git
repository, and backups the current release, so I can rollback. It
also can create symlinks for "shared" folders (like user uploads),
recompile the assets, run pending migrations, install new
dependencies, restart some server processes, restart the application
itself, and can execute other command line tasks. Is there something
similar on CakePHP?

- Assets compression
In Rails, when I'm in production mode, the CSS and JS assets are
automatically compiled into single files, and regenerated after each
deployment. That's a native feature in Rails 3.1+. Is that possible on
CakePHP?

- Workers and Background Jobs
Rails can use a gem called "delayed_job" to enqueue tasks to be
executed in background by "workers", like sending an e-mail after user
signup, for example. How do you do that?

- Namespaces for controllers
If I want to create an admin interface, or a web service (using the
"api" namespace, for example), or a "mobile" namespace, I just create
the respective folders on the "controllers" folder. Then, I put the
controllers there and create the routes to access them. What's the
best way to do that on Cake?

- Access model methods from view
It seems that CakePHP return an associative array when I grab data
from the database, and not the true "objects". So, I can not access
the model methods.
Let's suppose my UserModel class provides a method called "age" that
calculates the user current age based on his birthday. In Rails, I
could do this on the view: <%= @user.age %>. I need to create a view
helper for doing that on Cake? Like calc_user_age($user); ?> (or something like that) ?
Another situation: Let's suppose I want to get the last comment from a
user, and within the comment, insert a link to the related post using
the post title.
In Rails I would do something like @user.comments.last.post.title to
get the post title. How could I do that in Cake, without using that
"recursive=3" feature that gets lots of unnecessary data?

- Chaining model scopes
Let's suppose I have a model called Post. In Rails, I can create
scopes on models and mix them the way I want.
If I want to the get the "5 last published posts from the category
Programming ordered by the most accessed", for example, I would call
them this way:
"Post.published.from_category("programming").most_accessed.limit(5)".
If I want only the draft posts ordered by recent, integrated with
pagination, I would call "Post.drafts.recent.page(2)".
What is the best way to create and chain scopes on CakePHP? Build
dynamically an array of conditions and send it as the parameter for
"find"?

- Tests
What are the testing tools adopted by the CakePHP community? I need to
test the models and its methods, test the controllers and its
responses and variables, and test the views content (also Javascript
interaction), create fixtures, etc. I also would know if there is a
way to create something like autotest, that run the tests after file
saves.

Well, basically these are the points. Sorry for the long post, and for
my error-prone and redundant english (i'm not a native speaker). Hope
we can have a good conversation. Thank you!

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

 




  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-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: CakePHP upload gives me problems

2012-06-06 Thread Steve Found

On 06/06/12 13:19, Ditshwanelo wrote:

Hello guys im new here =,would you help me with cake php upload.this
is my code and is not uploading...please help me


class NewslettersController extends AppController
{
   var $name='Newsletters';
   var $uses=array("Newsletter");
   var $helpers = array('Form', 'Session', 'Html');

   //allowed upload files
   var $validateFile = array(
   'size' =>  204800,
   'type' =>
'jpg,jpeg,png,gif','txt','pdf','doc','docx'
   );
   function index()
   {

   }

   function generateUniqueFilename($fileName, $path='')
   {
 $path = empty($path) ? WWW_ROOT.'/files/' : $path;
 $no = 1;
 $newFileName = $fileName;
// print_r($path);
//echo $path;
 while (file_exists("$path/".$newFileName))
{
   $no++;
   $newFileName = substr_replace($fileName, "_$no.", strrpos
   ($fileName, "."), 1);

 }
 return $newFileName;
   }

//handles file upload
function handleFileUpload($fileData, $fileName)
   {
 $error = false;
 //Get file type
 $typeArr = explode('/', $fileData['type']);
 //If size is provided for validation check with that size. Else
compare the size with INI file
 if (($this->validateFile['size']&&  $fileData['size']>  $this-

validateFile['size']) || $fileData['error'] == UPLOAD_ERR_INI_SIZE)

 {
   $error = 'File is too large to upload';
 }
 elseif ($this->validateFile['type']&&  (strpos($this-

validateFile['type'], strtolower($typeArr[1])) == false))

 {
   //File type is not the one we are going to accept. Error!!
   $error = 'Invalid file type';
 }
 else
 {
   //Data looks OK at this stage. Let's proceed.
   if ($fileData['error'] == UPLOAD_ERR_OK)
   {
 //Oops!! File size is zero. Error!
 if ($fileData['size'] == 0)
 {
   $error = 'Zero size file found.';
 }
 else
 {
   if (is_uploaded_file($fileData['tmp_name']))
   {
//Finally we can upload file now. Let's do it and return 
without
errors if success in moving.
 //if(file_exists(WWW_ROOT.'files'.DS.$fileName))
if(file_exists(WWW_ROOT.'files'.$fileName))
{
   
$url=file_get_contents(WWW_ROOT.'files'.DS.$filename);
   echo $url;
$query = $this->Newsletter->query("INSERT INTO
newsletters (news_name,news_content)
  VALUES('{$filename}','{$url}')");

 if (!move_uploaded_file($fileData['tmp_name'], WWW_ROOT.'/
files/'.$fileName))

 {
   $error = true;
 }

   }
   else
   {
 $error = true;
   }

 }
   }
 }
 return $error;
   }
   }
   function deleteMovedFile($fileName)
   {
 if (!$fileName || !is_file($fileName))
 {
   return true;
 }
 if(unlink($fileName))
 {
   return true;
 }
 return false;
   }

 function add()
 {
   $news_content=$this->data['Newsletter']['news_content'];
   if (empty($this->data))
   {
 $this->Document->create();
   }
   else
   {
 $err = false;
 if (!empty($this->data['Newsletter']['news_content']))
{
  $fileName = $this->generateUniqueFilename($this-

data['Newsletter']['news_content']);

   //$fileName = $this->generateUniqueFilename($this-

data['Attachment']['filename']['name']);

   echo 'The filename is:'. $fileName;
   $error = $this->handleFileUpload($this-

data['Newsletter']['news_content'], $fileName);

   echo 'The error is: '. $error;
}
  else
  {
 print_r($this->data);
   }
 if (!$error)
 {
   $this->data['Newsletter']['news_content'] = $fileName;
   if ($this->Newsletter->save($this->data))
   {
 $this->Session->setFlash(__('The Attachment has been
saved',true));
print_r($news_content);
 $this->redirect(array('action'=>'admins'=>'index'));
   }
  else
  {
 $err = true;
   }
 }
else
{
   $this->Newsletter->set($this->data);
 }


 if ($error || $err)
 {
   //Something failed. Remove the image uploaded if any.
   $this->deleteMovedFile(WWW_ROOT.FILE_URL.$fileName);
   $this->set('error', $error);
   $this->set('data', $this->data);
   $this->validateErrors($this->Newsletter);

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: paypal on cakephp 2.x?

2012-06-06 Thread Amit
I actually tried using the CakePHP 2.0 PayPal plugin yesterday but still 
found it broken. I was working on updating it, but I want to check out 
Quixotix class first.

On Wednesday, June 6, 2012 4:54:45 AM UTC-7, thqloz wrote:
>
> Good Afternoon,
>
>  I was looking for something similar and I found two interesting things :
> https://github.com/daniula/CakePHP-2.0-Paypal-IPN-Plugin/ which is an 
> updated version of CakePHP-Paypal-IPN-Plugin by webtechnick.
> https://github.com/Quixotix/PHP-PayPal-IPN 
> which is a php5 class to 
> deal with Paypal Ipn Api. (Not Cake Specific).
>
>
> Le dimanche 3 juin 2012 07:54:00 UTC+2, bs28723 a écrit :
>>
>> Anyone tried to get the CakePHP-Paypal-IPN-Plugin by webtechnick   to 
>> work with CakePHP 2.X? or is there a better option? 
>>
>>
>> --
>> View this message in context: paypal on cakephp 
>> 2.x?
>> Sent from the CakePHP mailing list 
>> archiveat 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


Cakephp and Asterisk

2012-06-06 Thread hoss7
*hi i am new in  Asterisk ,i need some tutorial or some sample code or some 
source for learn how can i join Cakephp and  **Asterisk.*
*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


Re: custom model validation question

2012-06-06 Thread Michael Gaiser
I guess my question is: How do you get access to all the other
associated data that is being saved? I can set it up so I catch it
before the save happens, but it feels kind of hacky and does not make
use of the field error message 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: CakePHP upload gives me problems

2012-06-06 Thread Harsha M V
Why dont you use an Existing plugin instead of writing all this ?

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


Working With Vendor Files

2012-06-06 Thread Harsha M V
I am implementing Google Analytics API and using 
https://code.google.com/p/google-api-php-client/ as Vendors.

I have built a small app in PHP where i need to do the following to have 
access to the Google accounts


// Include Required Libraries
require_once 'lib/apiClient.php';
require_once 'lib/contrib/apiAnalyticsService.php';
session_start();

// Create a Google Object
$client = new apiClient();
$client->setApplicationName("GitGrow");

$client->setClientId('9211ss4169.apps.googleusercontent.com');
$client->setClientSecret('zVPmKcQLs1587zdwcn');
$client->setRedirectUri('http://gitgrow.com/index.php');
$client->setDeveloperKey('AIzaSyCWesssyMz6e9PNKXi5rYhdyeLYI1iZI');
$client->setScopes('https://www.googleapis.com/auth/analytics.readonly');
$client->setApprovalPrompt('auto');

if (isset($_GET['code'])) {
  $client->authenticate();
  $_SESSION['token'] = $client->getAccessToken();
  $redirect = 'http://gitgrow.com/signup.php';
  header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
}

if (!$client->getAccessToken()) {
$authUrl = $client->createAuthUrl();
}



Since i will need the Google Account Authorization across the whole site. I 
would like to import the same into CakePHP. not sure how to bring and work 
with vendor files inside CakePHP. Can some one throw some light on how it 
can be done ?

-- 
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: user status change

2012-06-06 Thread Harsha M V

$this->Model->saveField('columnName', $data);



-- 
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?
>>
>> 
>>  
>>
>>
>>
>>   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
>> [hidden email]  For 
>> more options, visit this group at http://groups.google.com/group/cake-php
>
> -- 
> Our newest site for the

user status change

2012-06-06 Thread Roopa Mani C
i need to change the user status active or deactive

-- 
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 upload gives me problems

2012-06-06 Thread Ditshwanelo
Hello guys im new here =,would you help me with cake php upload.this
is my code and is not uploading...please help me


class NewslettersController extends AppController
{
  var $name='Newsletters';
  var $uses=array("Newsletter");
  var $helpers = array('Form', 'Session', 'Html');

  //allowed upload files
  var $validateFile = array(
  'size' => 204800,
  'type' =>
'jpg,jpeg,png,gif','txt','pdf','doc','docx'
  );
  function index()
  {

  }

  function generateUniqueFilename($fileName, $path='')
  {
$path = empty($path) ? WWW_ROOT.'/files/' : $path;
$no = 1;
$newFileName = $fileName;
// print_r($path);
//echo $path;
while (file_exists("$path/".$newFileName))
{
  $no++;
  $newFileName = substr_replace($fileName, "_$no.", strrpos
  ($fileName, "."), 1);

}
return $newFileName;
  }

//handles file upload
function handleFileUpload($fileData, $fileName)
  {
$error = false;
//Get file type
$typeArr = explode('/', $fileData['type']);
//If size is provided for validation check with that size. Else
compare the size with INI file
if (($this->validateFile['size'] && $fileData['size'] > $this-
>validateFile['size']) || $fileData['error'] == UPLOAD_ERR_INI_SIZE)
{
  $error = 'File is too large to upload';
}
elseif ($this->validateFile['type'] && (strpos($this-
>validateFile['type'], strtolower($typeArr[1])) == false))
{
  //File type is not the one we are going to accept. Error!!
  $error = 'Invalid file type';
}
else
{
  //Data looks OK at this stage. Let's proceed.
  if ($fileData['error'] == UPLOAD_ERR_OK)
  {
//Oops!! File size is zero. Error!
if ($fileData['size'] == 0)
{
  $error = 'Zero size file found.';
}
else
{
  if (is_uploaded_file($fileData['tmp_name']))
  {
//Finally we can upload file now. Let's do it and return 
without
errors if success in moving.
//if(file_exists(WWW_ROOT.'files'.DS.$fileName))
if(file_exists(WWW_ROOT.'files'.$fileName))
{
   
$url=file_get_contents(WWW_ROOT.'files'.DS.$filename);
   echo $url;
   $query = $this->Newsletter->query("INSERT INTO
newsletters (news_name,news_content)
  VALUES('{$filename}','{$url}')");

if (!move_uploaded_file($fileData['tmp_name'], WWW_ROOT.'/
files/'.$fileName))

{
  $error = true;
}

   }
  else
  {
$error = true;
  }

}
  }
}
return $error;
  }
  }
  function deleteMovedFile($fileName)
  {
if (!$fileName || !is_file($fileName))
{
  return true;
}
if(unlink($fileName))
{
  return true;
}
return false;
  }

function add()
{
   $news_content=$this->data['Newsletter']['news_content'];
  if (empty($this->data))
  {
$this->Document->create();
  }
  else
  {
$err = false;
if (!empty($this->data['Newsletter']['news_content']))
{
  $fileName = $this->generateUniqueFilename($this-
>data['Newsletter']['news_content']);
  //$fileName = $this->generateUniqueFilename($this-
>data['Attachment']['filename']['name']);
  echo 'The filename is:'. $fileName;
  $error = $this->handleFileUpload($this-
>data['Newsletter']['news_content'], $fileName);
  echo 'The error is: '. $error;
   }
  else
  {
print_r($this->data);
  }
if (!$error)
{
  $this->data['Newsletter']['news_content'] = $fileName;
  if ($this->Newsletter->save($this->data))
  {
$this->Session->setFlash(__('The Attachment has been
saved',true));
print_r($news_content);
$this->redirect(array('action'=>'admins'=>'index'));
  }
  else
  {
$err = true;
  }
}
else
{
  $this->Newsletter->set($this->data);
}


if ($error || $err)
{
  //Something failed. Remove the image uploaded if any.
  $this->deleteMovedFile(WWW_ROOT.FILE_URL.$fileName);
  $this->set('error', $error);
  $this->set('data', $this->data);
  $this->validateErrors($this->Newsletter);
  $this->render();
}
  }



}

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the ne

i need to change status of users

2012-06-06 Thread Siva Kumar
hai 

i need to change status of users active to deactive status please anyone can
help 

-
Shiva Kumar
--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/i-need-to-change-status-of-users-tp5708578.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: paypal on cakephp 2.x?

2012-06-06 Thread thqloz
Good Afternoon,

 I was looking for something similar and I found two interesting things :
https://github.com/daniula/CakePHP-2.0-Paypal-IPN-Plugin/ which is an 
updated version of CakePHP-Paypal-IPN-Plugin by webtechnick.
https://github.com/Quixotix/PHP-PayPal-IPN 
which is a php5 class to 
deal with Paypal Ipn Api. (Not Cake Specific).


Le dimanche 3 juin 2012 07:54:00 UTC+2, bs28723 a écrit :
>
> Anyone tried to get the CakePHP-Paypal-IPN-Plugin by webtechnick   to 
> work with CakePHP 2.X? or is there a better option? 
>
>
> --
> View this message in context: paypal on cakephp 
> 2.x?
> Sent from the CakePHP mailing list 
> archiveat 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


REST Routing for plugin resources in cake 1.3

2012-06-06 Thread yarik sheptykin
Hey all,

There is no chapter in the book about REST resource routing for plugins in
cake1.3. Example with mapResources will not work.
Here is the solution that I am using:

Router::mapResources(array('rides'), array('prefix' => '/:plugin/'));
Router::parseExtensions();

Do you know any better?
I hope this helps someone. Add it to the book if you can, coz I can't login.

Cheers,
Yarik

-- 
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: how to create search function.

2012-06-06 Thread Nilson Pena
Chetan,

This is a awesome cake blog, congratulations.

Nilson



On Wed, Jun 6, 2012 at 4:08 AM, Chetan Patel wrote:

> Hello Madhuri,
>
> Please check My blog:
>
>
> http://chetan4cake.blogspot.in/2012/06/search-plugin-demo-in-cakephp-20.html
>
> Thanks
> Chetan
>
>  --
> 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


How to post with xml file?

2012-06-06 Thread 88
Hi,

I want to post xml file to another site,I don't know that.
I try to make a sample, But that's a "post request".

Anyone that can give me an example on how to make coding?

:Sample
$root = '';
$xml = new SimpleXMLElement($root);
$xml->addChild('id', $this->request->data['id']);
$xml->addChild('name', $this->request->data['name']);

App::uses('HttpSocket', 'Network/Http');
$HttpSocket = new HttpSocket();
$results = $HttpSocket->post('https://example.com/api/', array($xml-
>asXML()));

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


How to post with xml file?

2012-06-06 Thread 88
Hi,

I want to post xml file to another site,I don't know that.
I try to make a sample, But that's a "post request".

Anyone that can give me an example on how to make coding?

:Sample
$root = '';
$xml = new SimpleXMLElement($root);
$xml->addChild('id', $this->request->data['id']);
$xml->addChild('name', $this->request->data['name']);

App::uses('HttpSocket', 'Network/Http');
$HttpSocket = new HttpSocket();
$results = $HttpSocket->post('https://example.com/api/', array($xml-
>asXML()));

Thanks
88

-- 
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: how to create search function.

2012-06-06 Thread Chetan Patel
Hello Madhuri,

Please check My blog:

http://chetan4cake.blogspot.in/2012/06/search-plugin-demo-in-cakephp-20.html

Thanks
Chetan

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