Logs for #cakephp

Page 2 of 35,970, showing 100 records out of 3,596,930 total, starting on record 101, ending on 200

# At Username Text
# Oct 9th, 07:26 xenogew If i want to adopt Twitter bootstrap as css framework. What should I do? What I googled are downloading->copying method, a lot of plugin and forks. I prefer the way using `composer require` method, can anyone guide me how to accomplish that?
# Oct 9th, 07:17 rightscoreanalysis it's a bug because I call this on another collection with the same structure
# Oct 9th, 07:16 rightscoreanalysis does anyone know what this means: Hash::combine() needs an equal number of keys + values.
# Oct 9th, 05:13 zomb leaving it as 'alphanumeric' for now
# Oct 9th, 05:13 zomb meh going to bed
# Oct 9th, 05:08 zomb and then ```public function isUsername($username, $context) { return preg_match('/^[a-zA-Z0-9_]{3,20}$/', $username); }```
# Oct 9th, 05:07 zomb ``` 'rule' => [$this, 'isUsername'], 'message' => "..." ```
# Oct 9th, 05:07 zomb tried that... still not working
# Oct 9th, 05:05 blancessanchez30 @zomb
# Oct 9th, 05:05 blancessanchez30 make a custom function for regex validation
# Oct 9th, 05:04 zomb sorry it's late... why won't this validate via regex? ``` ->add('username', 'isUsername', [ 'rule' => ['custom', ['/^[a-zA-Z0-9_]{3,}$/']], 'message' => 'Username can only contain letters, numbers and underscores.' ])```
# Oct 9th, 03:50 zomb and switch your `Session` section in `config/app.php`
# Oct 9th, 03:50 zomb basically create the table in your DB
# Oct 9th, 03:50 zomb whoops meant to link to the section: https://book.cakephp.org/3.0/en/development/sessions.html#database-sessions
# Oct 9th, 03:49 zomb start with a review of the docs: https://book.cakephp.org/3.0/en/development/sessions.html
# Oct 9th, 03:47 blancessanchez30 were there any tutorials that could help me?
# Oct 9th, 03:47 zomb @blancessanchez30 it's easy to switch, and there are lots of benefits in scalability
# Oct 9th, 03:18 zomb @blancessanchez30 i had a similar issue, and for lots of reasons, i moved to database sessions instead of the php... docs were confusing
# Oct 9th, 01:21 blancessanchez30 when i refresh the page, the session is still there
# Oct 9th, 01:21 blancessanchez30 ``` 'Session' => [ 'defaults' => 'php', 'timeout' => 1, 'ini' => [ 'session.cookie_lifetime' => 5 ] ],```
# Oct 9th, 01:18 blancessanchez30 Hello how to have session timeout in cakephp 3?
# Oct 9th, 01:00 zomb i'm trying to use Mailer within a Command, for the curious
# Oct 9th, 00:58 zomb how does the new Mailer architecture pick the email configuration for sending?
# Oct 8th, 22:38 rightscoreanalysis there is no correlation imo to the book example, sheer brute force made it work - nothing else!
# Oct 8th, 22:38 rightscoreanalysis this worked: $propertyPeriods = Hash::combine($propertyPeriods, '{n}.{n}.id', '{n}.0');
# Oct 8th, 22:19 rightscoreanalysis either the book is not very well written or I am lacking
# Oct 8th, 22:19 rightscoreanalysis $result = Hash::remove($propertyPeriods, '{n}.[0].Data');
# Oct 8th, 22:19 rightscoreanalysis why does this not shift the array up one index?
# Oct 8th, 22:08 rightscoreanalysis man alive this is challenging
# Oct 8th, 21:57 rightscoreanalysis actually I don't think the Hash class will work in this case
# Oct 8th, 21:53 rightscoreanalysis that what I was thinking
# Oct 8th, 21:53 dereuromark also Hash::extract, combine etc can help here
# Oct 8th, 21:52 dereuromark instead, if you need, assign it to a different array.
# Oct 8th, 21:52 dereuromark dont do these kind of things
# Oct 8th, 21:51 rightscoreanalysis removing the [0] index from an array's index
# Oct 8th, 21:50 rightscoreanalysis foreach($propertyPeriods as and$period) { $period = $period[0]; }
# Oct 8th, 21:50 rightscoreanalysis is there a cake shorthand way to do this
# Oct 8th, 21:21 dereuromark foreach over it
# Oct 8th, 21:20 rightscoreanalysis back to the drawing board :slightly_smiling_face:
# Oct 8th, 21:17 rightscoreanalysis my known is the id - 103
# Oct 8th, 21:17 rightscoreanalysis 0 in an unknown
# Oct 8th, 21:17 rightscoreanalysis I have to use $property->property_periods[0] to gain access to the entity that has id 103
# Oct 8th, 21:16 rightscoreanalysis but if in my template my date is in the var: $property->property_periods
# Oct 8th, 21:14 dereuromark you probably are.
# Oct 8th, 21:14 rightscoreanalysis i guess I am over-complicating this
# Oct 8th, 21:13 rightscoreanalysis I want to select the object by an id
# Oct 8th, 21:13 rightscoreanalysis yeah so I have an entity with 5 objects
# Oct 8th, 21:12 dereuromark but that is still the same entity
# Oct 8th, 21:12 rightscoreanalysis the entity is got through a contain on the sql query
# Oct 8th, 21:11 dereuromark you dont do this on the entity, this is a DTO, nothing else
# Oct 8th, 21:11 dereuromark also, you need to understand the basic ORM concepts. You can do get($id) on the table and then get the entity
# Oct 8th, 21:11 dereuromark you got the entity, why do you want it again?
# Oct 8th, 21:10 rightscoreanalysis there must be something similar in Cake?
# Oct 8th, 21:10 rightscoreanalysis I know that in Magento for example you can get by id on an object
# Oct 8th, 21:09 rightscoreanalysis in the above case 103
# Oct 8th, 21:09 dereuromark ->id ?
# Oct 8th, 21:01 rightscoreanalysis can do do something like $propertyPeriod->getId(103)
# Oct 8th, 21:00 rightscoreanalysis [ (int) 0 => object(App\Model\Entity\PropertyPeriod) { 'id' => (int) 103, 'property_id' => (int) 51, 'start_date' => object(Cake\I18n\FrozenTime) {
# Oct 8th, 21:00 rightscoreanalysis If i know the 'id' of PropertyPeriod:
# Oct 8th, 20:14 rightscoreanalysis brb
# Oct 8th, 20:13 rightscoreanalysis what I need is something like: $roomPricesByPeriod = $collection->groupBy('id'. 'start_date', 'end_date');
# Oct 8th, 20:12 rightscoreanalysis $collection = new Collection($propertyTest); $roomPricesByPeriod = $collection->groupBy('id');
# Oct 8th, 20:12 rightscoreanalysis so far I did this to group the ids which is what I need
# Oct 8th, 20:11 rightscoreanalysis I just need to extract the start_date and end_date from each index and put it in the top level
# Oct 8th, 20:11 rightscoreanalysis https://gist.github.com/spacebiscuit/dabfda259d39fd0cdcfc8032a3f58570
# Oct 8th, 20:11 rightscoreanalysis @ricksaccous see this gist
# Oct 8th, 20:09 rightscoreanalysis I tried to read the book... after a while all of the methods look the same and I can't differentiate one form the other
# Oct 8th, 20:09 rightscoreanalysis yeah it looks super powerful
# Oct 8th, 20:09 ricksaccous it changes your life
# Oct 8th, 20:09 ricksaccous whatever you find works, but i'd recommend using collection magic
# Oct 8th, 20:08 rightscoreanalysis I might try and just hack it with a foreach
# Oct 8th, 20:08 ricksaccous is different than extract() via collection
# Oct 8th, 20:08 ricksaccous prob should share exactly what you are trying to extract, it's worth mentioning the extract that EntityInterface implements
# Oct 8th, 20:07 ricksaccous @rightscoreanalysis yeah i would think so :slightly_smiling_face:
# Oct 8th, 20:01 rightscoreanalysis I am really stuck on something that really doesn't look to be difficult
# Oct 8th, 20:00 rightscoreanalysis can i extraxt objects with collections?
# Oct 8th, 19:24 ricksaccous oh, neat
# Oct 8th, 19:14 beakman @nk-sonu There's also `->sql()`;
# Oct 8th, 18:57 ricksaccous https://book.cakephp.org/3.0/en/orm/query-builder.html#selecting-rows-from-a-table
# Oct 8th, 18:57 ricksaccous @nk-sonu If you try to call debug() on a Query object, you will see its internal state and the SQL that will be executed in the database:
# Oct 8th, 18:48 nk-sonu because i can see its only giving object.. but i need mysql query like this "SELECT * from `seminars` where (DATE(specific_date) IN ('2018-10-24', '2018-10-25', '2018-10-29')) OR week_day IN (1,4,3,6)"
# Oct 8th, 18:47 nk-sonu is there any way in cakephp 3 to print raw mysql from cakephp query ?
# Oct 8th, 18:46 rightscoreanalysis sure: https://gist.github.com/spacebiscuit/92e6a99cd0cd45174f54b843660e2856
# Oct 8th, 18:44 yuzl use pastebin/gist pls
# Oct 8th, 18:44 rightscoreanalysis I want to extraxt the strat_date and and end_date and put them in an index below the top/main
# Oct 8th, 18:43 slackebot <rightscoreanalysis>
# Oct 8th, 18:43 rightscoreanalysis hi anyone able to help with this: my collection is in this format
# Oct 8th, 18:39 yuzl someone here for help?
# Oct 8th, 18:39 yuzl hi guys. i'm having some troubles saving associated data
# Oct 8th, 18:34 beakman I know, I was building on top of your suggestion of using `IN`.
# Oct 8th, 18:33 edgaras.jan you can't ``` 'OR' => [ 'DATE(specific_date)' => '2018-10-24', 'DATE(specific_date)' => '2018-10-24', ] ```
# Oct 8th, 18:32 edgaras.jan yes, only there is problem when you need same field (array key), then you need use subarray
# Oct 8th, 18:30 beakman I think the `'OR' => [...]` part is what he was looking for.
# Oct 8th, 18:29 beakman ``` 'OR' => [ ['DATE(specific_date) IN ' => '2018-10-24', '2018-10-25], ['DATE(specific_date)' => '2018-10-24'], ['DATE(specific_date)' => '2018-10-24'], 'week_day IN' => [1,4,3,6], ] ```
# Oct 8th, 18:28 edgaras.jan or if you wish first form ``` 'OR' => [ ['DATE(specific_date)' => '2018-10-24'], ['DATE(specific_date)' => '2018-10-24'], ['DATE(specific_date)' => '2018-10-24'], 'week_day IN' => [1,4,3,6], ] ```
# Oct 8th, 18:25 edgaras.jan `SELECT * from `seminars` where (DATE(specific_date) IN ('2018-10-24', '2018-10-25', '2018-10-29')) OR week_day IN (1,4,3,6)`
# Oct 8th, 18:25 nk-sonu in dated we can use IN ? @edgaras.jan
# Oct 8th, 18:25 nk-sonu i am confused in "OR"
# Oct 8th, 18:24 edgaras.jan use `IN`
# Oct 8th, 18:24 slackebot <nk-sonu>