Log message #4122236

# At Username Text
# Mar 6th 2018, 15:13 popperz0r any change to set it inside fields?
# Mar 6th 2018, 15:13 popperz0r i can see i have to put it outside
# Mar 6th 2018, 15:13 slackebot ['UnqualifiedLead.id' => 'desc'] ])->where(AuthorizationComponent::getUserAuthorizedLeadAccessCondition($this->Auth->User())['conditions'], AuthorizationComponent::getUserAuthorizedLeadAccessCondition($this->Auth->User())['value_type']) ->andWhere($include_conditions);```
# Mar 6th 2018, 15:13 popperz0r ``` $unqualified_leads_table = $this->UnqualifiedLead->find('all',[ 'fields' => ['id', 'name', 'user_id', 'User.first_name', 'User.last_name', 'User.full_name' => $this->query()->func()->concat(['first_name', ' ', 'last_name']), 'LeadType.label', 'Email.email', 'Phone.number', 'City.city_name'], 'contain' => ['User', 'Phone', 'Email', 'City', 'Company', 'LeadType'], 'order' =>
# Mar 6th 2018, 15:13 popperz0r can i adjust it to this?
# Mar 6th 2018, 15:12 jeremyharris in 2.x, virtual fields were actual SQL snippets like this, while in 3.x they are simply calculated properties on the entity object
# Mar 6th 2018, 15:11 jeremyharris ``` $query = $this->find() ->select(['full_name' => $this->query()->func()->concat(['first_name', ' ', 'last_name']); ```
# Mar 6th 2018, 15:10 jeremyharris something like this:
# Mar 6th 2018, 15:09 jeremyharris instead, you’ll have to build it as an alias field via the orm
# Mar 6th 2018, 15:09 jeremyharris you cannot in the class 2.x sense do it the same way. a virtual field on the entity is within PHP and calculated by PHP, and has nothing to do with SQL
# Mar 6th 2018, 15:08 popperz0r now i need to make a request of a string which should query full_name LIKE '%string%'
# Mar 6th 2018, 15:08 popperz0r is concats first_name and last_name
# Mar 6th 2018, 15:08 popperz0r i created a virtual property inside User Entity named full_name
# Mar 6th 2018, 15:07 jeremyharris perhaps an example of what you’re looking for would help us?
# Mar 6th 2018, 15:06 popperz0r anyone use this?
# Mar 6th 2018, 15:06 popperz0r it is killing me
# Mar 6th 2018, 15:06 popperz0r im still strugling with virtual properties conditions
# Mar 6th 2018, 15:06 popperz0r hi everyone
# Mar 6th 2018, 14:17 neon1024 Afternoon everyone
# Mar 6th 2018, 12:54 savant night all
# Mar 6th 2018, 12:46 makallio85 Thanks for your time! Clarified things for me.
# Mar 6th 2018, 12:46 makallio85 Okay. Now I get it.
# Mar 6th 2018, 12:46 savant I think thats an anti-pattern
# Mar 6th 2018, 12:46 savant I dont like querying the database from within the entity
# Mar 6th 2018, 12:44 makallio85 Do we mean here by "virtual value", something that does lazyloading or something that processes some other data that entity already has? And that should be considered as antipattern?
# Mar 6th 2018, 12:43 makallio85 Cool. So if i add method getPhoneNumber() to contact that iterates just what entity already holds we are all good here. I just got little bit confused of virtual value => anti pattern thoughts you said.
# Mar 6th 2018, 12:41 savant accessing data you have access to already - and throwing exceptions when its missing - is good
# Mar 6th 2018, 12:41 savant querying from the method is bad
# Mar 6th 2018, 12:41 makallio85 Aaa okay. So you mean, i can have public method in entity, but virtual value is bad pattern?
# Mar 6th 2018, 12:40 ghoritrilochan link: http://shreehariji.com
# Mar 6th 2018, 12:40 ghoritrilochan my new project in not found css,js,img or other page link?
# Mar 6th 2018, 12:40 savant add a method to your Contact entity that does those “iterations” for you
# Mar 6th 2018, 12:40 makallio85 So if I want to provide "easy" access to phone number without virtual value and without iterations or conditions on calling side, i should do... eeh what? :)
# Mar 6th 2018, 12:39 makallio85 Yes
# Mar 6th 2018, 12:39 savant no extra querying
# Mar 6th 2018, 12:39 savant so your Contact entities have access to those
# Mar 6th 2018, 12:39 makallio85 Yes
# Mar 6th 2018, 12:39 savant CommunicationDetails already has the phone number, right?
# Mar 6th 2018, 12:38 savant @makallio85 nope
# Mar 6th 2018, 12:38 makallio85 @savant https://gist.github.com/makallio85/6fc0e11ef52ab2eaa122bd24c58f6cc9
# Mar 6th 2018, 12:36 nisseni savant: will try that. :)