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-14 Thread Bruno Dias
Hi stork! Thanks for your feedback. I'll take a look!

On Jun 6, 6:01 pm, stork  wrote:
> One more thing about migrations - yes, CakePHP does have builtin shell for
> database schema 
> dump/restorehttp://book.cakephp.org/2.0/en/console-and-shells/schema-management-a...
> 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-14 Thread Bruno Dias
Thank you Randy! Surely I'll take a look on these suggestions.

On Jun 6, 3:46 pm, randy  wrote:
> 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 comme

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