# |
Sep 29th 2016, 21:14 |
Cake3Beginner |
Also in the book it says "The core strings messages extracted from the CakePHP library can be stored separately in a file named cake.po in src/Locale/. The CakePHP localized library houses translations for the client-facing translated strings in the core (the cake domain). To use these files, link or copy them into their expected location: src/Loca |
# |
Sep 29th 2016, 21:11 |
Cake3Beginner |
Sorry I ment "previous" and "next" as demo text in the index view (from pagination), not "preview"... |
# |
Sep 29th 2016, 21:11 |
Cake3Beginner |
e');" within the index action -> still english. Do I need to rename cake.po or something to get the core translations to work? Merci |
# |
Sep 29th 2016, 21:11 |
Cake3Beginner |
'cake.po' from /vendor/cakephp/localized/src/Locale/de/ to /src/Locale/de/ . First try: I changed 'defaultLocale' in app.php from 'en_US' to 'de' -> text is still in english. Second try: reversed first try, added in the table Controller 'use Cake\I18n\I18n;' and below I18n::locale('de'); -> still english. Third try: Moved the line "I18n::locale('d |
# |
Sep 29th 2016, 21:11 |
Cake3Beginner |
Hi there, I'm a bit confused about i18n setup in CakePHP 3 and need some help please. I made a blank CakePHP installation with composer (locally XAMPP), set up a simple test table in the database and used "cake bake all" to create controllers etc. By default all text is in english, e.g. "preview" and "next" in index view. I copied the language file |
# |
Sep 29th 2016, 21:01 |
jec |
thanks! |
# |
Sep 29th 2016, 20:57 |
ndm |
@jec possible, yes, but not adivsed, it's deprecated |
# |
Sep 29th 2016, 20:57 |
ndm |
@adityapansari I'm saying that by default the callback filter requires the configured field to be present in your search request, ie `created`, like `?created=1andfrom_date=...`, and that if if you want to avoid that, you could for example enable the `alwaysRun` option for your filter, and in your callback check the `$args` variable whether the fields required for your search (`from_date` and `to_date`) are present yourself before trying to modify |
# |
Sep 29th 2016, 20:50 |
jec |
I'm using 2.8.3 |
# |
Sep 29th 2016, 20:50 |
jec |
hi, is it still possible to use the email component from a controller like this: $this->Email ? |
# |
Sep 29th 2016, 20:47 |
adityapansari |
hey! In my case - created is the column name and from_date and to_date which are the form data. I did not get you. May you please give a example. thanks |
# |
Sep 29th 2016, 20:44 |
ndm |
Actually, enabling `multiValue` isn't the way to go in that case, mixed up things, sorry... |
# |
Sep 29th 2016, 20:38 |
ndm |
You may want to either always run the filter, and implement a proper check for the required fields your own, or nest the fields under `created` and enable the `multiValue` option |
# |
Sep 29th 2016, 20:38 |
ndm |
@adityapansari Actually you're passing nothing... unless `alwaysRun` is enabled, a filter will only do its work when the configured field (in this case `created`) is present in the search request, and yours only contains `from_date` and `to_date`. |
# |
Sep 29th 2016, 20:32 |
adityapansari |
http://localhost:8765/appointments/appointment-report?from_date=2016-09-01andto_date=2016-09-03& |
# |
Sep 29th 2016, 20:31 |
adityapansari |
date |
# |
Sep 29th 2016, 20:31 |
ndm |
in your request |
# |
Sep 29th 2016, 20:30 |
ndm |
@adityapansari What value are you passing for the `created` field of your callback filter? |
# |
Sep 29th 2016, 20:27 |
adityapansari |
->add('patient_id', 'Search.Like', [ 'before' => true, 'after' => true, 'field' => [$this->Patients->aliasField('id')]], ['filterEmpty' => true]) |
# |
Sep 29th 2016, 20:27 |
adityapansari |
And this one is working fine. |
# |
Sep 29th 2016, 20:26 |
adityapansari |
*tried debugging |
# |
Sep 29th 2016, 20:26 |
adityapansari |
I also tried the code , I found that callback is not executing. please help! |
# |
Sep 29th 2016, 20:19 |
kitcat711_ |
even when i remove the UsersController.php file |
# |
Sep 29th 2016, 20:19 |
kitcat711_ |
got a strange warning: Headers already sent in /mycakeApp/src/Controller/Api/UsersController.php:46 |
# |
Sep 29th 2016, 20:19 |
kitcat711_ |
bonsoir |
# |
Sep 29th 2016, 20:16 |
adityapansari |
I also try this - ->add('created', 'Search.Callback', [ 'callback' => function ($query, $args, $manager) { return $query->andWhere(["Events.start >=" => new FrozenTime($args['from_date'])]) ->andWhere(["Events.start =" = new FrozenTime($args['to_date'])]); } ]); but it also did not work. |
# |
Sep 29th 2016, 20:15 |
slackebot |
it is not working. |
# |
Sep 29th 2016, 20:15 |
adityapansari |
Hey , I am using search plugin https://github.com/FriendsOfCake/search> So , In my events table , I added - $this->searchManager() ->add('created', 'Search.Callback', [ 'callback' => function ($query, $args, $manager) { return $query->andWhere(["Events.start >=" => $args['from_date']]) ->andWhere(["Events.start <=" = $args['to_date']]); } |
# |
Sep 29th 2016, 20:07 |
associatee |
You see, there's an associated row that actually satisfies the matching condition, but it's not being loaded |
# |
Sep 29th 2016, 20:07 |
associatee |
>contain(['PpcConjuntosEquivalencias' => function($q) use ($projetoId){ return $q->matching('Representante.ProjetoEstruturas', function($sq) use ($projetoId) { return $sq->where(['ProjetoEstruturas.projeto_id' => $projetoId]); }); |
# |
Sep 29th 2016, 20:07 |
associatee |
but it's not working properly |
# |
Sep 29th 2016, 20:06 |
associatee |
but I want to filter by sub associations |
# |
Sep 29th 2016, 20:06 |
sazpaimon |
mind you, my cake knowledge is very limited so I could be missing something |
# |
Sep 29th 2016, 20:06 |
associatee |
So I pass a query to the contain |
# |
Sep 29th 2016, 20:06 |
associatee |
but I want to filter it |
# |
Sep 29th 2016, 20:06 |
associatee |
I'm loading an association |
# |
Sep 29th 2016, 20:06 |
associatee |
hey guys |
# |
Sep 29th 2016, 20:05 |
sazpaimon |
If I use a component, then I can simply mock that component in $this->generate() and not have to mock out any of the controller methods |
# |
Sep 29th 2016, 20:03 |
sazpaimon |
how do I load a service class via $components/helpers/uses? That's kind of my goal here |
# |
Sep 29th 2016, 20:01 |
admad |
s/i/it |
# |
Sep 29th 2016, 20:00 |
admad |
though i can be just a general service class, doesnt have to be a component |