# |
Aug 25th 2016, 18:07 |
btx |
@graziel, it worked :slightly_smiling_face: thanks! |
# |
Aug 25th 2016, 18:06 |
btx |
Houston, we have persistence |
# |
Aug 25th 2016, 18:05 |
btx |
holy flip. at long last |
# |
Aug 25th 2016, 18:03 |
graziel |
bah wrong `patchEntity($entry, $entry->toArray(), ['validate' => 'consume']);` |
# |
Aug 25th 2016, 18:02 |
graziel |
in table |
# |
Aug 25th 2016, 18:02 |
btx |
like $entity->validate(â??consumeâ??); |
# |
Aug 25th 2016, 18:02 |
graziel |
and then `$entry = $this->patchEntity($entry->toArray(), ['validate' => 'consume']);` |
# |
Aug 25th 2016, 18:02 |
btx |
and then is there a way to take an entity and revalidate it without creating another entity? |
# |
Aug 25th 2016, 18:01 |
graziel |
ah then well you need to `$entry = $this->BucketEntries->newEntity($this->request->data, ['validate' => false]); in controller |
# |
Aug 25th 2016, 18:01 |
btx |
the idea is that the Table should know how itâ??s data needs to be stored and tweaked, and the Controller just needs to know what Table function it should be talking to |
# |
Aug 25th 2016, 18:01 |
btx |
yeah I want to do it in the Table tho - otherwise the controller is required to know more about the internal processing than it should |
# |
Aug 25th 2016, 18:00 |
btx |
i want to only call `validate => â??consumeâ??` |
# |
Aug 25th 2016, 18:00 |
graziel |
cause you dont set it in $entry = $this->BucketEntries->newEntity($this->request->data); |
# |
Aug 25th 2016, 18:00 |
graziel |
btx im kind of lost what you want to do : ), you dont want to call validation at all? or call ['validate'=>'consume'] ? |
# |
Aug 25th 2016, 17:57 |
btx |
agh poop haha itâ??s almost identical to `purchase` i pasted the wrong one - only diff is the `ENTRY_TYPE` that gets set |
# |
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â?? => â??..â??]`) |