Mostrando postagens com marcador Cake. Mostrar todas as postagens
Mostrando postagens com marcador Cake. Mostrar todas as postagens

sábado, 30 de janeiro de 2016

Strict (2048): Declaration of App\Controller\UsersController::beforeFilter() should be compatible with App\Controller\AppController::beforeFilter(Cake\Event\Event $event) [APP/Controller\UsersController.php, line 12]

Strict (2048): Declaration of App\Controller\UsersController::beforeFilter() should be compatible with App\Controller\AppController::beforeFilter(Cake\Event\Event $event) [APP/Controller\UsersController.php, line 12]
Warning (4096): Argument 1 passed to App\Controller\UsersController::beforeFilter() must be an instance of App\Controller\Event, instance of Cake\Event\Event given, called in C:\Users\daniel\blog\vendor\cakephp\cakephp\src\Event\EventManager.php on line 385 and defined [APP/Controller\UsersController.php, line 14]

Hi!

If you are just like me studying the tutorial

CakePHP Cookbook Documentation
Release 3.x
Cake Software Foundation
January 18, 2016

You should have been found this problem when you finished the blog example.

Solution


Change this

    public function beforeFilter(Event $event)
    {
        parent::beforeFilter($event);
        // Allow users to register and logout.
        // You should not add the "login" action to allow list. Doing so would
        // cause problems with normal functioning of AuthComponent.
        $this->Auth->allow(['add', 'logout']);
    }

For this

    public function beforeFilter(\Cake\Event\Event $event)
    {
        $this->Auth->allow(['add','logout']);
    }
 
Good luck!




segunda-feira, 25 de janeiro de 2016

Error: SQLSTATE[HY000]: General error: 1364 Field 'parent_id' doesn't have a default value

CakePHP Cookbook Documentation
Release 3.x
Cake Software Foundation

January 18, 2016

Page 88

These fields are automatically managed by the TreeBehavior when a category is saved.
Using your web browser, add some new categories using the /yoursite/categories/add controller

action.

Error: SQLSTATE[HY000]: General error: 1364 Field 'parent_id' doesn't have a default value

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:

INSERT INTO categories (lft, rght) VALUES (:c0, :c1)
If you want to customize this error message, create src\Template\Error\pdo_error.ct

SOLUTION

The parent_id was created as not null, make it nullable.

I did it using PHP Admin
I'm using vertrigo (the best wamp I ever found)




sábado, 23 de janeiro de 2016

Error: Class 'App\Model\Entity\DefaultPasswordHasher' not found


Hi!

use Cake\Auth\DefaultPasswordHasher; <--------------- Maybe you forgot to add this.

protected function _setPassword($value)
{
$hasher = new DefaultPasswordHasher();
return $hasher->hash($value);
}

Good Luck!

quinta-feira, 21 de janeiro de 2016

- cakephp/cakephp 3.1.7 requires ext-intl * -> the requested PHP extension intl is missing from your system.


Hi!

If you were trying to execute this

C:\Users\daniel>composer create-project --prefer-dist cakephp/app bookmarker

And received this message

 - cakephp/cakephp 3.1.7 requires ext-intl * -> the requested PHP extension intl is missing from your system.

Solution I found

uncomment this entry of your PHP.ini

;extension=php_intl.dll

After this, you're gonna a result similar to this bellow.


C:\Users\daniel>composer create-project --prefer-dist cakephp/app bookmarker
You are running composer with xdebug enabled. This has a major impact on runtime
 performance. See https://getcomposer.org/xdebug
Installing cakephp/app (3.1.2)
  - Installing cakephp/app (3.1.2)
    Loading from cache

Created project in bookmarker
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing aura/installer-default (1.0.0)
    Downloading: 100%

  - Installing cakephp/plugin-installer (0.0.12)
    Downloading: 100%

  - Installing psr/log (1.0.0)
    Downloading: 100%

  - Installing nesbot/carbon (1.13.0)
    Downloading: 100%

  - Installing mobiledetect/mobiledetectlib (2.8.19)
    Downloading: 100%

  - Installing aura/intl (1.1.1)
    Downloading: 100%

  - Installing ircmaxell/password-compat (v1.0.4)
    Downloading: 100%

  - Installing cakephp/cakephp (3.1.7)
    Downloading: 100%

  - Installing symfony/yaml (v3.0.1)
    Downloading: 100%

  - Installing symfony/filesystem (v3.0.1)
    Downloading: 100%

  - Installing symfony/config (v3.0.1)
    Downloading: 100%

  - Installing symfony/polyfill-mbstring (v1.0.1)
    Downloading: 100%

  - Installing symfony/console (v3.0.1)
    Downloading: 100%

  - Installing robmorgan/phinx (v0.5.1)
    Downloading: 100%

  - Installing cakephp/migrations (1.5.2)
    Downloading: 100%

  - Installing jakub-onderka/php-console-color (0.1)
    Downloading: 100%

  - Installing jakub-onderka/php-console-highlighter (v0.3.2)
    Downloading: 100%

  - Installing dnoegel/php-xdg-base-dir (0.1)
    Downloading: 100%

  - Installing nikic/php-parser (v2.0.0)
    Downloading: 100%

  - Installing symfony/var-dumper (v3.0.1)
    Downloading: 100%

  - Installing psy/psysh (v0.6.1)
    Downloading: 100%

  - Installing jdorn/sql-formatter (v1.2.17)
    Downloading: 100%

  - Installing cakephp/debug_kit (3.2.5)
    Downloading: 100%

  - Installing cakephp/bake (1.1.3)
    Downloading: 100%

symfony/console suggests installing symfony/event-dispatcher ()
symfony/console suggests installing symfony/process ()
symfony/var-dumper suggests installing ext-symfony_debug ()
psy/psysh suggests installing ext-pcntl (Enabling the PCNTL extension makes PsyS
H a lot happier :))
psy/psysh suggests installing ext-posix (If you have PCNTL, you'll want the POSI
X extension as well.)
psy/psysh suggests installing ext-readline (Enables support for arrow-key histor
y navigation, and showing and manipulating command history.)
psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to
 work.)
cakephp/debug_kit suggests installing ext-sqlite (DebugKit needs to store panel
data in a database. SQLite is simple and easy to use.)
Writing lock file
Generating autoload files
> Cake\Composer\Installer\PluginInstaller::postAutoloadDump
> App\Console\Installer::postInstall
Created `config/app.php` file
Set Folder Permissions ? (Default to Y) [Y,n]? Y
Updated Security.salt value in config/app.php

C:\Users\daniel>