# |
Aug 25th 2016, 17:57 |
graziel |
yeah but i dont see body of consume |
# |
Aug 25th 2016, 17:56 |
btx |
o |
# |
Aug 25th 2016, 17:56 |
btx |
no, the `newEntity` line right above (line 8) |
# |
Aug 25th 2016, 17:56 |
graziel |
and how do you add this data? maybe using patchEntity? : ) |
# |
Aug 25th 2016, 17:55 |
btx |
instead of requiring the controllers to be aware of underlying model logic |
# |
Aug 25th 2016, 17:55 |
btx |
to keep my models fat and happy and my controllers lean and clean |
# |
Aug 25th 2016, 17:55 |
btx |
just passing an entity full of form data to the `BucketEntriesTable::consume()` to add extra meta like the current date, the whodunnit, etc and then do the actual persisting of the record to the DB |
# |
Aug 25th 2016, 17:53 |
graziel |
@btx whats $this->BucketEntries->consume($entry) ? |
# |
Aug 25th 2016, 17:48 |
btx |
@graziel thanks for sticking with me :) - hereâ??s a gist https://gist.github.com/cwbit/a66992c4778b75d7e41739e70ac0e5b6 |
# |
Aug 25th 2016, 17:46 |
rudy1976s |
hello is there a way to append data to an existing configure ? |
# |
Aug 25th 2016, 17:45 |
graziel |
you are not calling later any patchEntity? |
# |
Aug 25th 2016, 17:44 |
graziel |
the `$entry = $this->newEntity($source->toArray(), ['validate'=>'consume']);` looks totaly valid and should do what you want |
# |
Aug 25th 2016, 17:42 |
btx |
the problem is that I am creating an entity in a controller (which calls default validation during the marshall) and passing that entity to a Table function (e.g. `$this->Foos->consume($foo)` ) |
# |
Aug 25th 2016, 17:41 |
graziel |
would help if you could gist the code : ) |
# |
Aug 25th 2016, 17:41 |
btx |
100% sure |
# |
Aug 25th 2016, 17:40 |
graziel |
btx you sure you are not calling $this->validationDefault($validator) in validationConsume? |
# |
Aug 25th 2016, 17:39 |
btx |
ugh frak that breaks error checking in the controller because normally the save operation modifies the entity it gets passed |
# |
Aug 25th 2016, 17:30 |
btx |
`$entry = $this->newEntity($source->toArray(), ['validate'=>'consume']);` is somehow preserving the source entries `errors()` even tho a `pj($source->toArray());` doesnâ??t show errors |
# |
Aug 25th 2016, 17:23 |
admad |
I am pretty sure if you specify a custom one only that is called |
# |
Aug 25th 2016, 17:14 |
btx |
yeah thatâ??s fine - I added a comment on the gist |
# |
Aug 25th 2016, 17:14 |
marquesf |
in** |
# |
Aug 25th 2016, 17:14 |
marquesf |
my form should be display.ctp? |
# |
Aug 25th 2016, 17:14 |
marquesf |
im srry man i need to ask |
# |
Aug 25th 2016, 17:10 |
btx |
also def not the way to do the cell display function |
# |
Aug 25th 2016, 17:10 |
btx |
@marquesf if thatâ??s the actual code youâ??ve spelled `contacts` wrong twice so far :) |
# |
Aug 25th 2016, 17:09 |
btx |
@admad is there a way to stop `validationDefault` from being called? (i.e. only call the validation specified in `[â??validateâ?? => â??..â??]`) |
# |
Aug 25th 2016, 16:55 |
fquffio |
I have obtained an acceptable result calling `TableRegistry::get('Posts')->get($postId, ['contain' => ['Foo']])->get('foo')`, but this is an array of already hydrated entities, while I need to get the query object in order to paginate results. |
# |
Aug 25th 2016, 16:52 |
slackebot |
inverse relationship. Is there any way of achieving the same result? I saw that `SelectableAssociationTrait::_buildQuery()` does pretty much the kind of thing I need, but it is a protected method, and I'd prefer not duplicating ORM logic. |
# |
Aug 25th 2016, 16:52 |
fquffio |
Hello everybody! I have a table, say `Posts`, that is related to a second table, say `Comments`, via a relation named `Foo`. I need to obtain a Query object to find Comments that are related to a specific Post. If I knew the name of the inverse relationship (`Bar`), that would be easily feasible using `TableRegistry::get('Comments')->find()->matching('Bar', function($q) { ... });`. Unfortunately, in this context I have no way of knowing the |
# |
Aug 25th 2016, 16:50 |
marquesf |
first code is display,ctp |
# |
Aug 25th 2016, 16:49 |
marquesf |
@btx what i miss? https://gist.github.com/anonymous/202a4503e603cc0d2192d37f8bcd7cd1 |
# |
Aug 25th 2016, 16:42 |
shealyw2 |
should you pass associated to newEntity and patchEntity? or just patchEntity? |
# |
Aug 25th 2016, 16:38 |
admad |
Validation is done when marshalling not saving |
# |
Aug 25th 2016, 16:17 |
btx |
so it appears there is no way to have `save()` only honor a requested validation set? (e.g. admin validation is different from user level validaton) |
# |
Aug 25th 2016, 16:14 |
btx |
and ``` $this->save($e, [â??validateâ??=>â??consumeâ??]); ``` does nothing |
# |
Aug 25th 2016, 16:13 |
btx |
will a `Table` always call `validationDefault` ? when I do ```php $e = $this->newEntity($data, [â??validateâ??=>â??consumeâ??]); return $this->save($e); ``` it appears that both the `validationDefault` and `validationConsume` functions are being called. |
# |
Aug 25th 2016, 16:10 |
btx |
np, Cells are like microcontrollers - more here http://book.cakephp.org/3.0/en/views/cells.html |
# |
Aug 25th 2016, 16:10 |
btx |
`?= $this->cell(â??Contact::addâ??) ?>` and then your view cell acts like a tiny controller and passes an entity to the view cell `.ctp` file that is picked up by `$this->Form-create($contact)` |
# |
Aug 25th 2016, 16:10 |
marquesf |
@btx thank u bro i will search about |
# |
Aug 25th 2016, 16:08 |
btx |
@marquesf view Cell that spits out a form using the correct entity object is one way |
# |
Aug 25th 2016, 16:07 |
marquesf |
i want to use the add action from my contatcs controller in my home controller any tricks to do it? |