« first day (1907 days earlier)      last day (3267 days later) » 

09:00
-3
Q: Trying to get property of non-object in yii

user3833682I'm using yii framework and I'm new in yii and can't understand the problem in this code, it is giving error in this code and I just attached the image of my code and when I just try to echo '<pre>';print_r($role);echo '</pre>'; it just print code like this can't understand why this is givi...

09:16
@user3833682 you probably should learn the language before trying to pick up a framework
Morning!
@user3833682 var_dump(Yii:$app->user->identity->id); die(); Do you get an ID printed on the screen, or does the script exit with the same error as in the question? That's where you start debugging.
@Duikboot
Damn, ran yesterday again since september... I can feel it today in my legs. Only 5.5KM yesterday in 30 mins.
That's still pretty good haha
Just got to take the burn
09:21
@Sean I suspect he/she is already gone. It's a userXXXXXXX account. They tend to span'n'scram
User Sean I tried to print_r or echo but didn't work for me it is printing same php code to the browser...
I hope you understand that there are TWO object "chains" in that line. Step 1 would be to separate those (I would also separate the "chains" but Yii community has this obsession with "fluid interface", or something)
you can see the difference between first image and second image in my posted question
Well your second image is exactly the same as your first image. The error is on line 42 and you're trying to do stuff afterwards. Yii turns the notice into an exception which breaks the script
so what I have to do now...
09:27
Look at what @tereško has just said. There's two basic points of failure on that line
Your first step is to determine which one of those points it is
In other words, either your Yii::$app->user->identity->id call is wrong
or your livefactory\models\AuthAssignment::find()->where('...')->asArray()->one() is wrong (which may be dependent on the query, not sure how Yii works in that regard)
naah ... I am to mean ... which makes me automatically wrong
If you need it spelling out, test each step of your chain.
Test if Yii::$app->user exists, then test if Yii::$app->user->identity exists. If both are fine, test your second, outer chain in the same way,
@LeviMorrison we should have a php fmt
@Sean IIRC, the CActiveRecord::find() can return an empty array, if it finds nothing (and yes, it uses that stupid hungarian notation)
Oh wait is that not the problem right there then?
09:33
who knows
->asArray()->one()
calling a method on an array lol
->asArray()->one() is this the error?
That's for you to find out lol, I don't have your code.
last time I used Yii was in 2012
@user3833682 do you know how to debug in PHP?
yes i know but I'm new in yii and I got the project to configure at my local machine but can't configure it.
I know codeigniter only in framework
09:38
if I had to name three worst frameworks in php, those would be: codeigniter, cake and yii
you have done 2 out of 3
@MadaraUchiha old, extremely harmful to productivity and/or will to live
@Jimbo you are supposed to delete it, not discuss :P
09:45
@tereško codeigniter is not so bad, if you don't use that singleton object. if you know what I mean
@tereško Joomla, modx are two I've had the experience to disregard forever
though modx is less of a framework and more of a CMS
@Sean joomla has improved a lot in past few years ... and modx is dead
Huh, thought it was still going!
can any one help me for my problem...
have you seen any modx projects in past 5 years?
24 mins ago, by tereško
I hope you understand that there are TWO object "chains" in that line. Step 1 would be to separate those (I would also separate the "chains" but Yii community has this obsession with "fluid interface", or something)
@Jimbo besides, that was not the entire directory structure. The real one looks like this ... and it seems that you have simply renamed what I have as "components" to "infrastructure" and renamed "model" to "domain"
09:49
@tereško I had components too, and Entity, Repository etc. It originally started with me realising that an entity and a repository should be in the same directory, including any factories for said entity, because they are in the same context. That was a bastard to set up with the ORM I'm using, but I did it.
does anyone know if there is a better solution to the refValues() function this guy says on stackoverflow.com/a/16120923/2018654 ?
then what the hell is "infrastructure" ?
as I understand, it's either "components" or "vendor" :P
Infrastructure currently contains driver stuff, web socket stuff like the event loop (that doesn't relate directly to application or domain, it's just a generic event loop), and fixtures
@Jimbo it depends on what definition you use for "repository". I tend to have "entities" in the same dir as "collections"
and I see repositories something that is built on top if those .. and also includes an identity map
keep in mind that I an not a firm believer in Glory of DDD
@tereško I've only just started picking it up tbh, but liking what it's preaching so far. What specifically don't you like about it?
09:57
I have nothing against DDD, but there are people who treat it as "the only true way", which TBH scares me a bit
If I open the application/domain (or whatever else it is named) folder I should be able to see what the application is about. vertical > horizontal folder structure in my opinion
@Patrick Application and Domain are not interchangeable, you didn't mean "or" there did you?
@Patrick nice sentiment. But hard to achieve with autoloading
@tereško How so? I never really worried about autoloading since using composer
@Patrick can you show an example of directory structure which actually illustrates that approach?
10:00
@Jimbo depends, if domain includes everything from entities to services then that is kinda the "core" of your application. What I mean is whatever folder includes all your core app stuff (not counting controllers etc)
@tereško Afaik all symfony components follow it more or less
"components" do not reside at 1st or 2nd level of directory tree
@Patrick Domain is the core, it's your business objects, the things that are your application. Application contains controllers, generic configuration. At least that's what I have so far - so you can route HTTP, CLI etc via Application -> Domain
My "Components" directory used to be a list of services
^ yeah .. those go in /model/services for me
yeah but I would prefer Auth/User Auth/UserRepository Auth/Authenticator to Entities/User Repositories/User Services/Authenticator
10:07
o/
@Patrick but is "user" really part of "auth" ?
you end up getting these type of tricky issues
@tereško It's an object that's the result of "auth" successfully happening
you assume that "user" can only contain authenticated user
though I have a horizontal structure in a project, I have a packages (can be called components or smth else) directory that has PSR-4 autoload & namespaced such as `\VendorName\ComponentName\Entity` and `\VendorName\ComponentName\Repository`

