Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8369827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:45:15+00:00 2026-06-09T13:45:15+00:00

I have Model class, and Model_Something class. Model_Something have static property ( table name

  • 0

I have Model class, and Model_Something class. Model_Something have static property ( table name ).

I want to access Model_Something static property from Model class.
But it try to find it in Model class and give me exception:

ErrorException [ Fatal Error ]: 
Access to undeclared static property: Model::$_collection_name

I try to access it in this way:

self::$some_property;

How to get it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T13:45:17+00:00Added an answer on June 9, 2026 at 1:45 pm

    You should not access a property in a class which does not exist and depend on it being present in the child. The parent cannot/should not know what a child does, it needs to be the other way around. So first, declare the property in the parent as well, so the parent can access it in any case. The child may then override the value of the property. To make sure you’re always accessing the property of the executing class, you need late static binding, which you get by using static instead of self:

    static::$some_property; 
    

    http://php.net/manual/en/language.oop5.late-static-bindings.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Model: @Entity @Table(name = User) public class User implements Serializable {
Here is my model_users class (the model it extends from doesn't have anything yet
I have a model class with getter and setter methods, and the occasional static
I have a static class in which one property defines a resource manager. for
I have a cart model class that has a List property like so: public
I have a model that is something like this: class Input(models.Model): details = models.CharField(max_length=1000)
I have a model that looks something like this: public abstract class Parent {
I have a model class similar to the following: using System; using System.Collections.Generic; using
I have a model: class Example(models.Model): unique_hash = models.CharField(max_length=32,unique=True) content = models.FileField(upload_to='source',blank=True,verbose_name=HTML Content File)
I have a model class like this: class Note(models.Model): author = models.ForeignKey(User, related_name='notes') content

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.