Re: CakePHP 3.0 - Confusion comes from

2015-03-27 Thread euromark
The latter is deprecated, this changed during RC and as such the tutorial 
needs some updating.
Thats all there is to it :)

Mark


Am Freitag, 27. März 2015 15:37:26 UTC+1 schrieb Bayezid Alam:
>
> Hi,
>
> A confusion comes on my mind regarding the adding something on CakePHP 3.0
>
> As example given on below link's in the add function.
>
> http://book.cakephp.org/3.0/en/tutorials-and-examples/blog/part-two.html#adding-articles
>
> public function add()
> {
> $article = $this->Articles->newEntity(); // *A blank newEnttity added 
> stored in $article variable*
> if ($this->request->is('post')) {
> $article = $this->Articles->patchEntity($article, 
> $this->request->data); // *A patchEntity added here & passed the request data 
> here*
> if ($this->Articles->save($article)) {
> $this->Flash->success(__('Your article has been saved.'));
> return $this->redirect(['action' => 'index']);
> }
> $this->Flash->error(__('Unable to add your article.'));
> }
> $this->set('article', $article);
> }
>
>
>
> But i found a different things on below link
>
> http://book.cakephp.org/3.0/en/tutorials-and-examples/blog-auth-example/auth.html#creating-all-user-related-code
>
> public function add()
> {
> $user = $this->Users->newEntity($this->request->data); // *request 
> data passing through newEntity here*
> if ($this->request->is('post')) {
> if ($this->Users->save($user)) {
> $this->Flash->success(__('The user has been saved.'));
> return $this->redirect(['action' => 'add']);
> }
> $this->
>
> ...

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

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


CakePHP 3.0 - Confusion comes from

2015-03-27 Thread Md Bayezid Alam
Hi,

A confusion comes on my mind regarding the adding something on CakePHP 3.0

As example given on below link's in the add function.
http://book.cakephp.org/3.0/en/tutorials-and-examples/blog/part-two.html#adding-articles

public function add()
{
$article = $this->Articles->newEntity(); // *A blank
newEnttity added stored in $article variable*
if ($this->request->is('post')) {
$article = $this->Articles->patchEntity($article,
$this->request->data); // *A patchEntity added here & passed the
request data here*
if ($this->Articles->save($article)) {
$this->Flash->success(__('Your article has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('Unable to add your article.'));
}
$this->set('article', $article);
}



But i found a different things on below link
http://book.cakephp.org/3.0/en/tutorials-and-examples/blog-auth-example/auth.html#creating-all-user-related-code

public function add()
{
$user = $this->Users->newEntity($this->request->data); //
*request data passing through newEntity here*
if ($this->request->is('post')) {
if ($this->Users->save($user)) {
$this->Flash->success(__('The user has been saved.'));
return $this->redirect(['action' => 'add']);
}
$this->Flash->error(__('Unable to add the user.'));
}
$this->set('user', $user);
}


Could you please help explaining the differences between?  Which approach
should we use if we can apply both?

*I knew we should use patchEntity while editing anything and newEntity for
adding, right?*

Thanks
Bayezid

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

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


Plugin adding to link url

2015-03-27 Thread Keith Mountifield
Hi All,

I'm definitely a noob and need a little help with a problem I'm having.

I'm using a plugin called ReportManager, which adds /report_manager/ to the 
URL prior to it's views.

The main layout of the site uses an Element for the global navigation with 
the links generated by the CakePHP HTMLHelper link method:; Here's my code 
for anexample:

Html->link(__(' List Customers'), 
array('controller' => 'customers', 'action' => 'index', 'full_base' => 
true), array('escape' => false)); ?>

The issue that I'm having is that, in 'norma pages within the site, this 
correctly generates a link to http://mysite.com/customers, but when in the 
repoort manager, the same code geneerates a link 
http://mysite.com/report_manager/customers.

Is there a way within CakePHP to force the linke to be relative to the base 
url irrespective of what the plugin (this or any other) addes to the URL 
without simply putting the '/customers' path into the link, which seems bad 
practice to me.

Thanks in advance.

Keith 

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

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


crossst

2015-03-27 Thread Praveen Mohan
can i crosspost stackoverflow questions here

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

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


Re: Cake3 - Blog Tutorial Part 3 error founds

2015-03-27 Thread Md Bayezid Alam
Ohh, Thanks, But there was not any info to create the table first.



On Fri, Mar 27, 2015 at 2:01 PM, José Lorenzo  wrote:

> You need to create the categories table first.
>
>
> On Friday, March 27, 2015 at 5:34:46 AM UTC+1, Bayezid Alam wrote:
>>
>> Hi,
>>
>> I am getting below error while executing "*bin/cake bake model
>> Categories*"
>>
>> Note: i followed all the above things from http://book.cakephp.org/
>> 3.0/en/tutorials-and-examples/blog/part-three.html
>>
>> ubuntu@ubuntu:/var/www/html/cake3blog$ bin/cake bake model Categories
>>
>> Welcome to CakePHP v3.0.0 Console
>> ---
>> App : src
>> Path: /var/www/html/cake3blog/src/
>> ---
>> One moment while associations are detected.
>> Exception: SQLSTATE[42S02]: Base table or view not found: 1146 Table
>> 'blog_cake3_db.categories' doesn't exist in [/var/www/html/cake3blog/
>> vendor/cakephp/cakephp/src/Database/Schema/Collection.php, line 130]
>> 2015-03-27 04:24:32 Error: [Cake\Database\Exception] SQLSTATE[42S02]:
>> Base table or view not found: 1146 Table 'blog_cake3_db.categories' doesn't
>> exist
>> Stack Trace:
>> #0 /var/www/html/cake3blog/vendor/cakephp/cakephp/src/
>> Database/Schema/Collection.php(96): 
>> Cake\Database\Schema\Collection->_reflect('Column',
>> 'categories', Array, Object(Cake\Database\Schema\Table))
>> #1 
>> /var/www/html/cake3blog/vendor/cakephp/cakephp/src/Database/Schema/CachedCollection.php(65):
>> Cake\Database\Schema\Collection->describe('categories', Array)
>> #2 /var/www/html/cake3blog/vendor/cakephp/cakephp/src/ORM/Table.php(422):
>> Cake\Database\Schema\CachedCollection->describe('categories')
>> #3 /var/www/html/cake3blog/vendor/cakephp/cakephp/src/ORM/Table.php(498):
>> Cake\ORM\Table->schema()
>> #4 
>> /var/www/html/cake3blog/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(192):
>> Cake\ORM\Table->primaryKey()
>> #5 
>> /var/www/html/cake3blog/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(109):
>> Bake\Shell\Task\ModelTask->getAssociations(Object(Cake\ORM\Table))
>> #6 
>> /var/www/html/cake3blog/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(95):
>> Bake\Shell\Task\ModelTask->bake('Categories')
>> #7 [internal function]: Bake\Shell\Task\ModelTask->main('Categories')
>> #8 /var/www/html/cake3blog/vendor/cakephp/cakephp/src/Console/Shell.php(387):
>> call_user_func_array(Array, Array)
>> #9 /var/www/html/cake3blog/vendor/cakephp/cakephp/src/Console/Shell.php(382):
>> Cake\Console\Shell->runCommand(Array, false)
>> #10 /var/www/html/cake3blog/vendor/cakephp/cakephp/src/
>> Console/ShellDispatcher.php(200): Cake\Console\Shell->runCommand(Array,
>> true)
>> #11 /var/www/html/cake3blog/vendor/cakephp/cakephp/src/
>> Console/ShellDispatcher.php(171): Cake\Console\ShellDispatcher->
>> _dispatch()
>> #12 /var/www/html/cake3blog/vendor/cakephp/cakephp/src/
>> Console/ShellDispatcher.php(122): Cake\Console\ShellDispatcher->
>> dispatch()
>> #13 /var/www/html/cake3blog/bin/cake.php(20):
>> Cake\Console\ShellDispatcher::run(Array)
>> #14 {main}
>>
>>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.
>

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

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


Re: Cake3 - Blog Tutorial Part 3 error founds

2015-03-27 Thread José Lorenzo
You need to create the categories table first.

On Friday, March 27, 2015 at 5:34:46 AM UTC+1, Bayezid Alam wrote:
>
> Hi,
>
> I am getting below error while executing "*bin/cake bake model Categories*
> "
>
> Note: i followed all the above things from 
> http://book.cakephp.org/3.0/en/tutorials-and-examples/blog/part-three.html
>
> ubuntu@ubuntu:/var/www/html/cake3blog$ bin/cake bake model Categories
>
> Welcome to CakePHP v3.0.0 Console
> ---
> App : src
> Path: /var/www/html/cake3blog/src/
> ---
> One moment while associations are detected.
> Exception: SQLSTATE[42S02]: Base table or view not found: 1146 Table 
> 'blog_cake3_db.categories' doesn't exist in 
> [/var/www/html/cake3blog/vendor/cakephp/cakephp/src/Database/Schema/Collection.php,
>  
> line 130]
> 2015-03-27 04:24:32 Error: [Cake\Database\Exception] SQLSTATE[42S02]: Base 
> table or view not found: 1146 Table 'blog_cake3_db.categories' doesn't exist
> Stack Trace:
> #0 
> /var/www/html/cake3blog/vendor/cakephp/cakephp/src/Database/Schema/Collection.php(96):
>  
> Cake\Database\Schema\Collection->_reflect('Column', 'categories', Array, 
> Object(Cake\Database\Schema\Table))
> #1 
> /var/www/html/cake3blog/vendor/cakephp/cakephp/src/Database/Schema/CachedCollection.php(65):
>  
> Cake\Database\Schema\Collection->describe('categories', Array)
> #2 /var/www/html/cake3blog/vendor/cakephp/cakephp/src/ORM/Table.php(422): 
> Cake\Database\Schema\CachedCollection->describe('categories')
> #3 /var/www/html/cake3blog/vendor/cakephp/cakephp/src/ORM/Table.php(498): 
> Cake\ORM\Table->schema()
> #4 
> /var/www/html/cake3blog/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(192):
>  
> Cake\ORM\Table->primaryKey()
> #5 
> /var/www/html/cake3blog/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(109):
>  
> Bake\Shell\Task\ModelTask->getAssociations(Object(Cake\ORM\Table))
> #6 
> /var/www/html/cake3blog/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(95): 
> Bake\Shell\Task\ModelTask->bake('Categories')
> #7 [internal function]: Bake\Shell\Task\ModelTask->main('Categories')
> #8 
> /var/www/html/cake3blog/vendor/cakephp/cakephp/src/Console/Shell.php(387): 
> call_user_func_array(Array, Array)
> #9 
> /var/www/html/cake3blog/vendor/cakephp/cakephp/src/Console/Shell.php(382): 
> Cake\Console\Shell->runCommand(Array, false)
> #10 
> /var/www/html/cake3blog/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(200):
>  
> Cake\Console\Shell->runCommand(Array, true)
> #11 
> /var/www/html/cake3blog/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(171):
>  
> Cake\Console\ShellDispatcher->_dispatch()
> #12 
> /var/www/html/cake3blog/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(122):
>  
> Cake\Console\ShellDispatcher->dispatch()
> #13 /var/www/html/cake3blog/bin/cake.php(20): 
> Cake\Console\ShellDispatcher::run(Array)
> #14 {main}
>
>

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

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