====== CakePhp ======
Si vous pouvez utiliser un autre framework, préférez [[/informatique/php/laravel|Laravel]]. Sinon, ben c'est la vie :-)
* http://cakePhp.org
* [[wpfr>CakePHP]]
* La doc: https://book.cakephp.org
Liste de plugins
* Annuaire [[https://plugins.cakephp.org/|CakePHP Plugins]]
* https://github.com/FriendsOfCake/awesome-cakephp
* [[https://www.cakedc.com/amanda/2020/10/19/best-cakephp-plugins|Best CakePHP Plugins]] by Amanda on October 19, 2020
===== Tips =====
==== User info ====
Récupérer l'utilisateur connecté hors d'un controller ou view
$r = Router::getRequest();
if( $r )
{
$i = /*$this->getRequest()*/ $r->getAttribute( 'identity' );
if( $i )
{
Log::debug(__METHOD__.' is logged');
$user = $i->getOriginalData();
}
else
{
Log::debug(__METHOD__.' not logged');
}
}
else
{
Log::debug(__METHOD__.' no request');
}
==== PhpUnit Migrations ====
Ajouter un tableau vide pour les migrations de l'application:
$migrator->runMany([
[],
['plugin' => $plug->getName()]
]);
[[https://github.com/CakeDC/users/issues/984|souvenir]]
==== datatables ====
* [[https://www.tutspointer.com/datatables-with-ajax-pagination-search-filter-in-cakephp-3-using-bootstrap-3-mysql-and-jquery/|Datatables with Ajax Pagination, Search Filter in CakePHP 3 Using Bootstrap 3, MySQL and jQuery]]
==== hierarchical data, tree structure ====
* [[https://book.cakephp.org/4/en/orm/behaviors/tree.html|CakePhp TreeBehavior]] CakePhp4
* [[https://www.dereuromark.de/2013/02/17/cakephp-and-tree-structures/|CakePHP and Tree structures]] 2013
* and his [[https://github.com/dereuromark/cakephp-tools/blob/master/docs/Helper/Tree.md|Tree Helper]]
* [[https://stackoverflow.com/questions/44347448/cakephp-3-tree-behavior-on-associated-model|cakephp 3 tree behavior on associated model]] 2017