cakemanager / cakephp-utils Goto Github PK
View Code? Open in Web Editor NEWDon't load that much plugins, just one plugin with all utilities you need!
License: MIT License
Don't load that much plugins, just one plugin with all utilities you need!
License: MIT License
Hello,
in my controllers I've set
public function isAuthorized($user) {
$this->Authorizer->action([' MY METHODS'], function ($auth, $controller) use ($user) {
$auth->allowRole([1,2,3,4]);
});
return $this->Authorizer->authorize();
}
but I must include this in AppController or any method is redirecting to the login:
$this->Auth->allow(['index', 'view', 'display', .... 'customMethod']);
What I'm missing?
Any model that has a parent-child relationship to itself, like Roles & Sub-roles, Nested Categories etc. throws PDOException (most likely in afterFind callback) when retrieving data.
Error message, in case of Categories:
**Error: SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: 'CreatedBy'
If you are using SQL keywords as table column names, you can enable identifier quoting for your database connection in config/app.php.**
SQL Query:
SELECT CreatedBy.id AS `CreatedBy__id`, CreatedBy.username AS `CreatedBy__username`, ModifiedBy.id AS `ModifiedBy__id`, ModifiedBy.username AS `ModifiedBy__username` FROM users CreatedBy LEFT JOIN users CreatedBy ON CreatedBy.id = (CreatedBy.created_by) LEFT JOIN users ModifiedBy ON ModifiedBy.id = (CreatedBy.modified_by) WHERE CreatedBy.id in (:c0)
Structure of my Categories table is:
CREATE TABLE `categories` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`parent_id` int(11) DEFAULT NULL,
`lft` int(10) DEFAULT NULL,
`rght` int(10) DEFAULT NULL,
`module` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'question',
`name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`slug` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`description` text COLLATE utf8mb4_unicode_ci,
`active` tinyint(1) unsigned NOT NULL DEFAULT '0',
`created_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created` datetime DEFAULT NULL,
`modified_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`modified` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
The error goes away if I set the created_by and modified_by fields to NULL. But as long as they have any values present, the PDOException is thrown.
Works fine with other flat models.
How to fix this?
Thank you...
Cake 3.6 generates multiple deprecation notices. Most of them are easy to fix as they just need to add a set or get. But one of them could not be fixed by me.
Maybe you have a fix, idea or hint:
Deprecated (16384): Using Type::_basicTypeCast() is deprecated. The 'Utils.File' type needs to be updated to implement
TypeInterface
. - /htdocs/my_project/vendor/cakephp/cakephp/src/Database/Type.php, line: 273
You can disable deprecation warnings by settingError.errorLevel
toE_ALL & ~E_USER_DEPRECATED
in your config/app.php. [CORE/src/Core/functions.php, line 310]
Is there any chance to get a update for the whole cacephp-utils package? It's an awesome collection but not fully compatible with cake 3.6.
Best regards
Hi, im getting an error while tryng to add the behavior to my table, there is my code:
$this->addBehavior('Utils.Uploadable', [ 'photo', ]);
The error is: Missing behavior.
Thanks in advance.
With the 'selected' option you are able to make some menu-items selected where you call them.
This can be useful when you are on an 'edit' page of bookmarks while the 'index' page of bookmarks is listed in your menu.
Hello,
When I update a table field in ajax, the plugin automatically reset my avatar is null fields.
in profilTable
$ this-> addBehavior ('Utils.Uploadable' [
'avatar' => [
'field' => 'user_id'
'removeFileOnUpdate' => false,
'removeFileOnDelete' => true,
'path' => '{DS} upload avatar {DS}',
'fileName' => '{field}. {extension}'
]
]);
in the ajax method
$ profile = $ this-> Profil-> get ($ id, ['fields' => ['user_id' $ key [0]]]);
$ this-> Profil-> patchEntity ($ profile, $ this-> request-> data);
in logs
SELECT
Profil.user_id AS Profil__user_id
, Profil.villeProfil__ville
AS FROM WHERE Profile Profile Profil.user_id = 34 LIMIT 1
UPDATE SET profile
modified = '2015-09-11 12:51:15'
city = 'Cannes la Bocca' avatar = NULL <---?
WHERE user_id = 34
Hi,
I trying to add multiple files with different fields, and it's not possible or I don't know how to do.
$this->addBehavior('Utils.Uploadable', [
'audio' => [
'removeFileOnUpdate' => false,
'path' => '{ROOT}{DS}{WEBROOT}{DS}uploads{DS}{model}{DS}audio{DS}'
],
'video' => [
'removeFileOnUpdate' => false,
'path' => '{ROOT}{DS}{WEBROOT}{DS}uploads{DS}{model}{DS}video{DS}',
]
]);
I think that problem, is because after save first file on line 149, beforeSave is calling again and data for second file it's lost.
Thanks and regards.
Hello , we use $this->Search->filterForm($searchFilters)
for the filters in the search.
How to insert a "reset button " in the form ?
thank you
Hello sir,
I am using the you awesome plugins but from some days i didn't find you documentation in you domain http://cakemanager.org/docs/utils/1.0/ may be domain validity is expired
will you please share you document link
Hello - I cannot find anything in the documentation about this.
Say I have a record that holds one or more images, the user uploads an image, so now it is saved.
The user then edits the record and wants to remove the image, not replace with another - just remove it.
How is this called? Can say an input checkbox be set, which triggers this on save?
When searching on 0
(like /products?state=0
), the condition isn't passed to the query because it's nothing.
It should literally take 0
as value!
Will be fixed as soon as possible.
Hey guys, what about saving the filename in md5 format?
Not sure if something changed between the version this was written for and 3.3.3.
Upon inspecting the plugin, I see it is dependent on a configuration option named GlobalAuth that stores the $this->Auth->user()
's content.
If I include the following statement in my AppController.php
's beforeFilter()
, I can still get it work.
if( $this->Auth->user() ) {
Configure::write( 'GlobalAuth', $this->Auth->user() );
}
But if this piece of code is not manually introduced, the plugin fails to store the who-did-it data on it's own.
I am trying to use the uploadable behaviour, I have added the plugin to my bootstrap.php file. And defined the behaviour in my table file:
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
$this->addBehavior('Utils.Uploadable', [
'photo',
]);
I also modified my template:
<?= $this->Form->create($player, ['type' => 'file']); ?>
echo $this->Form->input('photo', array('label' => 'Foto', 'type'=>'file'));
However when I try to upload a file, nothing seems to happen. I have tried adding debug statements here and there, but it seems the behaviour is not used? How can I troubleshoot this?
We would like to validate the uploaded files for their file extension. E.g. it should only be possible to upload images (PNG, GIF, JPG, BMP). On the docs it says this is on your roadmap. Do you plan to release anything soon?
Thanks!
I cannot install this plugin for cakephp 3.1.7. I'm getting :
[ErrorException] Undefined variable: baseDir
The complete result is as follows :
[koffi:/opt/lampp/htdocs/project] master(+10165/-608) 2s 127 ± composer require cakemanager/cakephp-utils:dev-master
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Removing cakephp/bake (1.1.3)
- Installing cakephp/bake (1.1.4)
Loading from cache
Installation failed, reverting ./composer.json to its original content.
[ErrorException]
Undefined variable: baseDir
require [--dev] [--prefer-source] [--prefer-dist] [--no-plugins] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--] [<packages>]...
[koffi:/opt/lampp/htdocs/project] master(+10165/-608) 4m25s 1 ±
How to fix this ?
Hi - with Cake 3.6, there is a deprecation notice for accessing the config variable directly in the WhoDidIt behavior. It is advised to use setConfig / getConfig directly.
Notice: Deprecated (16384): Utils\Model\Behavior\WhoDidItBehavior::config() is deprecated. Use setConfig()/getConfig() instead. - htdocs\my_project\vendor\cakemanager\cakephp-utils\src\Model\Behavior\WhoDidItBehavior.php, line: 69
This affects code from line 69 through 81
Will any updates be released? I've modified the behavior directly to get rid of the error, but would be nice to see the updates in the master.
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.