# |
Jul 8th 2021, 11:17 |
paolo.bragagni |
language_id from Languages? |
# |
Jul 8th 2021, 11:17 |
paolo.bragagni |
so no way to get lingua_id from Lingue? |
# |
Jul 8th 2021, 11:12 |
paolo.bragagni |
:( |
# |
Jul 8th 2021, 10:55 |
slackebot2 |
!dereuromark-advice |
# |
Jul 8th 2021, 10:55 |
slackebot2 |
Command sent from Slack by dereuromark: |
# |
Jul 8th 2021, 10:51 |
paolo.bragagni |
but I dont find the way to get the 'lingua_id' |
# |
Jul 8th 2021, 10:51 |
paolo.bragagni |
${{ otherPlural }} = $this-{{ currentModelName }}->{{ otherName }}->find('list',['conditions' => ['id' => ${{ singularName }}->lingua_id]]); |
# |
Jul 8th 2021, 10:51 |
paolo.bragagni |
more or less is: |
# |
Jul 8th 2021, 10:50 |
paolo.bragagni |
$lingue = $this->Libri->Lingue->find('list',['conditions' => ['id' => $libro->lingua_id]]); |
# |
Jul 8th 2021, 10:50 |
paolo.bragagni |
In my edit.twig I'd like to make something like this |
# |
Jul 8th 2021, 08:10 |
erwane |
Thanks |
# |
Jul 8th 2021, 07:44 |
dereuromark |
Range() and loop + translation inside a helper |
# |
Jul 8th 2021, 07:26 |
kevin.pfeifer |
You can create a custom view helper if you want |
# |
Jul 8th 2021, 07:20 |
erwane |
There is a simple way to create a select of weekdays ? (monday, tuesday, ..) Except creating an array with all days and pass to options ;) |
# |
Jul 7th 2021, 19:58 |
steinkel |
you can add generic logic to AppController beforeFilter and use `allow` if you check the controller name and action. BUT it would be much better to have the allow per controller in the respective beforeFilter |
# |
Jul 7th 2021, 19:57 |
steinkel |
which version are you using? would be possibly for you to upgrade? |
# |
Jul 7th 2021, 17:36 |
kevin.pfeifer |
you can also use mass assignment for the accessible array https://book.cakephp.org/4/en/orm/entities.html#mass-assignment and just set those to false which shouldn't be accessible (like here) https://github.com/dereuromark/cakephp-queue/blob/master/src/Model/Entity/QueueProcess.php |
# |
Jul 7th 2021, 17:31 |
tyler.adam.lazenby |
but now it is fixed |
# |
Jul 7th 2021, 17:31 |
tyler.adam.lazenby |
ungh I have spent way too long trying to track that down |
# |
Jul 7th 2021, 17:30 |
tyler.adam.lazenby |
Thank you so much!!!! |
# |
Jul 7th 2021, 17:20 |
greg138 |
`'customer_id' => false,` |
# |
Jul 7th 2021, 17:10 |
tyler.adam.lazenby |
and I am not sure why |
# |
Jul 7th 2021, 17:10 |
tyler.adam.lazenby |
it saves the user but the customer ID is being saved as null |
# |
Jul 7th 2021, 17:09 |
tyler.adam.lazenby |
```$validator ->scalar('customer_id') ->maxLength('customer_id', 255) ->requirePresence('customer_id', 'create') ->notEmptyString('customer_id');``` |
# |
Jul 7th 2021, 17:09 |
slackebot2 |
'time_updated' => true, 'forgot_pw_token' => true, 'customer_id' => false, 'user_type_id' => true, 'operator' => true, 'state_owner' => true, 'new_user_type' => true, 'authority' => true, ];``` |
# |
Jul 7th 2021, 17:09 |
slackebot2 |
individual fields accessible as needed. * * @var array */ protected $_accessible = [ 'user_username' => true, 'user_email' => true, 'user_first_name' => true, 'user_last_name' => true, 'user_password' => true, 'user_type' => true, 'operator_id' => true, 'state_owner_id' => true, 'forgot_pw_token_ts' => true, 'time_created' => true, |
# |
Jul 7th 2021, 17:09 |
tyler.adam.lazenby |
```class User extends Entity implements IdentityInterface, \Authorization\IdentityInterface { use LazyLoadEntityTrait; /** * Fields that can be mass assigned using newEntity() or patchEntity(). * * Note that when '*' is set to true, this allows all unspecified fields to * be mass assigned. For security purposes, it is advised to set '*' to false * (or remove it), and explicitly make |
# |
Jul 7th 2021, 17:09 |
slackebot2 |
($this->Users->save($user)) { $this->Flash->success(__('The user has been saved.')); return $this->redirect(['action' => 'index']); } $this->Flash->error(__('The user could not be saved. Please, try again.')); }``` |
# |
Jul 7th 2021, 17:09 |
tyler.adam.lazenby |
```$customer = $this->Woocommerce->createCustomer($woo_data); if (!$customer->id) { $this->Flash->error(__('The user could not be created on the shop. Please try again. If this problem persists please contact support.')); } else { $data['customer_id'] = $customer->id; debug($data); $user = $this->Users->patchEntity($user, $data, ['associations' => ['Operators']]); dd($user); if |
# |
Jul 7th 2021, 17:09 |
tyler.adam.lazenby |
I am trying to set a unique value called customer_id into my users table. It is for a woocommerce data and it isn't saving |
# |
Jul 7th 2021, 16:20 |
dereuromark |
yeah, it is about the files in git :) so in the end it should completely not matter what the folders are, if they are created in the right env anyway. |
# |
Jul 7th 2021, 16:16 |
bato |
I don't think git tracks directory permissions. Anyway stay close to prod evn makes sense |
# |
Jul 7th 2021, 16:11 |
kevin.pfeifer |
indeed |
# |
Jul 7th 2021, 16:11 |
dereuromark |
yeah, which is not relevant for normal files :) |
# |
Jul 7th 2021, 16:11 |
kevin.pfeifer |
git ignores/forgets executable bit by default as far as i know |
# |
Jul 7th 2021, 16:10 |
dereuromark |
either way, staying local more close to prod env is a plus. that includes the creation of files and folders, which in return takes all issues away about permissions |
# |
Jul 7th 2021, 16:10 |
dereuromark |
but yeah, depends on the deploy strategy. |
# |
Jul 7th 2021, 16:10 |
dereuromark |
git doesnt lose permissions when checking it out :) at least for me it doesnt |
# |
Jul 7th 2021, 16:06 |
bato |
:thinking_face: I think the `i18n` shell script is intended to be used in "dev" instance (local, docker, container, etc...) to create translations. Then it will be pushed to a (probably) git repository. When the repository is cloned that permissions are lost. So I can't figure out why there is need of 770 permissions, but maybe it's my limitations. Thanks for the support as usual ;) |
# |
Jul 7th 2021, 14:52 |
dereuromark |
https://stackoverflow.com/questions/19547085/differences-between-chmod-755-vs-750-permissions-set => why would world need access to those if the servers are properly (securely) configured? |
# |
Jul 7th 2021, 14:52 |
dereuromark |
linux :) which means local PC but internet apps (which means not so local apps on the web) are not targeting you yourself on your computer, but on remote servers |