Skip to content

Instantly share code, notes, and snippets.

@aavrug
Created May 21, 2015 10:55
Show Gist options
  • Save aavrug/7c69f75eb4be13a69a79 to your computer and use it in GitHub Desktop.
Save aavrug/7c69f75eb4be13a69a79 to your computer and use it in GitHub Desktop.
<!-- File: src/Template/Users/add.ctp -->
<h1>Add a new User</h1>
<?php
echo $this->Form->create($user, ['type' => 'file']);
echo $this->Form->input('username');
echo $this->Form->input('password');
echo $this->Form->input('date_of_birth', [
'label' => 'Date of birth',
'minYear' => date('Y') - 70,
'maxYear' => date('Y') - 18,
]);
echo $this->Form->input('first_name');
echo $this->Form->input('last_name');
echo $this->Form->input('email');
echo $this->Form->input('url');
echo $this->Form->file('profile_image');
echo $this->Form->button(__('Register'));
echo $this->Form->end();
?>
/// Requested Data
/src/Controller/UsersController.php (line 55)
[
'username' => 'sdfsd',
'password' => 'ertert',
'date_of_birth' => [
'year' => '1997',
'month' => '05',
'day' => '21'
],
'first_name' => '',
'last_name' => '',
'email' => 'aavrug@gmail.com',
'url' => '',
'profile_image' => [
'name' => 'banner-background.png',
'type' => 'image/png',
'tmp_name' => '/tmp/phpeYf0wG',
'error' => (int) 0,
'size' => (int) 202
]
]
//After Created NewEntity
/src/Controller/UsersController.php (line 55)
object(App\Model\Entity\User) {
'username' => 'sdfsd',
'password' => '$2y$10$dWTXZzgABVe4ZFypD7VpQuuFeU2twVD/MKLs80.gPYaYRtQAJU/3O',
'date_of_birth' => object(Cake\I18n\Time) {
'time' => '1997-05-21T00:00:00+0530',
'timezone' => 'Asia/Kolkata',
'fixedNowTime' => false
},
'first_name' => '',
'last_name' => '',
'email' => 'aavrug@gmail.com',
'url' => '',
'profile_image' => '',
'[new]' => true,
'[accessible]' => [
'*' => true
],
'[dirty]' => [
'username' => true,
'password' => true,
'date_of_birth' => true,
'first_name' => true,
'last_name' => true,
'email' => true,
'url' => true,
'profile_image' => true
],
'[original]' => [],
'[virtual]' => [],
'[errors]' => [],
'[repository]' => 'Users'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment