Re: Cake 3.0 - Convenient way to retrieve if the current Table/Behavior is part of a plugin or not

2015-01-30 Thread José Lorenzo
Check the namespace of the class:

list($namespace, $class) = namespaceSplit(get_class($table));

if ($namespace !== 'App\Model\Table')  // Probably a plugin :)

On Friday, January 30, 2015 at 4:10:31 PM UTC+1, Ernesto wrote:
>
> Hi all
>
> is there a convenient way to retrieve if the current Table/Behavior is 
> part of a plugin or not?
>
> in Controllers and Helpers i can inspect the request object and get it 
> done.
>

-- 
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: How do I update cakephp existing app?

2015-01-30 Thread frocco
Thank you

On Wednesday, January 28, 2015 at 11:22:26 AM UTC-5, frocco wrote:
>
> Hello,
>
> I see cakephp 3 has been updated, how do I update my current app that is 
> using an older version of cakephp 3?
>
> Thanks
>

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

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


Cake 3.0 - Convenient way to retrieve if the current Table/Behavior is part of a plugin or not

2015-01-30 Thread Ernesto
Hi all

is there a convenient way to retrieve if the current Table/Behavior is part 
of a plugin or not?

in Controllers and Helpers i can inspect the request object and get it done.

-- 
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: Two tables in the same page

2015-01-30 Thread Ed Bizarro
In your controller declare

public $uses = array('Post', 'Comment') ;
Em 29/01/2015 23:08, "Andras Kende"  escreveu:

> Try to change like:
>
> CREATE TABLE comments (
> id INT UNSIGNED AUTO_INCREMENT,
>
> post_id INT UNSIGNED,
>
>
> *PostsController.php*
>  class PostsController extends AppController {
> public $helpers = array('Html', 'Form');
>
> public function index() {
> $this->set('posts', $this->Post->find('all'));
> $this->set(‘comments’, $this->Post-Comment->find('all'));
> }
> }
>
> *Post.php*
>  class Post extends AppModel {
>
> public $hasMany = array(
> 'Comment' => array(
> 'className' => 'Comment',
> 'foreignKey' => 'post_id',
> 'dependent' => true
> )
> );
>
> }
>
> *Comment.php*
>  class Comment extends AppModel {
> public $belongsTo = array(
> 'Post’
> );
> }
>
>
>
> Andras Kende
>
> On Jan 29, 2015, at 9:45 AM, logintech123  wrote:
>
> Hello
>
> I am trying to understand Cakephp but i am missing something. I want to
> display two tables. I tried many different things but i ALWAYS end up on
> the same message "Call to a member function find() on a non-object"
>
> CREATE TABLE posts (
> id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
> title VARCHAR(50),
> body TEXT,
> created DATETIME DEFAULT NULL,
> modified DATETIME DEFAULT NULL
> );
>
> CREATE TABLE comments (
> post_id INT UNSIGNED AUTO_INCREMENT,
> name VARCHAR(50),
> comment TEXT,
> created DATETIME DEFAULT NULL,
> FOREIGN KEY (post_id) REFERENCES posts(id)
> );
>
> *PostsController.php*
>  class PostsController extends AppController {
> public $helpers = array('Html', 'Form');
>
> public function index() {
> $this->set('posts', $this->Post->find('all'));
> $this->set('comments', $this->Comment->find('all'));
> }
> }
> ?>
>
> *Posts.php*
>  class Posts extends AppModel {
> }
> ?>
>
> *Comments.php*
>  class Comments extends AppModel {
> public $hasMany = array(
> 'Comments' => array(
> 'className' => 'Comment',
> 'foreignKey' => 'post_id',
> 'dependent' => true
> )
> );
> }
> ?>
>
> The problems seems to be in the *PostController* file but i don't know
> what is the problem.
>
> --
> 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.
>

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


cant get autocomplete function to find helper class

2015-01-30 Thread ajt


In CakePHP, I am trying to create a autocomplete function from a textbox, 
using this tutorial: 
http://bakery.cakephp.org/articles/matt_1/2011/08/07/yet_another_jquery_autocomplete_helper_2

I keep getting a Error: AutoCompleteHelper could not be found. Undefined 
index: autoCompleteText

I am unsure how to fix this as I have tried relocating the files and still 
the same error.

I create the below files and copy the code from the tutorial, create the 
auto_complete.php in the view/helpers directory, and create 
webroot/js/views/helpers/auto_complete.js.

controller - Tests function auto_complete

class TestsController extends AppController {

public $helpers = array('Html', 'Form', 'Session','Js','AutoComplete');

 public function auto_complete() {
 $this->loadModel('Tutor');
 debug( $this->params);


$terms = $this->Tutor->find('all', array(
'conditions' => array(
'Tutor.first_name LIKE' => 
$this->params['url']['autoCompleteText'].'%'
),
'fields' => array('Tutor.first_name'),
'limit' => 3,
'recursive'=>-1,
));
$terms = Set::Extract($terms,'{n}.Tutor.first_name');
$this->set('terms', $terms);
$this->layout = '';
} 

view
 auto_complete.ctp


AutoComplete->input(
'Ttuor.first_name',
array(
'autoCompleteUrl'=>$this->Html->url( 
array(
'controller'=>'tests',
'action'=>'auto_complete',
)
),
'autoCompleteRequestItem'=>'autoCompleteText',
)
);

  if(isset($terms)) {
echo $this->Js->object($terms);
  }

   echo $this->Form->create('');

echo $this->Form->input('type', array('label' => 'Choose' ));
   echo $this->Form->end('send'); 

 ?>




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