I'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...
@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.
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)
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
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)
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,
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"
@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.
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
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
@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
@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
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 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
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
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
@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
@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.
> 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.
@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
> 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
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...
@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 :-)
@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 ;-)
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?
@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?
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?".
@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 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)
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 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'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...
Before I screw up something, when login using $ mysql -u root -p, and show databases:
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| game_data |
| test |
+--------------------+
T...
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)
@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.
@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
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?
# 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