<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Writing a custom CakePHP console script</title>
	<atom:link href="http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/feed/" rel="self" type="application/rss+xml" />
	<link>http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/</link>
	<description>baking cakes with CakePHP</description>
	<lastBuildDate>Tue, 31 Jan 2012 15:12:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: redthor</title>
		<link>http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/comment-page-1/#comment-219097</link>
		<dc:creator>redthor</dc:creator>
		<pubDate>Thu, 01 Sep 2011 00:21:36 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/#comment-219097</guid>
		<description>That comment from Gonzalo and your reply just saved me from the 
PHP Fatal error: Class Controller not found error.

thanks!</description>
		<content:encoded><![CDATA[<p>That comment from Gonzalo and your reply just saved me from the<br />
PHP Fatal error: Class Controller not found error.</p>
<p>thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/comment-page-1/#comment-156455</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Sun, 11 Apr 2010 14:01:50 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/#comment-156455</guid>
		<description>@Frederick: Good to hear you could make it work :)</description>
		<content:encoded><![CDATA[<p>@Frederick: Good to hear you could make it work :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frederick D.</title>
		<link>http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/comment-page-1/#comment-156432</link>
		<dc:creator>Frederick D.</dc:creator>
		<pubDate>Sat, 10 Apr 2010 21:47:42 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/#comment-156432</guid>
		<description>Awesome! It worked!

Plus I went back and re-read the document about how to use SwiftMailer 4.x in CakePHP with shells. (http://bakery.cakephp.org/articles/view/updated-swiftmailer-4-xx-component-with-attachments-and-plugins)

I had been reading multiple documents about SwiftMailer and shells and for some reason put the shell and task in /public_html/vendors. The article referenced above clearly said put it in /app/vendors/shells. Doing that, plus using the hints you gave me above, and the shell task works from SSH as well as in cron. The command I ended up with looks like this:

php /home/USER NAME/public_html/cake/console/cake.php -app /home/USER NAME/public_html/app reminders lof

Thank you VERY much for your help!</description>
		<content:encoded><![CDATA[<p>Awesome! It worked!</p>
<p>Plus I went back and re-read the document about how to use SwiftMailer 4.x in CakePHP with shells. (<a href="http://bakery.cakephp.org/articles/view/updated-swiftmailer-4-xx-component-with-attachments-and-plugins" rel="nofollow">http://bakery.cakephp.org/articles/view/updated-swiftmailer-4-xx-component-with-attachments-and-plugins</a>)</p>
<p>I had been reading multiple documents about SwiftMailer and shells and for some reason put the shell and task in /public_html/vendors. The article referenced above clearly said put it in /app/vendors/shells. Doing that, plus using the hints you gave me above, and the shell task works from SSH as well as in cron. The command I ended up with looks like this:</p>
<p>php /home/USER NAME/public_html/cake/console/cake.php -app /home/USER NAME/public_html/app reminders lof</p>
<p>Thank you VERY much for your help!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/comment-page-1/#comment-156419</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Sat, 10 Apr 2010 14:09:21 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/#comment-156419</guid>
		<description>@Frederick: You would use $myModel to access the model, though you could also use:
&lt;pre&gt;
&lt;code&gt;
$this-&gt;YourModel = ClassRegistry::init(&#039;YourModel&#039;);
&lt;/code&gt;
&lt;/pre&gt;
if you want to access the model in the usual way.</description>
		<content:encoded><![CDATA[<p>@Frederick: You would use $myModel to access the model, though you could also use:</p>
<pre>
<code>$this-&gt;YourModel = ClassRegistry::init('YourModel');</code>
</pre>
<p>if you want to access the model in the usual way.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frederick D.</title>
		<link>http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/comment-page-1/#comment-156384</link>
		<dc:creator>Frederick D.</dc:creator>
		<pubDate>Fri, 09 Apr 2010 16:10:02 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/#comment-156384</guid>
		<description>Thanks very much for your response. I will try that. I&#039;ve never used those statements before. This all works swell on DreamHost, but not on HostGator. The web site itself works fine for the database connection. I&#039;m having a problem with the cron job.

With the App::import of the model, and the ClassRegistry, do I still reference the model in the same way or do I use the $myModel?

I appreciate your help.</description>
		<content:encoded><![CDATA[<p>Thanks very much for your response. I will try that. I&#8217;ve never used those statements before. This all works swell on DreamHost, but not on HostGator. The web site itself works fine for the database connection. I&#8217;m having a problem with the cron job.</p>
<p>With the App::import of the model, and the ClassRegistry, do I still reference the model in the same way or do I use the $myModel?</p>
<p>I appreciate your help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/comment-page-1/#comment-156382</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Fri, 09 Apr 2010 15:08:12 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/#comment-156382</guid>
		<description>@Frederick: I don&#039;t think the error will disappear if you replace $uses with an App::import() statement, it will probably lead to the same error. But if you want, you can try the following:
&lt;code&gt;
App::import(&#039;Model&#039;, &#039;YourModel&#039;);
$myModel = ClassRegistry::init(&#039;YourModel&#039;);
&lt;/code&gt;
I guess the problem is, as the error message suggests, related to the database connection. So I would first check whether the settings in database.php are correct. Also make sure the mysql extension is enabled in the php.ini for the cli environment (some systems use one php.ini for Apache, and another php.ini for the cli). 

Hope that helps!</description>
		<content:encoded><![CDATA[<p>@Frederick: I don&#8217;t think the error will disappear if you replace $uses with an App::import() statement, it will probably lead to the same error. But if you want, you can try the following:<br />
<pre><code>App::import('Model', 'YourModel');
$myModel = ClassRegistry::init('YourModel');</code></pre><br />
I guess the problem is, as the error message suggests, related to the database connection. So I would first check whether the settings in database.php are correct. Also make sure the mysql extension is enabled in the php.ini for the cli environment (some systems use one php.ini for Apache, and another php.ini for the cli). </p>
<p>Hope that helps!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frederick D.</title>
		<link>http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/comment-page-1/#comment-156377</link>
		<dc:creator>Frederick D.</dc:creator>
		<pubDate>Fri, 09 Apr 2010 13:15:33 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/#comment-156377</guid>
		<description>I am having a similar problem as Gonzalo, only with the message &quot;Error: Missing Database Connection&quot;. I have posted information about the issue here: http://groups.google.com/group/cake-php/browse_thread/thread/e54fa739b47cc61f#

Your posts are impressive with the breadth of your knowledge of CakePHP. Would you please take a look at my posting above? Should I replace the $uses with an  App::import statement? If so, what would that statement look like?

I found this in the cook book at http://book.cakephp.org/view/531/Importing-Controllers-Models-Components-Behaviors-

constructClasses();
?&gt;

Is this what I need to do in my shell? Thanks in advance for taking a look.</description>
		<content:encoded><![CDATA[<p>I am having a similar problem as Gonzalo, only with the message &#8220;Error: Missing Database Connection&#8221;. I have posted information about the issue here: <a href="http://groups.google.com/group/cake-php/browse_thread/thread/e54fa739b47cc61f#" rel="nofollow">http://groups.google.com/group/cake-php/browse_thread/thread/e54fa739b47cc61f#</a></p>
<p>Your posts are impressive with the breadth of your knowledge of CakePHP. Would you please take a look at my posting above? Should I replace the $uses with an  App::import statement? If so, what would that statement look like?</p>
<p>I found this in the cook book at <a href="http://book.cakephp.org/view/531/Importing-Controllers-Models-Components-Behaviors-" rel="nofollow">http://book.cakephp.org/view/531/Importing-Controllers-Models-Components-Behaviors-</a></p>
<p>constructClasses();<br />
?&gt;</p>
<p>Is this what I need to do in my shell? Thanks in advance for taking a look.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gonzalo</title>
		<link>http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/comment-page-1/#comment-152767</link>
		<dc:creator>Gonzalo</dc:creator>
		<pubDate>Tue, 16 Mar 2010 15:25:43 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/#comment-152767</guid>
		<description>It works! thanks  :)</description>
		<content:encoded><![CDATA[<p>It works! thanks  :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/comment-page-1/#comment-152766</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Tue, 16 Mar 2010 15:20:04 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/#comment-152766</guid>
		<description>@Gonzalo: To avoid this error you also have to import the controller class with:
&lt;pre&gt;
&lt;code&gt;
App::import(&#039;Core&#039;, &#039;Controller&#039;);
&lt;/code&gt;
&lt;/pre&gt;
Hope this helps!</description>
		<content:encoded><![CDATA[<p>@Gonzalo: To avoid this error you also have to import the controller class with:</p>
<pre>
<code>App::import('Core', 'Controller');</code>
</pre>
<p>Hope this helps!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gonzalo</title>
		<link>http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/comment-page-1/#comment-152708</link>
		<dc:creator>Gonzalo</dc:creator>
		<pubDate>Mon, 15 Mar 2010 20:27:55 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/05/07/writing-a-custom-cakephp-console-script/#comment-152708</guid>
		<description>I tried too to do:

&lt;code&gt;$player = $this-&gt;requestAction(&#039;/players/getProfile/6&#039;);&lt;/code&gt;

But I only get:
Error: Missing Controller &#039;Players&#039;

and my controller´s code is printed in the console</description>
		<content:encoded><![CDATA[<p>I tried too to do:</p>
<p><code>$player = $this-&gt;requestAction('/players/getProfile/6');</code></p>
<p>But I only get:<br />
Error: Missing Controller &#8216;Players&#8217;</p>
<p>and my controller´s code is printed in the console</p>
]]></content:encoded>
	</item>
</channel>
</rss>

