CakePHP 3 Plugin not working (controller file not found)

2015-02-08 Thread HVan
I followed all the instrucitons, even tried baking a plugin. But each time 
I reference the plugin (eg. http://localhost/contact_manager/contacts) it 
says Controller not found. All the files have been created and placed in 
the proper location. It will say file not found in 
/plugins/ContactManager/src/Controller/ContactsController.php and I've 
tripled checked, of course, that the file exists. I also created the Table 
file - nada.

It's loading the plugin properly because when I remove, say bootstrap.php 
inside the plugin, it will say the bootstrap file is not found inside the 
plugin.

Any ideas?

-- 
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: Action a postLink without refreshing page (AJAX?)

2015-02-08 Thread euromark
Maybe this helps?
http://stackoverflow.com/questions/9750326/intercept-cake2-postlink-form-posts-with-jquery


Am Samstag, 7. Februar 2015 17:34:38 UTC+1 schrieb MarkB:

 Hi,

 My first Cake project (and first major non-intranet web project!) is a 
 fairly complex event management system for a month-long city-wide science 
 festival my employer runs, involving about 120 events.

 I have added the ability to add (and remove) events to a wishlist from a 
 *postLink*, which works well on the event view page, but is annoying for 
 users when clicking the 'Add to wishlist' link in the events listings page, 
 as the page refreshes and they may have to scroll down to continue browsing 
 where they left off.

 I've been messing about with PHP for years, but have little Javascript 
 experience and nothing AJAX-based. Time is getting tight, so I'm wondering 
 if there is anyone who can help me achieve this? Thanks!

 This is the code I use in my view:

  if ($wishlisted == NULL){
  echo $this-Form-postLink('Add to wishlist', array('action' = 'wishadd'
 , $event['Event']['id']));
  } else {
  echo On your wishlist  . $this-Form-postLink('Remove', array('action' 
 = 'wishlistremove', $wishlisted));
  }




 This is my Controller code:

 public function wishadd($id) {
  if ($this-request-is('get')) {
 throw new MethodNotAllowedException();
 }
  $user_id = $this-Auth-user('id');
  if ($user_id == NULL) {
 $this-Session-setFlash('You must be logged in to add an event to a 
 wishlist!');
 return $this-redirect(array('action' = 'view',$id));
 }
  $currentYear = $this-getSettings('year');
 $event = $this-Event-findById($id); 
  $conditions = array('Wishlist.year' = $currentYear,'Wishlist.event_id' 
 = $id,'Wishlist.user_id' = $this-Auth-user('id'));
 $wishlisted = $this-Event-Wishlist-find('count',array('conditions' = 
 $conditions));
  if ($wishlisted  0) {
 $this-Session-setFlash('This event is already on your wishlist.');
 return $this-redirect($this-referer());
 }
  if ($this-request-is('post')) {
  $this-Event-Wishlist-create();
 $wishlist_id = $this-Event-Wishlist-getInsertID();
 $this-Event-Wishlist-saveField('year', $currentYear);
 $this-Event-Wishlist-saveField('event_id', $id);
 $this-Event-Wishlist-saveField('proposal_id', 
 $event['Event']['proposal_id']);
 $this-Event-Wishlist-saveField('user_id', $user_id);
  $this-Session-setFlash('This event has been added to your wishlist.');
 return $this-redirect($this-referer());
 } else {
 $this-Session-setFlash('Unable to add to your wishlist. Please try 
 again.');
 return $this-redirect($this-referer());
  }
 }








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


Correct model associations

2015-02-08 Thread gt0p
I am trying to bind 3 tables and I am having problems with proper 
relations. 
Table users (pk id), books (pk id), users_books (user_id, book_id), 
comments (pk and foreign key book_id, user_id - with reference to 
users_books)

Here are the models:

Book

  public $hasAndBelongsToMany = array(
  'User' =
  array(
'className' = 'User',
  'joinTable' = 'users_books',
'foreignKey' = 'book_id',
'associationForeignKey' = 'user_id',
'unique' = true,
'conditions' = '',
'fields' = '',
'order' = '',
'limit' = '',
'offset' = '',
'finderQuery' = '',
  //  'with' = 'UserBook'
),);

public $hasMany = array('Comment'=array('className'='Comment'));

Comment:

  public $belongsTo = array (
'Book' = array (
'className'='Book',

)
  );


When I try to save with the saveAll method I got: 

*Error: * SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add 
or update a child row: a foreign key constraint fails 
(`metabook`.`comments`, CONSTRAINT `comments_ibfk_1` FOREIGN KEY 
(`user_id`, `book_id`) REFERENCES `users_books` (`user_id`, `book_id`))  

I know that this is not according to the cakephp conventions, but what I 
can do to bind those tables?

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


empty controller/component directory

2015-02-08 Thread vampke
Hi,

I just started with this excellent tool and I am trying to use the login 
script as described by the example on the site 
(http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html).
The blog script is up and running, no problems there. 
When I try to create a new user I receive the message *Error: * Class 
'BlowfishPasswordHasher' not found
There do not seem to be any relevant posts about this issue. I have found 
that my complete app/controller/component directory is empty. Is this 
normal? 
I have downloaded the script from the official website and again from 
github. Both times the directory was empty. 
Am I supposed to install this add-on? Where can I download it?

v.

-- 
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 the rule validation function run twice

2015-02-08 Thread Celia Kessassi
whene i use this code it's repeat the function isExif_imagetype
'ProfileImage' = array(
   'rule'   = 'isExif_imagetype', // ou bien : 
array('nomRegle', 'parametre1', 'parametre2' ...)
 'message'= 'Votre message d\'erreur'
   ),
, but whene i add 'on' = 'create', 
 it's does't repeat.
and for example whene i debug i got twice message. how to make it's run 
without repeating ??

-- 
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: CakePHP 3.0 howto disable DebugKit on some actions

2015-02-08 Thread mark_story
You would have to conditionally not include the dispatch filter based on 
the request URI. Attempting to do that in the controller will be far too 
late, but you could not load the plugin based on the specific URLs you want 
to disable the toolbar for.

-Mark

On Monday, 2 February 2015 18:46:39 UTC-5, Andras Kende wrote:

 Hello, 

 I would like to disable DebugKit Toolbar on some area on my test website 
 using CakePHP 3.0 

 config/app.php 
 $config = [ 
 ‘debug’ = true 
 , 

 Tried adding to to AppController as: 

 use Cake\Core\Configure; 
 … 

 public function beforeFilter(Event $event) { 
 Configure::write(‘debug’, false); 
 } 


 Thanks for any help, 

 Andras

-- 
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.0-RC2 Released

2015-02-08 Thread mark_story
The CakePHP core team is excited to announce the release of CakePHP 
3.0.0-RC2. Our plan is that this will be the final 3.0.0 release candidate 
and in ~6 weeks time 3.0.0 stable will be released. Since 3.0.0-RC1, we've 
been hard at work incorporating community feedback, fixing many issues and 
improving the documentation.

# Upgrading From an Earlier 3.0.0 release

When upgrading from an earlier 3.0.0 release there are a few important 
changes you'll need to make.

## Plugin Installation

The use and role of the CakePHP Plugin installer has changed and requires 
the following updates to your app's composer.json file:

```
require: {
cakephp/plugin-installer: *,
cakephp/bake: dev-master
},
scripts: {
post-autoload-dump: 
Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump
}
```

These additions will ensure that your plugins continue to install 
correctly. Plugins installed with composer will now be installed under 
`/vendor`. This change was done to make the separation between external and 
in-app plugins clearer. Having both in the same directory was confusing for 
a number of users.

## String renamed to Text

In preparation for PHP7 and HHVM, the String class was renamed to 
`Cake\Utility\Text`. The old class name continues to work but will be 
removed in a future 3.x release.

## Configuration File Changes

Configuration files loaded through `Configure::load()` previously required 
the extension. The extension being present made switching configuration 
file formats hard. For RC2, you must remove the extensions. So 
`Configure::read('app.php')` is now `Configure::read('app')`.
PHP based configuration files should now return their data instead of 
setting the `$config` variable. The `$config` variable is now deprecated 
and will be removed in a future 3.x release.

## ORM Callback Consistency

The various ORM callbacks had somewhat inconsistent types used for the 
`$options` parameter. All callbacks will now receive an `ArrayObject` for 
the `$options` parameter. Query::formatResults() no longer gets the query 
as an argument either. If you need access to the query from a result 
formatter, use a closure.

## EventManager::detach() and EventManager::attach() are deprecated

These methods have been replaced with `on()` and `off()`. These new methods 
use an interface much like jQuery's methods. `attach()` and `detach()` are 
now deprecated and will be removed in a future 3.x release.
We'd like to welcome Jad Bitar (jadb), Walther Lalk (dakota) and Anthony 
Grassiot (antograssiot) to the core team. Each of them has helped make 
3.0.0 what it is today.

For more details on all the changes in 3.0.0, you should consult the 
[migration 
guide](http://book.cakephp.org/3.0/en/appendices/3-0-migration-guide.html). 
In closing, we'd like to thank all of the people that have helped so far 
with the 3.0 release.
Download a [packaged 
release](https://github.com/cakephp/cakephp/releases/3.0.0-RC2).

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