Log message #4053540

# At Username Text
# Jul 18th 2017, 15:18 cleptric Uhhh :thinking_face:
# Jul 18th 2017, 15:17 awi can I somehow set a message when i use stoppropagation?
# Jul 18th 2017, 15:16 genellern sonu-nk look at the dump option in the migrations plugin
# Jul 18th 2017, 15:15 cleptric if you call `$event->stopPropagation()` this will stop the delete opration
# Jul 18th 2017, 15:15 cleptric beforeDelete has a `$event` parameter
# Jul 18th 2017, 15:14 awi or something like an return?
# Jul 18th 2017, 15:14 awi What do you mean exactly by "By stopping this event you will abort the delete operation." in https://book.cakephp.org/3.0/en/orm/table-objects.html#beforedelete ? Something like exit;?
# Jul 18th 2017, 15:13 sonu-nk ?
# Jul 18th 2017, 15:13 sonu-nk is there any command in cakephp3 which can generate migration file from database
# Jul 18th 2017, 15:12 neon1024 What about the datasource for the fixture to write to the datastore?
# Jul 18th 2017, 15:12 admad No other setup code
# Jul 18th 2017, 15:12 admad Just include core fixture anf TR::get() to get table instance
# Jul 18th 2017, 15:11 admad It's that easy to test a behaviour https://github.com/UseMuffin/Orderly/blob/master/tests/TestCase/Model/Behavior/OrderlyBehaviorTest.php
# Jul 18th 2017, 15:10 jeremyharris the above is what I do for my behaviors that don’t interact with fixture data
# Jul 18th 2017, 15:09 neon1024 Perhaps I should check the core ORM tests instead of the core behaviour tests
# Jul 18th 2017, 15:09 jeremyharris ``` $this->Table = new Table([ ‘alias’ => ‘Contacts’, ‘connection’ => ConnectionManager::get(‘test’), ]); $this->Table->addBehavior(‘DateConverter’, [ ‘fields’ => [ ‘date’ ] ]); $this->Table->schema()->addColumn(‘date’, [‘type’ => ‘datetime’]);
# Jul 18th 2017, 15:09 jeremyharris you can create a dummy table
# Jul 18th 2017, 15:09 neon1024 Then table takes schema, and urgh
# Jul 18th 2017, 15:09 neon1024 But query takes connection and table
# Jul 18th 2017, 15:09 neon1024 As it’s just testing a beforeFind appends a contain
# Jul 18th 2017, 15:09 neon1024 I hoping to avoid all that
# Jul 18th 2017, 15:08 admad Hell not even a fixture, just use a core one
# Jul 18th 2017, 15:08 admad @neon1024 all you need to create is a fixture and then use TableRegistry::get()
# Jul 18th 2017, 15:02 neon1024 Ah yes, I’ve found the problem I thought wasn’t a thing. It’s trying to test a behaviour. As it needs a table, which needs a connection, and a schema
# Jul 18th 2017, 14:13 admad @saeideng !!!!
# Jul 18th 2017, 14:13 irongomme thxs @mikesmoniker and @saeideng !!
# Jul 18th 2017, 14:12 irongomme Great !
# Jul 18th 2017, 14:12 mikesmoniker You can change them at runtime on the fly.
# Jul 18th 2017, 14:12 saeideng @admad ????
# Jul 18th 2017, 14:12 mikesmoniker @irongomme https://book.cakephp.org/3.0/en/orm/saving-data.html#changing-accessible-fields
# Jul 18th 2017, 14:11 saeideng you can use `$_accessible`
# Jul 18th 2017, 14:11 irongomme @admad :thumbsup:
# Jul 18th 2017, 14:11 admad *sure is
# Jul 18th 2017, 14:11 admad sure it, set it non accessible only in add() method for newEntity() call
# Jul 18th 2017, 14:10 irongomme @admad, ok but i need it to be editable later , is this possible in that way ?
# Jul 18th 2017, 14:10 admad 'accessibleFields' option for newEntity/patchEntity()
# Jul 18th 2017, 14:10 mikesmoniker It defines “Fields that can be mass assigned using newEntity() or patchEntity().” - So make sure you’re using those to go from request -> model.
# Jul 18th 2017, 14:10 saeideng :$
# Jul 18th 2017, 14:10 saeideng just misunderstand
# Jul 18th 2017, 14:10 mikesmoniker Have a look at Entity::$_accessible.
# Jul 18th 2017, 14:10 admad @saeideng he wants to prevent it from being added, not require it (unless i misunderstood his statement)