Log message #3923103

# At Username Text
# Aug 25th 2016, 18:12 admad You have already gone wrong when you find the need to validate an entity
# Aug 25th 2016, 18:09 btx actually. iâ??ll just slap a method on AppTable for now lol
# Aug 25th 2016, 18:09 btx `$entry = $this->patchEntity($entry, $entry->toArray(), ['validate'=>'consume']);` seems a lot to just get an entity to revalidate, but thatâ??s a struggle for another day
# Aug 25th 2016, 18:08 btx +1, u rock
# Aug 25th 2016, 18:08 graziel no problem glad i could help : )
# Aug 25th 2016, 18:07 btx now to clean up all this frenzied mess i made
# 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