# |
Aug 13th 2019, 12:39 |
conehead |
In case anyone was wondering why I wanted to separate them ;) |
# |
Aug 13th 2019, 12:39 |
conehead |
Ah well...I just added a `@group` annotation to my unit tests... This way I can run all unit tests before pushing a commit |
# |
Aug 13th 2019, 12:07 |
conehead |
do you guys seperate your unit tests from your functional/integration tests? |
# |
Aug 13th 2019, 11:43 |
slackebot1 |
debug($collection->listTables()); ``` Both `debug()`s are empty. Why? I thought it should at least show the tables defined in the fixtures for this test (all of which show up under `$this->fixtureManager->loaded()`)? |
# |
Aug 13th 2019, 11:43 |
mehov |
Hey guys Sorry about asking this again but I still need help. I'm trying to manipulate the corresponding database table while a test runs. Here's what I have (inside a test method): ``` // attempt 1 $db = \Cake\Datasource\ConnectionManager::get($connectionName); $statement = $db->query('show tables;'); //$statement->execute(); debug($statement->fetchAll()); // attempt 2 $collection = $db->getSchemaCollection(); |
# |
Aug 13th 2019, 11:43 |
graziel |
hmm in book `chronos` points to https://book.cakephp.org/chronos/ but redirects to https://book.cakephp.org/chronos/1.x/en/index.html - 404 |
# |
Aug 13th 2019, 11:42 |
dereuromark |
Do we have a decimal value object yet? Around https://php-decimal.io/#installation or a PHP only solution of some sorts? Does there sth exist in PHP? |
# |
Aug 13th 2019, 11:32 |
neon1024 |
Ahh, I have used `email_address` and then `email` in the form :face_palm: |
# |
Aug 13th 2019, 11:32 |
martin |
My boss wants to create a database per shop, is that a good idea? in one way I don’t like that idea, in the other way it will be a lot easier for mysql to search in data |
# |
Aug 13th 2019, 11:31 |
martin |
I need to save data of shops to a database, expected that will be 8.000.000 records per year per shop. I think this will be to much data to save all the stores in the same (mysql) database? |
# |
Aug 13th 2019, 11:27 |
neon1024 |
Seems to be working, as the flash message is `Username or password is incorrect` |
# |
Aug 13th 2019, 11:27 |
neon1024 |
I’m just implementing AuthComponent, and I have a `Log::debug` in my `findAuth` finder, but it’s not being called. Anywhere I can debug this? |
# |
Aug 13th 2019, 11:00 |
admad |
Yes |
# |
Aug 13th 2019, 10:59 |
vossen.steven |
yea no I'm striking out, the visibility of a const is public by default right? |
# |
Aug 13th 2019, 10:54 |
vossen.steven |
guess I missed it :O |
# |
Aug 13th 2019, 10:53 |
dereuromark |
see rest of docs |
# |
Aug 13th 2019, 10:53 |
vossen.steven |
@dereuromark any reason you define const as public? |
# |
Aug 13th 2019, 10:44 |
d.lisiecki93 |
i didnt :( |
# |
Aug 13th 2019, 10:44 |
dereuromark |
but yeah, it is always fired on patching. |
# |
Aug 13th 2019, 10:43 |
d.lisiecki93 |
My problem is that i'm receiving some data from frontend, i'm patching entity and having errors about fields which i'm fullfilling later in `beforeSave` event, but i want to inform frontend about errors |
# |
Aug 13th 2019, 10:43 |
dereuromark |
did you try it? :slightly_smiling_face: |
# |
Aug 13th 2019, 10:42 |
d.lisiecki93 |
Hi guys, i've got question about table events, is beforeMarshal fired for both new entities / already existing ones? |
# |
Aug 13th 2019, 10:36 |
vossen.steven |
I might steal some stuff from your repo there @dereuromark |
# |
Aug 13th 2019, 10:35 |
vossen.steven |
I don't use it for roles either, was just a crude example to get my point across :) |
# |
Aug 13th 2019, 10:34 |
challgren |
enum + bitmask |
# |
Aug 13th 2019, 10:34 |
challgren |
I use the enum tools for statuses, roles are a bit too simple IMHO |
# |
Aug 13th 2019, 10:33 |
vossen.steven |
That's actually a lot cleaner, never thought about it tbh, my thought process was, I want to do $entity->status_value, oh easy just get the table and pass the entity status :< |
# |
Aug 13th 2019, 10:30 |
dereuromark |
Also nicely connects with Bake and autodetect for IDE etc. |
# |
Aug 13th 2019, 10:30 |
dereuromark |
https://github.com/dereuromark/cakephp-tools/blob/master/docs/Entity/Enum.md is IMO the easiest and fastest solution :slightly_smiling_face: if you hardcode it anyways. |
# |
Aug 13th 2019, 10:28 |
challgren |
Why not like this? |
# |
Aug 13th 2019, 10:26 |
slackebot1 |
string { return TableRegistry::getTableLocator()->get($this->getSource())->types[$this->type]; } ``` |
# |
Aug 13th 2019, 10:26 |
vossen.steven |
Not sure if I follow but here's a crude example Table ``` const TYPE_USER = 0; const TYPE_ADMIN = 1; /** @var array */ public $types; public function initialize(array $config) { $this->types = [ self::TYPE_USER => __('User'), self::TYPE_ADMIN => __('Administrator'), ]; } ``` Entity ``` /** * @return string */ protected function _getTypeValue(): |
# |
Aug 13th 2019, 10:21 |
challgren |
Why not an association if you already have the tables |
# |
Aug 13th 2019, 10:19 |
vossen.steven |
I only use it for const values, for populating selects/radios and instances where I use a variable table name |
# |
Aug 13th 2019, 10:19 |
vossen.steven |
@challgren |
# |
Aug 13th 2019, 10:16 |
dereuromark |
A rector task for it would make it a super trivial change. For free. |
# |
Aug 13th 2019, 10:16 |
neothermic |
and then I can run the fixer to add the return to all of my $this->redirect calls |
# |
Aug 13th 2019, 10:16 |
neothermic |
a lot of my controller testing can't happen until another branch is merged in |
# |
Aug 13th 2019, 10:15 |
challgren |
Ahh ok |
# |
Aug 13th 2019, 10:15 |
neothermic |
433 test cases |
# |
Aug 13th 2019, 10:15 |
challgren |
Weak sauce! |