if you have a class that is some sort of a façade to that component/package/service, it's really a pleasure to work with such structure. on the other side, if you don't have one, it becomes shitty to use
@tereško Unauthenticated user can still be the result of "auth" unsuccessfully happening
10:11
@Jimbo that's not what I was driving at. I was thinking more about concepts of "user", "profile", "identity" etc.
"user" can be many things
@tereško If it's not you can put it where it belongs. I just prefer to keep things that belong together in the same folder rather than having to open up 5 folders just to see everything I need
@SergeyTelshevsky those should probably go in as proper composer packages then :)
@tereško but would you use the same entity for all of this?
@Patrick no, I would have used something like "identity", which might or might not be part of user's composition
@tereško IIRC by symphony ideology your custom packages/components should be the same as composer packages but reside in the separate directory
10:14
but the thing is, that "user" would definitely not be part of Auth .. my point was that those overarching components are not always possible and you get strange things happening at the edges
Morning
hii guys i have my php interviews coming up i just want to know i hae to remember from login to making explode ,for loop ,mysql insert/delete/fetch, and joins the last imp command
@tereško Well but that is an implementation detail depending on how your write your app. You can also put it into a user folder if you prefer and have everything that is related to the user in there. Other parts of your app that use this (like app) are then still free to use those classes
@sonukumar job interviews is not a school exam. You cannot "cram" for it. You either have a clue or not. Also, a lot of depends on how good you are at communicating with humans.
That being said, at work we have different folders for entities, services, repositories etc due to my own design choice quite a while ago. It's just that I regret this choice daily but it's now too late to change
10:20
ok will try have put lots of effort in it have made a shopping cart and a quiz system as my projects
all by myself dont have a teacher right now
@sonukumar If you get a junior dev position you should have a senior that will show you the ropes (hopefully)
@Patrick the reason why I am trying to poke at you about this is because I too have been attempting to assemble classes on those "component" level packages, but I end up with two issues: deep directory trees and fragile "borders" between packages
yes i am avoiding such companies which dont have a senior developer in them
thanks
@tereško so... both suck then? :D
Did I miss something that warrants that COC RFC and/or am I the only one who doesn't think that it makes sense for that RFC at all?
10:23
@sonukumar if you actually learned from people in this chat room, you could improve without actually having a "senior developer" ... it's not like they are made up same spec. In some companies the "senior developer" is just the guy who has not changed workplace in 8 years and have not learned a single new thing since then.
or senior is just someone who negotiated that during interview stage and company accepted because desperate and it's just a job title
Gooood moanings. I've been away for a while, anything of note happened here in the last 3 weeks?
I said, "anything of note"!
10:34
Someone can help me with Mailchimp? I would like to add a 'uniqe' code in my Mail Template
I can upload the code or if possible let mailchimp generate it. But I want to make it as a link in my template.
@Duikboot Do you have a pro account?
@PeeHaa Kinda thinking the same thing
Just a regular account.
@Duikboot IIRC when not on a pro account you will have to import the unique codes yourself
@PeeHaa Ok, and if not, is there a way to grab the code from my imported contacts list?
10:37
Guess its got nothing to do with PSR actually, since it's more of a conduct thing than a practice thing.
@Sean Yeah nothing to do with psr all to do with
> Part of this problem lies with the very structure of some projects: the use of insensitive language, thoughtless use of pronouns, assumptions of gender, and even sexualized or culturally insensitive names.
There must be an option to grab fields to create a 'salution' etc I think but I am overlooking it.
1) Don't be stupid.
Exactly
Also stuff like that tends to be about magically drawn lines by different interpretations
@Duikboot You already have unique codes per user?
Yes.
I have a CSV with contacts, and the code is already a field in it.
10:41
"The team shall consist of... At least one person with commit karma to php-documentation" --- bagsy not me!
Use merge tags @Duikboot
Yes I was looking for tags but it's not available in the 'builder'
Something like: |MyUniqueCode|
Sorry I never used the builder
@PeeHaa it's probably something introduced by starting it with "it the --current year--" ... I have seen used it as excuse for pointless shit way too often lately
Normally me neither but it looked easy for the thing I have to accomplish now. :D
10:44
> We have been notified by your email provider that your email address ([email protected]) is bouncing. We have also noticed you have not visited Meetup for quite a while.
Now that's a scam
If my fucking mails bounces the fuck would I fall for it when you just send me mail dickheads
@tereško Imo all that stuff is scary
@PeeHaa what it comes down to is: "really creepy solutions for 1st world problems"
My thoughts exactly
@Danack Is there any specific reason you are mostly doing loose comparisons in jig?
@PeeHaa what does "bounce" mean in email terms?
@PeeHaa What kind of field would you use to store a code in a list, in mailchimp? Just hidden text?
10:59
@FlorianMargaine if an email bounces if never reaches it's intended recipient
It "bounces" off the server and is rejected, typically an email bounces when you specify an email address which doesn't exist
@FlorianMargaine NDR
@Jimbo ping
@PeeHaa ... NDR?
In the Internet's standard email protocol SMTP, a bounce message, also called a Non-Delivery Report/Receipt (NDR), a (failed) Delivery Status Notification (DSN) message, a Non-Delivery Notification (NDN) or simply a bounce, is an automated electronic mail message from a mail system informing the sender of another message about a delivery problem. The original message is said to have bounced. Feedback info. == Delivery errors == Errors may occur at multiple places in mail delivery. A sender may sometimes receive a bounce message from their own mail server, reporting that it has been unable...
@Andrea nah, it mainly means they're hesitant, not that they're not intervening at all, IMO.
11:01
ah
thanks
@FlorianMargaine What @Sean just ninja linked :P
@bwoebi Hey man, was hoping you could link me to the part where I called Derick a nob or something. Genuinely don't remember and I met and like the guy :-)
Having the 1st on a Friday is just too good to be true
11:03
@Jimbo not you, Joe. chat.stackoverflow.com/…
@tereško lmao
@Sean indeed
@PeeHaa Have you an idea there is an option to get a blueprint for the CSV to import contacts? Or is that no option in mailchimp.
@bwoebi Oh good, see I care if I offend someone I know and have met because I know them. But I'm perfectly happy calling someone I don't know a nob if they deserve it ;-)
> It's too bad that stupidity isn't painful. -- Anton Szandor LaVey
11:06
@Jimbo hah
@Duikboot Blueprint? You mean the headings of the file?
yes, Excactly @PeeHaa
Just export a list and remove the contacts
@bwoebi Thanks anyway man
That's a smart way
11:06
;-)
is a nob different from a knob?
@salathe You tell us. I never understand what you and your people are saying with that fake English :P
hello everyone...
i´m looking for some advise, i´m making a crm for a client, but he´s asking me for a functionality that i don´t know quite well how to perform...he want´s to upload files to the database(that i can do!) but then, he wants to be able to edit those documents...word and excell...i´ve checked phpexcell for the last one, but i also need for word documents and i´m not quite sure about phpexcell, does it do the trick?
he has the habbit of using dropbox
@PeeHaa You fake German
@Jimbo nah, he's so fake that he's a faked fake German.
11:20
lol
@PeeHaa Is it smart to have 1 field like ' language ' in my mail subscription form? So I can split templates in up in different languages but for specific language groups in my list?
I now made a 'dropdown' > language > EN or FR .
@Jimbo hehehe
@Duikboot Depends on whether you want to send different languages :)
I want to send different languages. But it's overkill to have 2 lists I guess.
Mogguh Chris
11:28
hai 11
which one is best mail sender in linux server lib mail, SMTP or anything else?
@PeeHaa Thanks for your information everything works smooth!
\o/
sendmail ? @dinesh
12:05
If anyone has some recommendations for books to read to learn PHP I'd be very thankful if you namedropped them :)
@Gordon Thanks :)
morning
@Duikboot Thaks :)
It does explain a lot. I got a free PHP code at one of those education sites and it's horrid
It's way too advanced for beginner level and if you already know two languages you just wanna tear out your hair...
And I'm not even through with the basic syntax yet. :')
12:42
Name of video: If, if else, else, then. They never mentioned then. Does PHP has a then?
That sounds like a better start
But since apparently all the PHP books are bad... I darenot hope too much :P
@Gemtastic I'd just read through php.net
the manual explain the various language elements just fine
@Gordon Ooh, that's probably the resource I've been looking for :D
12:55
My questions for PHP are kinda "What's the syntax, what's the standard built in PHP libraries(or whatever that's called, I'd like to know that too) and what's specific to PHP, and what are the differences from Java and JavaScript respectively?".
... and I'm back
@Gemtastic if you are looking for a book, I recommend usually this one: wrox.com/WileyCDA/WroxTitle/…. It does not cover the latest additions in 5.4, 5.5, 5.6 and 7.0, but it teaches you the basics of language
@Gemtastic syntax and libraries are explained in detail on php.net. differences to Java or JS isn't.
the difference to Java: PHP is Java, the Good Parts
the difference to JS: PHP has a stable and mature ecosystem
It depends, if it accurately explains PHP the difference will be there for me to find since I know Java and JavaScript
@Gemtastic The two most glaring differences between Java and PHP is that you don't need classes for everything, and that you don't have types for variables or function parameters (although for function parameters, you can)
Good, good, this is music to my brain~
takes notes
13:03
the tricky part for you will be setting up the development environment
@Gemtastic how are you sysadmin skills?
I recently switched to Java and find it surprising how much more code you need for simple tasks that would only require a line of code or two in PHP
The only thing I know about PHP now is how to hack it
like reading in a file or getting the output of a process
@Gordon Welcome to my world
Though I prefer JavaScript to PHP for other reasons
if you suck at unix and/or sysadmin tasks in general, then you will have to install XAMPP (it's the McDonald-equivalent for development environments).
13:05
@Gemtastic Technically, to program in PHP, all you need is the PHP executable. (and a default PHP.ini)
If you want to program web applications in PHP, you also need a webserver configured for that purpose (like Apache or Nginx)
impatiently learning the syntax so that I can start experimenting and observe how the language behaves rather than shifting through this idiot's shit. I'm also an idiot btw, i know that :D
@MadaraUchiha Or the builtin one if you are just dicking around @Gemtastic
13:06
@PeeHaa Right
@Gemtastic we all are idiots here
lol, it hurts
God
Yes, but the question is, do you know about it? And do you know if if else-blocks have a then?
13:07
@PeeHaa Go deeper, write a PHP to invoke nodejs to listen for requests and delegate them to PHP
@MadaraUchiha npm has got it all!
@MadaraUchiha That sounds like fun!
:P
Gotta love them rabbit holes.
@Gemtastic you mean as in
if (a > 3) then begin
   b := 4;
end;
?
if that's what you meant, then NO, php is not pascal
Or what about building my own application server in BASIC :D
(The name of a video is called If, if else, then)
is PHP open source?
13:10
yes, very (for better or worse)
I'm starting to feel like reading the PHP source code is starting to become less of a waste of time than this video course
@MadaraUchiha another proof of Atwood's law
also the broken english is making it worse.
@Gemtastic You don't need a video course
Just set up a dev environment and start writing stuff
Get the basics in order and go from there.
posted on January 05, 2016 by nlecointre

/* by Vooodoo */

13:16
@MadaraUchiha No but I got one for free so I started watching it in lack of anything else to do. I don't sit on my ass and roll my thumbs when I can learn something
I need the basics first, which I'm kinda getting.
You already know a couple languages, you don't need a video course on a new one
hi guys. I' getting this kind of error: Access denied for user 'root'@'localhost' (using password: YES)
@Gemtastic keep in mind that "random videos on the internet" have the same issue as PHP books .. only a lot worse
how will I fix this?
13:18
@Pretorian use the right password?
@Pretorian you need to add root@localhost login in mysql
@tereško It's a video course on udemy
class Database
{
	private static $dbName = 'crud_tutorial' ;
	private static $dbHost = 'localhost' ;
	private static $dbUsername = 'root';
	private static $dbUserPassword = 'root';

	private static $cont  = null;

	public function __construct() {
		exit('Init function is not allowed');
	}

	public static function connect()
	{
	   // One connection through whole application
       if ( null == self::$cont )
       {
        try
        {
          self::$cont =  new PDO( "mysql:host=".self::$dbHost.";"."dbname=".self::$dbName, self::$dbUsername, self::$dbUserPassword);
And it's horrid
@Pretorian
82
Q: Access denied for user 'root'@'localhost' while attempting to grant privileges. How do I grant privileges?

Steven ScottenI've looked at a number of similar questions and so I'm demonstrating that I've checked the basics. Though of course, that doesn't mean I haven't missed something totally obvious. :-) My question is: why am I denied access on a user with the privileges to do what I'm trying to do and where I hav...

13:19
@Pretorian Why are you wrapping all that crap in a class?
@PeeHaa why is he showing us that code at all?
just got it from a tutorial :)
That too
31
Q: mysql how to fix Access denied for user 'root'@'localhost'

VogelsireBefore I screw up something, when login using $ mysql -u root -p, and show databases: +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | game_data | | test | +--------------------+ T...

but it's not working
13:20
Because it's crap mayhaps? :)
@Pretorian problem is on the mysql end of things
Nov 22 '15 at 19:00, by Danack
@divHelper11 They stay at home eating doritos and playing Xbox?
@PeeHaa Because I'm a lazy fuck, also:
WE’RE MORE OF AN MPE SHOP THAN AN MVP SHOP MINIMUM PASSABLE EFFORT WHATEVER’S THE LEAST AMOUNT WE CAN DO WITHOUT BEING OUTRIGHT SUED
see, I am telling you we need a ItDoesNotWorkException. Can finally someone write an RFC for that
ok thanks
13:21
Such a class act that php ceo
Surely though I can summon the energy to turn that PHP code inspection on...
inspect all the things!
Meh first you need at least 3 rewrites :)
@PeeHaa inspect or gadget!
@Gordon Damn son. \o/
I estimate it will take me 1 month to learn enough PHP to be able to say that I know PHP. What do you people think about that estimation? (I learned JS/node.js in 5 weeks)
dee dee deeeedidid diddid diddid deedeediddid deedeeeeeeeeeeeeeeee
Gordon joins us today from his computer book...
@Gordon That last one doesn't look correct
It needs more trailing deeeeee
@Gemtastic to learn the syntax: sure
@tereško Go on?
13:24
@Gemtastic I know kung fu
becoming good at any language takes time
@PeeHaa better?
@salathe I know of kung fu :D
@Gordon <3
13:25
@tereško But you still have to have some point when you an say that you know enough to produce something with the language.
@tereško some folks will never be good, even given a lifetime... *looks at @PeeHee*
:'(
I have other qualities :P
@PeeHaa name some?
@PeeHaa
13:25
@SagarNaliyapara Note that I NEVER mentioned anything about being a pro. Just that I can say I know PHP and I can make stuff.
@SagarNaliyapara please stop linking him to shitty materials
enough already
@salathe lol
Programming IMO is not something you ever stop learning
not ever it's never @Gemtastic
I missed an n
I blame apple!
Because pushing blame is easy :P
45 secs ago, by Sagar Naliyapara
not ever it's never @Gemtastic
WRONG
LOL
@tereško why wrong..??
"not ... ever" was the correct expression
how you can prove that...??
Oh yeah
13:28
@SagarNaliyapara you can't use double negation in english
That WAS the phrase I was looking for
@tereško you can
@SagarNaliyapara Don't play your jedi mindtricks on me!
can you share link for learn english grammar @tereško
wait guys, is it allowed to mixed pdo mysql connection with the old-fashoined type of connection?
@Pretorian no
@tereško You can't not use it!
ouch
GG
thanks
13:31
@Pretorian depends what you mean by "mixed"
@PeeHaa you wrong...! \o/ LOL
You're all wrong.
like I will use pdo in connection and mysql in fetching queries
you can have 2 different objects... it will open 2 connections to mysql
ohh ok
13:33
@Gemtastic some of the people I've worked with have managed to stop learning. I don't recommend working wit people like that....
@salathe YOUR all wrong.
@Danack than your all wrong
you all are wrong
@SagarNaliyapara Nah.
"optional"
y'all are so wrong
13:39
@Machavity all'y'all? or just some of y'all?
all y'all. You done got some grammar messed up in heres
@Danack I'm trying not to. I'm interning atm and the code I've been bug fixing... I dunno what the people had in mind when they wrote this code, but it hits near every bad practice there is.
*waits for @SagarNaliyapara to correct @Machavity*
Seems like they stopped learning Java before they even began. There's no OOP in that code. None.
@Danack Running round talkin' 'bout guns like I ain't got none, what, you think I sold 'em all?
13:42
@DaveRandom I could care less!
@Gemtastic In their defence, Java...
@DaveRandom No, not even in their defense. Java is beautiful compared to that shit
BeautifulCodeFactoryBuilderFactoryInterface
@DaveRandom That's spring...
13:45
boi-oi-oi-oi-ng
Also, even if you program to interfaces there shouldn't be more interfaces than classes
I'm in a weird mood and should probably stop interneting for a bit
@Gemtastic But... but... abstractions are implicitly beautiful!!!!11
@tereško aint cant no use?
fuck you too
@DaveRandom Not wrapped in interface extedning abstract extending abstract with interface...
13:47
@tereško I cant get no satisfaction?
staaaph
I can't get me no girl in action
How to remove that Notice from this code?
define the variable before you start adding to it
Like this? $captcha_token = null;
13:50
@Gemtastic I was working with a C# lib that had quite a few internal interfaces a couple of weeks ago, in the end I gave up trying to comprehend it and wrote my own impl, took me 2 days and 17 classes to provide more functionality than the original lib at ~80 classes
since you are concatenating as string, having $token = ''; as starting would probably be better
Ah I see, tnx
I'm using the JMS Serializer Bundle with Symfony and it keeps formatting \DateTime in the timezone +1 when the timezone in php.ini is Europe/Dublin which is UTC/GMT +00:00. Any ideas?
Plus mine doesn't explode with STA GUI programs, which the original did (which was why I opened the src in the first place)
@DaveRandom Nice for you :)
<--- has never touched C#
13:52
It's basically Java, only good
Shame about .net, but you can't have everything
That why I like learning many languages! Right tool for the right task :D
# config.yml
jms_serializer:
    handlers:
        datetime:
            default_format: "c" # ISO8601
            default_timezone: "UTC" # defaults to whatever timezone set in php.ini or via date_default_timezone_set
@Gordon Thanks. Dunno how I missed that
Does anyone know of an inspection for squizlabs/php_codesniffer that would alarm on == instead of === ?

« first day (1907 days earlier)      last day (3267 days later) »