# |
Jun 10th 2018, 10:54 |
gannher |
Do you want to overwrite? (y/n/a/q) |
# |
Jun 10th 2018, 10:54 |
gannher |
File `/home/guillaume/Domotique/domotique-france/src/Model/Entity/User.php` exists |
# |
Jun 10th 2018, 10:54 |
gannher |
Baking entity class for User... |
# |
Jun 10th 2018, 10:54 |
gannher |
yes i bake it |
# |
Jun 10th 2018, 10:53 |
graziel |
it should be \App\Model\Entity\User |
# |
Jun 10th 2018, 10:52 |
graziel |
did yuo really baked it? |
# |
Jun 10th 2018, 10:52 |
saeideng |
or ``` $data=[ 'login'=>'gg', 'password'=>'123', 'role'=>'admin' ]; $user = $this->Users->newEntity(); $entity = $this->Users->patchEntity($user , $data); debug($user); ``` |
# |
Jun 10th 2018, 10:52 |
graziel |
you have default entity |
# |
Jun 10th 2018, 10:52 |
gannher |
errors* |
# |
Jun 10th 2018, 10:52 |
gannher |
Error has always empty :( |
# |
Jun 10th 2018, 10:52 |
gannher |
object(Cake\ORM\Entity) {'login' => 'gg', 'password' => '123','role' => 'admin','[new]' => true,...'[errors]' => [],'[invalid]' => [],'[repository]' => 'Users'} |
# |
Jun 10th 2018, 10:50 |
saeideng |
result ? |
# |
Jun 10th 2018, 10:50 |
gannher |
thanks |
# |
Jun 10th 2018, 10:49 |
saeideng |
test ^^ |
# |
Jun 10th 2018, 10:49 |
saeideng |
``` $data=[ 'login'=>'gg', 'password'=>'123', 'role'=>'admin' ]; $user = $this->Users->newEntity($data); debug($user); ``` |
# |
Jun 10th 2018, 10:48 |
gannher |
same result |
# |
Jun 10th 2018, 10:47 |
saeideng |
``` $user = $this->Users->newEntity(); ``` |
# |
Jun 10th 2018, 10:46 |
saeideng |
test this code in controller |
# |
Jun 10th 2018, 10:45 |
gannher |
yes i will copy my code |
# |
Jun 10th 2018, 10:45 |
graziel |
yeah but without filenames |
# |
Jun 10th 2018, 10:45 |
gannher |
sorry misstake of your last words |
# |
Jun 10th 2018, 10:44 |
gannher |
ah ok |
# |
Jun 10th 2018, 10:44 |
gannher |
https://stackoverflow.com/questions/50781524/how-to-use-validationdefault-method-in-cakephp-3 all my code here |
# |
Jun 10th 2018, 10:44 |
graziel |
just copy somewhere what you have now so you dont have to retype it |
# |
Jun 10th 2018, 10:44 |
graziel |
bin/cake bake model Users |
# |
Jun 10th 2018, 10:43 |
gannher |
thanks |
# |
Jun 10th 2018, 10:43 |
gannher |
ok i will try |
# |
Jun 10th 2018, 10:43 |
graziel |
try to bake it, making things by hand can lead to silly typos like UsresTable.php |
# |
Jun 10th 2018, 10:43 |
gannher |
<?= $this->Form->create($user, ['url' => ['controller' => 'Users', 'action' => 'add']]); ?> |
# |
Jun 10th 2018, 10:42 |
saeideng |
for form or use `create([])` |
# |
Jun 10th 2018, 10:40 |
gannher |
class UsersTable extends Table |
# |
Jun 10th 2018, 10:40 |
gannher |
made by hand |
# |
Jun 10th 2018, 10:39 |
graziel |
yeah but its a side note : ) , just to be sure if you are loading correctly UsersTable did you bake it or made it by hand? |
# |
Jun 10th 2018, 10:38 |
gannher |
ok |
# |
Jun 10th 2018, 10:38 |
saeideng |
and sent this entity to form `create($entity` |
# |
Jun 10th 2018, 10:38 |
gannher |
$user = $this->Users->newEntity($this->request->getData()); |
# |
Jun 10th 2018, 10:37 |
gannher |
i will try |
# |
Jun 10th 2018, 10:37 |
gannher |
ok |
# |
Jun 10th 2018, 10:37 |
saeideng |
newEntity() |
# |
Jun 10th 2018, 10:37 |
gannher |
i need use var $users in form ? |
# |
Jun 10th 2018, 10:37 |
saeideng |
first create an entity |