# |
Jun 11th 2018, 12:42 |
Arckame |
hello |
# |
Jun 11th 2018, 12:27 |
josbeir |
;) |
# |
Jun 11th 2018, 12:27 |
mohitprakashsharma555 |
@tim @josbeir Thanks for response guys i got a solution :slightly_smiling_face: $states = $this->Counties->States->find('list',['keyField' => 'id','valueField' =>'state'])->toArray(); |
# |
Jun 11th 2018, 12:26 |
kitcat711 |
ok, trying |
# |
Jun 11th 2018, 12:26 |
edgaras.jan |
in hasMany() |
# |
Jun 11th 2018, 12:26 |
kitcat711 |
du to some "historical choices", the result may not be the same every where :) |
# |
Jun 11th 2018, 12:25 |
kitcat711 |
in the hasMany declaration? or can I do it in the contain? |
# |
Jun 11th 2018, 12:24 |
edgaras.jan |
add 'propertyName' |
# |
Jun 11th 2018, 12:23 |
kitcat711 |
while using a contain, how can I change the property name? Example: Notices hasMany Receipts I want my result in the property "'receipt_accounting_records' instead of 'receipts' |
# |
Jun 11th 2018, 12:21 |
kitcat711 |
hello |
# |
Jun 11th 2018, 12:15 |
adrienlambertwac |
In your function uploadFile you must set $team to the view like this $this->set(‘team’, $team) |
# |
Jun 11th 2018, 12:12 |
adrienlambertwac |
And when you debug the entity in the view, she is empty? |
# |
Jun 11th 2018, 12:12 |
edgaras.jan |
joopm: and matching() is not necessary, only where() |
# |
Jun 11th 2018, 12:12 |
josbeir |
@tim you need to upgrade your google :rolling_on_the_floor_laughing: |
# |
Jun 11th 2018, 12:10 |
tim |
Ugh don't know how I got on 2.0 cakebook >.< |
# |
Jun 11th 2018, 12:10 |
edgaras.jan |
joopm: remove 'finder' from $this->belongsTo('CompanyTypes', []); and use finder in controller `$this->Companies->find('external')` |
# |
Jun 11th 2018, 12:10 |
josbeir |
@mohitprakashsharma555 => https://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html#finding-key-value-pairs |
# |
Jun 11th 2018, 12:09 |
lorenzo |
joomp it is difficult to help you if you don;t answer the questions I ask |
# |
Jun 11th 2018, 12:09 |
tim |
https://book.cakephp.org/2.0/en/models/model-attributes.html#displayfield |
# |
Jun 11th 2018, 12:09 |
mohitprakashsharma555 |
$states = $this->Counties->States->find('list', ['limit' => 200]); |
# |
Jun 11th 2018, 12:08 |
mohitprakashsharma555 |
i am getting id on this relaction i want name how i can set name fields $this->belongsTo('States', [ 'foreignKey' => 'state_id', 'joinType' => 'INNER' ]); |
# |
Jun 11th 2018, 12:07 |
joopm |
but i need to pre filter in the model |
# |
Jun 11th 2018, 12:07 |
edgaras.jan |
and remove matching(), leave only `return $query->where(['CompanyTypes.id' => 1]);` |
# |
Jun 11th 2018, 12:07 |
joopm |
that would not work,i want that i want to filter companies by their type,i know i can make a find in the controller and pass to the template |
# |
Jun 11th 2018, 12:05 |
edgaras.jan |
joopm: try moving finder to CompanyTypesTable |
# |
Jun 11th 2018, 12:04 |
joopm |
but can not find anything than the cookbook |
# |
Jun 11th 2018, 12:04 |
joopm |
if you can show me a real life Conditional Associations it would be also useful |
# |
Jun 11th 2018, 12:02 |
lorenzo |
cool |
# |
Jun 11th 2018, 12:02 |
josbeir |
thats what i tought, i'll make a pr asap :slightly_smiling_face: |
# |
Jun 11th 2018, 12:02 |
pedroseco |
@lorenzo thanks :slightly_smiling_face: |
# |
Jun 11th 2018, 12:02 |
lorenzo |
I think the interface was added recently |
# |
Jun 11th 2018, 12:02 |
josbeir |
@lorenzo little ES question, is there a reason why the ES ResultSet class doesn't implement Cake\Datasource\ResultsetInterface ? |
# |
Jun 11th 2018, 12:01 |
lorenzo |
definitely |
# |
Jun 11th 2018, 11:57 |
pedroseco |
in this case the behaviour would be the best approach don’t you think? |
# |
Jun 11th 2018, 11:56 |
pedroseco |
after it gets manipulated |
# |
Jun 11th 2018, 11:56 |
pedroseco |
or I could just save this data into a secondary “body” field |
# |
Jun 11th 2018, 11:56 |
lorenzo |
then adding the functions to the entity sounds best |
# |
Jun 11th 2018, 11:55 |
pedroseco |
Would only use it on the read |
# |
Jun 11th 2018, 11:55 |
lorenzo |
joomp if you add a die() in the initialize method of your companies table, does it die? |
# |
Jun 11th 2018, 11:55 |
pedroseco |
not this case, I would maintain the original data in the db |
# |
Jun 11th 2018, 11:55 |
lorenzo |
it depends, I woudl use the behavior if you want to save the data directly in the database after applying the function |